diff options
author | Moonchild <moonchild@palemoon.org> | 2023-07-11 15:53:23 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-07-11 15:53:23 +0000 |
commit | 377625e5391178db4fba7e24288a813c5abd43e9 (patch) | |
tree | 007502b6642d1daee28aefe8579979025de85d16 | |
parent | af5dbfc12003e61f21d2a7c71f239d18ae3945cf (diff) | |
parent | eae076209fdc5a33ed873639972d14cd06edb62f (diff) | |
download | uxp-377625e5391178db4fba7e24288a813c5abd43e9.tar.gz |
Merge pull request 'Enhance Mac Packaging via mozconfig options and fix ARM Mac debug builds.' (#2269) from dbsoft/UXP:macbundle-2268 into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2269
-rw-r--r-- | build/moz.configure/old.configure | 2 | ||||
-rw-r--r-- | old-configure.in | 21 | ||||
-rw-r--r-- | python/mozbuild/mozpack/dmg.py | 35 | ||||
-rw-r--r-- | xpcom/build/PoisonIOInterposerMac.cpp | 4 |
4 files changed, 54 insertions, 8 deletions
diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 40cc9e89fc..3d3873eae8 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -276,7 +276,9 @@ def old_configure_options(*options): '--with-ios-sdk', '--with-jitreport-granularity', '--with-macbundlename-prefix', + '--with-macbundle-entitlement', '--with-macbundle-identity', + '--with-macbundle-type', '--with-macos-private-frameworks', '--with-macos-sdk', '--with-nspr-cflags', diff --git a/old-configure.in b/old-configure.in index d351b81752..4e23dae932 100644 --- a/old-configure.in +++ b/old-configure.in @@ -4763,6 +4763,16 @@ AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID) AC_SUBST(MOZ_MACBUNDLE_ID) dnl ======================================================== +dnl = Mac bundle codesign entitlements +dnl ======================================================== +MOZ_ARG_WITH_STRING(macbundle-entitlement, +[ --with-macbundle-entitlement=entitlementname + Entitlements to add to the Mac application bundle], +[ MOZ_MACBUNDLE_ENTITLEMENT="$withval"]) + +AC_SUBST(MOZ_MACBUNDLE_ENTITLEMENT) + +dnl ======================================================== dnl = Mac bundle codesign identity dnl ======================================================== MOZ_ARG_WITH_STRING(macbundle-identity, @@ -4773,6 +4783,17 @@ MOZ_ARG_WITH_STRING(macbundle-identity, AC_SUBST(MOZ_MACBUNDLE_IDENTITY) dnl ======================================================== +dnl = Mac bundle DMG type +dnl ======================================================== +MOZ_ARG_WITH_STRING(macbundle-type, +[ --with-macbundle-type=hybrid + Method to use to create the DMG], +[ MOZ_MACBUNDLE_TYPE="$withval"]) + +AC_SUBST(MOZ_MACBUNDLE_TYPE) + + +dnl ======================================================== dnl = Child Process Name for IPC dnl ======================================================== MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}" diff --git a/python/mozbuild/mozpack/dmg.py b/python/mozbuild/mozpack/dmg.py index b231f731b8..505cd8729e 100644 --- a/python/mozbuild/mozpack/dmg.py +++ b/python/mozbuild/mozpack/dmg.py @@ -44,19 +44,25 @@ def set_folder_icon(dir): def create_dmg_from_staged(stagedir, output_dmg, tmpdir, volume_name): 'Given a prepared directory stagedir, produce a DMG at output_dmg.' + import buildconfig if not is_linux: # Running on OS X hybrid = os.path.join(tmpdir, 'hybrid.dmg') - subprocess.check_call(['hdiutil', 'create', - '-fs', 'HFS+', - '-volname', volume_name, - '-srcfolder', stagedir, - '-ov', hybrid]) + hdiutiloptions = ['create', '-fs', 'HFS+', + '-volname', volume_name, + '-srcfolder', stagedir, + '-ov', hybrid] + if buildconfig.substs['MOZ_MACBUNDLE_TYPE'] == 'hybrid': + hdiutiloptions = ['makehybrid', '-hfs', + '-hfs-volume-name', volume_name, + '-hfs-openfolder', stagedir, + '-ov', stagedir, + '-o', hybrid] + subprocess.check_call(['hdiutil'] + hdiutiloptions) subprocess.check_call(['hdiutil', 'convert', '-format', 'UDBZ', '-imagekey', 'bzip2-level=9', '-ov', hybrid, '-o', output_dmg]) else: - import buildconfig uncompressed = os.path.join(tmpdir, 'uncompressed.dmg') subprocess.check_call([ buildconfig.substs['GENISOIMAGE'], @@ -123,15 +129,28 @@ def create_dmg(source_directory, output_dmg, volume_name, extra_files): identity = buildconfig.substs['MOZ_MACBUNDLE_IDENTITY'] if identity != '': dylibs = [] + entitlements = [] appbundle = os.path.join(stagedir, buildconfig.substs['MOZ_MACBUNDLE_NAME']) # If the -bin file is in Resources add it to the dylibs as well resourcebin = os.path.join(appbundle, 'Contents/Resources/' + buildconfig.substs['MOZ_APP_NAME'] + '-bin') if os.path.isfile(resourcebin): dylibs.append(resourcebin) # Create a list of dylibs in Contents/Resources that won't get signed by --deep - for root, dirnames, filenames in os.walk('Contents/Resources/'): + for root, dirnames, filenames in os.walk(os.path.join(appbundle,'Contents/Resources/')): for filename in fnmatch.filter(filenames, '*.dylib'): dylibs.append(os.path.join(root, filename)) + # Select default entitlements based on whether debug is enabled entitlement = os.path.abspath(os.path.join(os.getcwd(), '../../platform/security/mac/production.entitlements.xml')) - subprocess.check_call(['codesign', '--deep', '--timestamp', '--options', 'runtime', '--entitlements', entitlement, '-s', identity] + dylibs + [appbundle]) + if buildconfig.substs['MOZ_DEBUG']: + entitlement = os.path.abspath(os.path.join(os.getcwd(), '../../platform/security/mac/developer.entitlements.xml')) + # Check to see if the entitlements are disabled or overrided by mozconfig + entitlementname = buildconfig.substs['MOZ_MACBUNDLE_ENTITLEMENT'] + if entitlementname != '': + if os.path.isfile(entitlementname): + entitlement = entitlementname + if entitlementname != 'none': + if os.path.isfile(entitlement): + entitlements = ['--entitlements', entitlement] + # Call the codesign tool + subprocess.check_call(['codesign', '--deep', '--timestamp', '--options', 'runtime'] + entitlements + [ '-s', identity] + dylibs + [appbundle]) create_dmg_from_staged(stagedir, output_dmg, tmpdir, volume_name) diff --git a/xpcom/build/PoisonIOInterposerMac.cpp b/xpcom/build/PoisonIOInterposerMac.cpp index d76b728ade..d76d6af415 100644 --- a/xpcom/build/PoisonIOInterposerMac.cpp +++ b/xpcom/build/PoisonIOInterposerMac.cpp @@ -4,7 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "PoisonIOInterposer.h" +#ifndef __aarch64__ #include "mach_override.h" +#endif #include "mozilla/ArrayUtils.h" #include "mozilla/Assertions.h" @@ -360,9 +362,11 @@ InitPoisonIOInterposer() if (!d->Function) { continue; } +#ifndef __aarch64__ DebugOnly<mach_error_t> t = mach_override_ptr(d->Function, d->Wrapper, &d->Buffer); MOZ_ASSERT(t == err_none); +#endif } } |