From dfcebcf9e2819eff8d54b43ce79c0efe7d7bb1e6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 31 Aug 2016 08:32:05 -0600 Subject: [PATCH] Version for Mac App Store build from GYP ready, not tested yet. Still need to merge code changes from macstore branch. --- Telegram/Patches/gyp.diff | 42 ++++++ Telegram/Telegram.plist | 10 +- .../Telegram/Telegram Desktop.entitlements | 16 ++ Telegram/gyp/common.gypi | 7 +- Telegram/gyp/refresh.sh | 4 +- Telegram/gyp/settings_mac.gypi | 8 +- Telegram/gyp/telegram_mac.gypi | 142 ++++++++++++------ 7 files changed, 177 insertions(+), 52 deletions(-) create mode 100644 Telegram/Patches/gyp.diff create mode 100644 Telegram/Telegram/Telegram Desktop.entitlements diff --git a/Telegram/Patches/gyp.diff b/Telegram/Patches/gyp.diff new file mode 100644 index 0000000000..fda8468e2e --- /dev/null +++ b/Telegram/Patches/gyp.diff @@ -0,0 +1,42 @@ +diff --git a/pylib/gyp/generator/xcode.py b/pylib/gyp/generator/xcode.py +index 0e3fb93..0679660 100644 +--- a/pylib/gyp/generator/xcode.py ++++ b/pylib/gyp/generator/xcode.py +@@ -72,6 +72,10 @@ generator_additional_non_configuration_keys = [ + 'ios_app_extension', + 'ios_watch_app', + 'ios_watchkit_extension', ++ ++ 'mac_sandbox', # sandbox support ++ 'mac_sandbox_development_team', ++ + 'mac_bundle', + 'mac_bundle_resources', + 'mac_framework_headers', +@@ -761,6 +765,26 @@ def GenerateOutput(target_list, target_dicts, data, params): + xcode_targets[qualified_target] = xct + xcode_target_to_target_dict[xct] = spec + ++ # sandbox support ++ is_sandbox = int(spec.get('mac_sandbox', 0)) ++ if is_sandbox: ++ dev_team = spec.get('mac_sandbox_development_team', '%%ERROR%%') ++ assert dev_team != '%%ERROR%%', ( ++ 'mac_sandbox must be accompanied by mac_sandbox_development_team (target "%s")' % ++ target_name) ++ try: ++ tmp = pbxp._properties['attributes']['TargetAttributes'] ++ except KeyError: ++ pbxp._properties['attributes']['TargetAttributes'] = {} ++ pbxp._properties['attributes']['TargetAttributes'][xct] = { ++ 'DevelopmentTeam': dev_team, ++ 'SystemCapabilities': { ++ 'com.apple.Sandbox': { ++ 'enabled': 1, ++ }, ++ }, ++ } ++ + spec_actions = spec.get('actions', []) + spec_rules = spec.get('rules', []) + diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 2adf50e55b..f4272eaf20 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -3,17 +3,15 @@ CFBundleExecutable - Telegram + $(PRODUCT_NAME) CFBundleGetInfoString Telegram Desktop messaging app - CFBundleIconFile - Icon CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundlePackageType APPL CFBundleShortVersionString - $(TDESKTOP_VERSION) + $(CURRENT_PROJECT_VERSION) CFBundleSignature ???? CFBundleURLTypes @@ -31,6 +29,10 @@ + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + LSApplicationCategoryType + public.app-category.social-networking LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NOTE diff --git a/Telegram/Telegram/Telegram Desktop.entitlements b/Telegram/Telegram/Telegram Desktop.entitlements new file mode 100644 index 0000000000..36331c7096 --- /dev/null +++ b/Telegram/Telegram/Telegram Desktop.entitlements @@ -0,0 +1,16 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.files.bookmarks.app-scope + + com.apple.security.network.client + + + diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi index d012514924..df4b6eb726 100644 --- a/Telegram/gyp/common.gypi +++ b/Telegram/gyp/common.gypi @@ -85,7 +85,12 @@ }, { 'mac_target%': '10.8', 'build_macold': 0, - }] + }], + [ '"<(official_build_target)" == "macstore"', { + 'build_macstore': 1, + }, { + 'build_macstore': 0, + }], ], 'ld_lib_prefix': '<(ld_lib_prefix)', 'ld_lib_postfix': '<(ld_lib_postfix)', diff --git a/Telegram/gyp/refresh.sh b/Telegram/gyp/refresh.sh index af664532d8..daa69b076b 100755 --- a/Telegram/gyp/refresh.sh +++ b/Telegram/gyp/refresh.sh @@ -7,7 +7,9 @@ popd > /dev/null cd $FullScriptPath #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja -gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode +#gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode +# use patched gyp with Xcode project generator +../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode cd ../.. cd $FullExecPath diff --git a/Telegram/gyp/settings_mac.gypi b/Telegram/gyp/settings_mac.gypi index 649f2011c9..44b9d26fc7 100644 --- a/Telegram/gyp/settings_mac.gypi +++ b/Telegram/gyp/settings_mac.gypi @@ -94,10 +94,10 @@ 'xcode_settings': { 'CLANG_CXX_LIBRARY': 'libc++', 'OTHER_LDFLAGS': [ - '-framework VideoToolbox', - '-framework VideoDecodeAcceleration', - '-framework AVFoundation', - '-framework CoreMedia', + '-framework', 'VideoToolbox', + '-framework', 'VideoDecodeAcceleration', + '-framework', 'AVFoundation', + '-framework', 'CoreMedia', ], }, }], diff --git a/Telegram/gyp/telegram_mac.gypi b/Telegram/gyp/telegram_mac.gypi index c282d997c3..e13f72a43c 100644 --- a/Telegram/gyp/telegram_mac.gypi +++ b/Telegram/gyp/telegram_mac.gypi @@ -23,8 +23,8 @@ 'GCC_PREFIX_HEADER': '<(src_loc)/stdafx.h', 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', 'INFOPLIST_FILE': '../Telegram.plist', - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram', - 'TDESKTOP_VERSION': '0.10.2', + 'CURRENT_PROJECT_VERSION': '0.10.2', + 'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon', 'OTHER_LDFLAGS': [ '-lcups', '-lbsm', @@ -34,9 +34,6 @@ '/usr/local/lib/liblzma.a', '/usr/local/lib/libopus.a', '/usr/local/lib/libexif.a', - '-lbase', - '-lcrashpad_client', - '-lcrashpad_util', ], }, 'include_dirs': [ @@ -67,6 +64,39 @@ '