Version for Mac App Store build from GYP ready, not tested yet.

Still need to merge code changes from macstore branch.
This commit is contained in:
John Preston 2016-08-31 08:32:05 -06:00
parent 50616cc267
commit dfcebcf9e2
7 changed files with 177 additions and 52 deletions

42
Telegram/Patches/gyp.diff Normal file
View File

@ -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', [])

View File

@ -3,17 +3,15 @@
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Telegram</string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleGetInfoString</key>
<string>Telegram Desktop messaging app</string>
<key>CFBundleIconFile</key>
<string>Icon</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(TDESKTOP_VERSION)</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -31,6 +29,10 @@
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NOTE</key>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

View File

@ -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)',

View File

@ -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

View File

@ -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',
],
},
}],

View File

@ -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 @@
'<!@(python -c "for s in \'<@(langpacks)\'.split(\' \'): print(\'<(res_loc)/langs/\' + s + \'.lproj/Localizable.strings\')")',
'../Telegram/Images.xcassets'
],
}], [ 'build_macold', {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
'OTHER_LDFLAGS': [
'/usr/local/openal_old/lib/libopenal.a',
'/usr/local/zlib_old/lib/libz.a',
'/usr/local/iconv_old/lib/libiconv.a',
'/usr/local/ffmpeg_old/lib/libavcodec.a',
'/usr/local/ffmpeg_old/lib/libavformat.a',
'/usr/local/ffmpeg_old/lib/libavutil.a',
'/usr/local/ffmpeg_old/lib/libswscale.a',
'/usr/local/ffmpeg_old/lib/libswresample.a',
'-lbase',
'-lcrashpad_client',
'-lcrashpad_util',
],
},
'include_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad',
'<(libs_loc)/crashpad_oldmac/crashpad/third_party/mini_chromium/mini_chromium',
],
'configurations': {
'Debug': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Debug',
],
},
'Release': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Release',
],
},
},
'postbuilds': [{
'postbuild_name': 'Force Frameworks path',
'action': [
@ -84,40 +114,7 @@
'action': [
'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/'
],
}],
}], [ 'build_macold', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'/usr/local/openal_old/lib/libopenal.a',
'/usr/local/zlib_old/lib/libz.a',
'/usr/local/iconv_old/lib/libiconv.a',
'/usr/local/ffmpeg_old/lib/libavcodec.a',
'/usr/local/ffmpeg_old/lib/libavformat.a',
'/usr/local/ffmpeg_old/lib/libavutil.a',
'/usr/local/ffmpeg_old/lib/libswscale.a',
'/usr/local/ffmpeg_old/lib/libswresample.a',
],
},
'include_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad',
'<(libs_loc)/crashpad_oldmac/crashpad/third_party/mini_chromium/mini_chromium',
],
'library_dirs': [
'/usr/local/ffmpeg_old',
],
'configurations': {
'Debug': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Debug',
],
},
'Release': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Release',
],
},
},
'postbuilds': [{
}, {
'postbuild_name': 'Copy crashpad_client to Helpers',
'action': [
'cp',
@ -142,9 +139,6 @@
'<(libs_loc)/crashpad/crashpad',
'<(libs_loc)/crashpad/crashpad/third_party/mini_chromium/mini_chromium',
],
'library_dirs': [
'/usr/local/ffmpeg',
],
'configurations': {
'Debug': {
'library_dirs': [
@ -157,7 +151,33 @@
],
},
},
}], [ '"<(build_macold)" != "1" and "<(build_macstore)" != "1"', {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
'OTHER_LDFLAGS': [
'-lbase',
'-lcrashpad_client',
'-lcrashpad_util',
],
},
'postbuilds': [{
'postbuild_name': 'Force Frameworks path',
'action': [
'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Frameworks/'
],
}, {
'postbuild_name': 'Copy Updater to Frameworks',
'action': [
'cp',
'${BUILT_PRODUCTS_DIR}/Updater',
'${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Frameworks/',
],
}, {
'postbuild_name': 'Force Helpers path',
'action': [
'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/'
],
}, {
'postbuild_name': 'Copy crashpad_client to Helpers',
'action': [
'cp',
@ -165,5 +185,43 @@
'${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/',
],
}],
}], [ 'build_macstore', {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'org.telegram.desktop',
'OTHER_LDFLAGS': [
'-framework', 'Breakpad',
],
'FRAMEWORK_SEARCH_PATHS': [
'<(libs_loc)/breakpad/src/client/mac/build/Release',
],
},
'mac_sandbox': 1,
'mac_sandbox_development_team': '6N38VWS5BX',
'product_name': 'Telegram Desktop',
'sources': [
'../Telegram/Telegram Desktop.entitlements',
],
'defines': [
'TDESKTOP_DISABLE_AUTOUPDATE',
'MAC_USE_BREAKPAD',
],
'postbuilds': [{
'postbuild_name': 'Clear Frameworks path',
'action': [
'rm', '-rf', '${BUILT_PRODUCTS_DIR}/Telegram Desktop.app/Contents/Frameworks'
],
}, {
'postbuild_name': 'Force Frameworks path',
'action': [
'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram Desktop.app/Contents/Frameworks/'
],
}, {
'postbuild_name': 'Copy Breakpad.framework to Frameworks',
'action': [
'cp', '-a',
'<(libs_loc)/breakpad/src/client/mac/build/Release/Breakpad.framework',
'${BUILT_PRODUCTS_DIR}/Telegram Desktop.app/Contents/Frameworks/Breakpad.framework',
],
}]
}]],
}