From 771872495822a35dceb99f4865459d42bed1a5ec Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Mon, 27 Aug 2018 12:00:02 +0900 Subject: [PATCH 1/2] pkg building script --- Gruntfile.js | 5 +--- app-template/create-pkg-dist.sh | 28 ++++++++++++++++++++++ resources/bitcoin.com/mac/pkg/build_mas.py | 19 +++++++++++---- 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index eb4bb2eb0..128221895 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,9 +8,6 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), exec: { - get_nwjs_for_pkg: { - command: 'if [ ! -d ./cache/0.19.5-pkg/osx64/nwjs.app ]; then cd ./cache; curl https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip --output nwjs.zip; unzip nwjs.zip; mkdir -p ./0.19.5-pkg/osx64; cp -R ./nwjs-mas-v0.19.5-osx-x64/nwjs.app ./0.19.5-pkg/osx64/; fi' - }, create_others_dist: { command: 'sh webkitbuilds/create-others-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"' }, @@ -364,7 +361,7 @@ module.exports = function(grunt) { grunt.registerTask('desktop-others', ['prod', 'nwjs:others', 'copy:linux', 'exec:create_others_dist']); // Build desktop osx pkg - grunt.registerTask('desktop-osx-pkg', ['prod', 'exec:get_nwjs_for_pkg', 'nwjs:pkg', 'exec:create_pkg_dist']); + grunt.registerTask('desktop-osx-pkg', ['prod', 'nwjs:pkg', 'exec:create_pkg_dist']); // Build desktop osx dmg grunt.registerTask('desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']); diff --git a/app-template/create-pkg-dist.sh b/app-template/create-pkg-dist.sh index c0b4d266d..ee45e21e2 100644 --- a/app-template/create-pkg-dist.sh +++ b/app-template/create-pkg-dist.sh @@ -25,6 +25,7 @@ rm build_mas.py ln -s ../resources/bitcoin.com/mac/pkg/build_mas.py build_mas.py echo "Signing ${APP_NAME}" +export CURRENT_PATH=`pwd` export APP_PATH="pkg/${APP_NAME}/osx64/${APP_NAME}" export TMP_PATH="tmp" export DIST_PATH="dist" @@ -36,6 +37,33 @@ if [ ! -d $DIST_PATH ]; then mkdir $DIST_PATH fi +cd "${APP_PATH}.app/Contents/Versions" +ln -s "55.0.2883.87" "Current" + +cd "55.0.2883.87/nwjs Framework.framework" +mkdir -p "Versions/A" + +mv "libffmpeg.dylib" "Versions/A/libffmpeg.dylib" +ln -s "Versions/Current/libffmpeg.dylib" "libffmpeg.dylib" + +mv "libnode.dylib" "Versions/A/libnode.dylib" +ln -s "Versions/Current/libnode.dylib" "libnode.dylib" + +mv "Helpers" "Versions/A/Helpers" +ln -s "Versions/Current/Helpers" "Helpers" + +mv "Resources" "Versions/A/Resources" +ln -s "Versions/Current/Resources" "Resources" + +mv "nwjs Framework" "Versions/A/nwjs Framework" +ln -s "Versions/Current/nwjs Framework" "nwjs Framework" + +cd "Versions" +ln -s "A" "Current" + +cd $CURRENT_PATH +chmod -vR 777 "${APP_PATH}.app/Contents" + python build_mas.py -C build.cfg -O "${TMP_PATH}/${APP_NAME}.app" -I "${APP_PATH}.app" -P "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg" echo "Signing Done" diff --git a/resources/bitcoin.com/mac/pkg/build_mas.py b/resources/bitcoin.com/mac/pkg/build_mas.py index d067abacd..7b902b1ab 100755 --- a/resources/bitcoin.com/mac/pkg/build_mas.py +++ b/resources/bitcoin.com/mac/pkg/build_mas.py @@ -178,11 +178,22 @@ def codesign_app(config, args): plistlib.writePlist(child_entitlements, tmp_child_entitlements) info('Child entitlements: %s' % tmp_child_entitlements) - framework = glob(args.output, 'nwjs Framework.framework', returnOnFound=True) - system('codesign -f --verbose -s "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, framework)) - helperApp = glob(args.output, 'nwjs Helper.app', returnOnFound=True) - system('codesign -f --verbose -s "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, helperApp)) + appModeLoader = glob(args.output, 'app_mode_loader', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, appModeLoader)) + + crashpadHandler = glob(os.path.join(args.output, 'Contents/Versions/55.0.2883.87/nwjs Framework.framework/Versions/A'), 'crashpad_handler', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, crashpadHandler)) + + libffmpeg = glob(os.path.join(args.output, 'Contents/Versions/55.0.2883.87/nwjs Framework.framework/Versions/A'), 'libffmpeg.dylib', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, libffmpeg)) + libnode = glob(os.path.join(args.output, 'Contents/Versions/55.0.2883.87/nwjs Framework.framework/Versions/A'), 'libnode.dylib', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, libnode)) + helperApp = glob(args.output, 'nwjs Helper.app', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, helperApp)) + framework = glob(args.output, 'nwjs Framework.framework', returnOnFound=True) + system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, framework)) + ## sign parent app (_, tmp_parent_entitlements) = tempfile.mkstemp() if config.has_option('Sign', 'ParentEntitlements'): From 4564040459bff6791c0e4930921f8a0edfaa96fb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Tue, 28 Aug 2018 10:50:53 +0900 Subject: [PATCH 2/2] fixes for pkg mas --- Gruntfile.js | 9 ++++-- app-template/create-pkg-dist.sh | 29 +++---------------- resources/bitcoin.com/mac/pkg/build_mas.py | 5 ---- .../mac/pkg/entitlements-parent.plist | 4 ++- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 128221895..8771b85eb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,6 +8,9 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), exec: { + get_nwjs_for_pkg: { + command: 'if [ ! -d ./cache/0.19.4/osx64/nwjs.app ]; then mkdir -p ./cache/0.19.4/osx64; curl https://dl.nwjs.io/v0.19.5-mas-beta/nwjs-mas-v0.19.5-osx-x64.zip --output ./cache/nwjs.zip; unzip ./cache/nwjs.zip -d ./cache; cp -R ./cache/nwjs-mas-v0.19.5-osx-x64/nwjs.app ./cache/0.19.4/osx64/; fi' + }, create_others_dist: { command: 'sh webkitbuilds/create-others-dist.sh "<%= pkg.name %>" "<%= pkg.fullVersion %>" "<%= pkg.nameCaseNoSpace %>" "<%= pkg.title %>"' }, @@ -293,10 +296,10 @@ module.exports = function(grunt) { }, pkg: { options: { - appName: '<%= pkg.nameCaseNoSpace %>', + appName: '<%= pkg.title %>', platforms: ['osx64'], buildDir: './webkitbuilds/pkg', - version: '0.19.5', + version: '0.19.4', macIcns: './resources/<%= pkg.name %>/mac/pkg/app.icns', exeIco: './www/img/app/logo.ico', macPlist: { @@ -361,7 +364,7 @@ module.exports = function(grunt) { grunt.registerTask('desktop-others', ['prod', 'nwjs:others', 'copy:linux', 'exec:create_others_dist']); // Build desktop osx pkg - grunt.registerTask('desktop-osx-pkg', ['prod', 'nwjs:pkg', 'exec:create_pkg_dist']); + grunt.registerTask('desktop-osx-pkg', ['prod', 'exec:get_nwjs_for_pkg', 'nwjs:pkg', 'exec:create_pkg_dist']); // Build desktop osx dmg grunt.registerTask('desktop-osx-dmg', ['prod', 'nwjs:dmg', 'exec:create_dmg_dist']); diff --git a/app-template/create-pkg-dist.sh b/app-template/create-pkg-dist.sh index ee45e21e2..66fe589d0 100644 --- a/app-template/create-pkg-dist.sh +++ b/app-template/create-pkg-dist.sh @@ -24,9 +24,9 @@ ln -s ../resources/bitcoin.com/mac/pkg/build.cfg build.cfg rm build_mas.py ln -s ../resources/bitcoin.com/mac/pkg/build_mas.py build_mas.py -echo "Signing ${APP_NAME}" +echo "Signing ${APP_FULLNAME}" export CURRENT_PATH=`pwd` -export APP_PATH="pkg/${APP_NAME}/osx64/${APP_NAME}" +export APP_PATH="pkg/${APP_FULLNAME}/osx64/${APP_FULLNAME}" export TMP_PATH="tmp" export DIST_PATH="dist" @@ -40,34 +40,13 @@ fi cd "${APP_PATH}.app/Contents/Versions" ln -s "55.0.2883.87" "Current" -cd "55.0.2883.87/nwjs Framework.framework" -mkdir -p "Versions/A" - -mv "libffmpeg.dylib" "Versions/A/libffmpeg.dylib" -ln -s "Versions/Current/libffmpeg.dylib" "libffmpeg.dylib" - -mv "libnode.dylib" "Versions/A/libnode.dylib" -ln -s "Versions/Current/libnode.dylib" "libnode.dylib" - -mv "Helpers" "Versions/A/Helpers" -ln -s "Versions/Current/Helpers" "Helpers" - -mv "Resources" "Versions/A/Resources" -ln -s "Versions/Current/Resources" "Resources" - -mv "nwjs Framework" "Versions/A/nwjs Framework" -ln -s "Versions/Current/nwjs Framework" "nwjs Framework" - -cd "Versions" -ln -s "A" "Current" - cd $CURRENT_PATH chmod -vR 777 "${APP_PATH}.app/Contents" -python build_mas.py -C build.cfg -O "${TMP_PATH}/${APP_NAME}.app" -I "${APP_PATH}.app" -P "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg" +python build_mas.py -C build.cfg -O "${TMP_PATH}/${APP_FULLNAME}.app" -I "${APP_PATH}.app" -P "$DIST_PATH/${APP_PACKAGE}-wallet-${APP_VERSION}-osx.pkg" echo "Signing Done" echo "Done." -exit +exit \ No newline at end of file diff --git a/resources/bitcoin.com/mac/pkg/build_mas.py b/resources/bitcoin.com/mac/pkg/build_mas.py index 7b902b1ab..90f7ad5f0 100755 --- a/resources/bitcoin.com/mac/pkg/build_mas.py +++ b/resources/bitcoin.com/mac/pkg/build_mas.py @@ -178,11 +178,6 @@ def codesign_app(config, args): plistlib.writePlist(child_entitlements, tmp_child_entitlements) info('Child entitlements: %s' % tmp_child_entitlements) - appModeLoader = glob(args.output, 'app_mode_loader', returnOnFound=True) - system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, appModeLoader)) - - crashpadHandler = glob(os.path.join(args.output, 'Contents/Versions/55.0.2883.87/nwjs Framework.framework/Versions/A'), 'crashpad_handler', returnOnFound=True) - system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, crashpadHandler)) libffmpeg = glob(os.path.join(args.output, 'Contents/Versions/55.0.2883.87/nwjs Framework.framework/Versions/A'), 'libffmpeg.dylib', returnOnFound=True) system('codesign --deep --force --verbose --verify --sign "%s" --entitlements %s --deep "%s"' % (identity, tmp_child_entitlements, libffmpeg)) diff --git a/resources/bitcoin.com/mac/pkg/entitlements-parent.plist b/resources/bitcoin.com/mac/pkg/entitlements-parent.plist index 12d6997e3..b39edb569 100644 --- a/resources/bitcoin.com/mac/pkg/entitlements-parent.plist +++ b/resources/bitcoin.com/mac/pkg/entitlements-parent.plist @@ -5,7 +5,9 @@ com.apple.security.app-sandbox com.apple.security.application-groups - $GROUPID + + 299HJ3G3BP.com.bitcoin.mwallet.mac + com.apple.security.files.user-selected.read-only com.apple.security.network.client