summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-10-30 14:38:20 +0100
committerDamiano Galassi <[email protected]>2020-11-05 09:49:16 +0100
commit25da8ed4896f43c86c0a9eaedf09b4b883f43227 (patch)
treeec839a2dcdfa9494834a9ae079b2942db5290ab6 /macosx
parentb7de6666eb2112cd6dc3eb3f05427e03d6f13519 (diff)
build: improve ub target to generate a arm64/x86_64 binary.
Diffstat (limited to 'macosx')
-rwxr-xr-xmacosx/hbsign6
-rw-r--r--macosx/module.defs76
-rw-r--r--macosx/module.xcodebuild14
-rw-r--r--macosx/xcconfig/base/arch.arm64.xcconfig1
-rw-r--r--macosx/xcconfig/osx1011.arm64.xcconfig3
5 files changed, 89 insertions, 11 deletions
diff --git a/macosx/hbsign b/macosx/hbsign
index 8c1b0584b..2bc28f4a4 100755
--- a/macosx/hbsign
+++ b/macosx/hbsign
@@ -201,8 +201,10 @@ for TARGET in "${@}"; do
echo " Validating App Bundle"
verify "${TARGET}" deep
- echo " Validating Execution Privileges"
- spctl -a -t exec -vv "${TARGET}" >>"${LOG}" 2>&1 || exit_with_error 1 "Validation failed. More info may be available in ${LOG}"
+ if [ "${IDENTITY}" != "-" ]; then
+ echo " Validating Execution Privileges"
+ spctl -a -t exec -vv "${TARGET}" >>"${LOG}" 2>&1 || exit_with_error 1 "Validation failed. More info may be available in ${LOG}"
+ fi
elif [[ "${TARGET##*/}" == 'HandBrakeCLI' ]]; then
echo "${TARGET}:"
diff --git a/macosx/module.defs b/macosx/module.defs
index a561e613d..a4c3d5fad 100644
--- a/macosx/module.defs
+++ b/macosx/module.defs
@@ -75,11 +75,77 @@ MACOSX.XCODE = $(strip \
\
$(2) )
-ifeq (1,$(SECURITY.sandbox))
- MACOSX.SIGN = $(strip $(MACOSX.src/)hbsign -sr '$(ID)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
-else
- MACOSX.SIGN = $(strip $(MACOSX.src/)hbsign -r '$(ID)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
-endif
+MACOSX.SIGN.flags = $(if $(filter 1,$(SECURITY.sandbox)),-sr,-r)
+MACOSX.SIGN.id = $(if $(ID),$(ID),-)
+MACOSX.SIGN = $(strip $(MACOSX.src/)hbsign $(MACOSX.SIGN.flags) '$(MACOSX.SIGN.id)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
MACOSX.NOTARIZE = $(strip $(MACOSX.src/)hbnotarize '$(USERNAME)' $(MACOSX.xroot/)HandBrake.app $(MACOSX.xroot/)HandBrakeCLI)
+###############################################################################
+##
+## Universal binary
+##
+###############################################################################
+
+UB.xcconfigs = osx1011.arm64 osx1011.x86_64
+UB.builds = $(wildcard $(foreach n,$(UB.xcconfigs),$(SRC/)build.$n))
+UB.first = $(word 1,$(UB.xcconfigs))
+UB.more = $(wordlist 2,999,$(UB.xcconfigs))
+
+UB.products/ = $(MACOSX.xroot/)
+
+UB.app/ = HandBrake.app/Contents/
+UB.frameworks/ = $(UB.app/)Frameworks/
+UB.xpcServices/ = $(UB.app/)XPCServices/
+
+UB.contents = $(UB.app/)MacOS/HandBrake \
+ $(UB.frameworks/)HandBrakeKit.framework/Versions/A/HandBrakeKit \
+ $(UB.frameworks/)Sparkle.framework/Versions/A/Sparkle \
+ $(UB.frameworks/)Sparkle.framework/Versions/A/Resources/Autoupdate \
+ $(UB.xpcServices/)HandBrakeXPCService.xpc/Contents/MacOS/HandBrakeXPCService \
+ $(UB.xpcServices/)HandBrakeXPCService2.xpc/Contents/MacOS/HandBrakeXPCService2 \
+ $(UB.xpcServices/)HandBrakeXPCService3.xpc/Contents/MacOS/HandBrakeXPCService3 \
+ $(UB.xpcServices/)HandBrakeXPCService4.xpc/Contents/MacOS/HandBrakeXPCService4 \
+ $(UB.xpcServices/)org.sparkle-project.Downloader.xpc/Contents/MacOS/org.sparkle-project.Downloader \
+ $(UB.xpcServices/)org.sparkle-project.InstallerConnection.xpc/Contents/MacOS/org.sparkle-project.InstallerConnection \
+ $(UB.xpcServices/)org.sparkle-project.InstallerLauncher.xpc/Contents/MacOS/org.sparkle-project.InstallerLauncher \
+ $(UB.xpcServices/)org.sparkle-project.InstallerLauncher.xpc/Contents/MacOS/Autoupdate \
+ $(UB.xpcServices/)org.sparkle-project.InstallerLauncher.xpc/Contents/MacOS/Updater.app/Contents/MacOS/Updater \
+ $(UB.xpcServices/)org.sparkle-project.InstallerStatus.xpc/Contents/MacOS/org.sparkle-project.InstallerStatus
+
+UB.BUILD = $(SRC/)configure --force --build=$(BUILD/)ub.$(1) --xcode-config=$(1) $(CONF.args) --launch
+
+## linefeed is important
+define UB.BUILD.item
+ $(call UB.BUILD,$(1)) --launch-jobs=0
+
+endef
+
+define UB.BUILD.SERIAL
+ $(foreach n,$(UB.xcconfigs),$(call UB.BUILD.item,$n))
+endef
+
+define UB.BUILD.lipo
+ $(LIPO.exe) $(foreach n,$(UB.xcconfigs),ub.$n/$(UB.products/)$1) -create -output $(UB.products/)$1
+
+endef
+
+define UB.COMBINE
+ $(RM.exe) -fr $(UB.products/)
+ $(MKDIR.exe) -p $(UB.products/)
+
+ $(CP.exe) ub.$(UB.first)/$(UB.products/)HandBrakeCLI $(UB.products/).
+ $(LIPO.exe) $(foreach n,$(UB.xcconfigs),ub.$n/$(UB.products/)HandBrakeCLI) -create -output $(UB.products/)HandBrakeCLI
+
+ $(CP.exe) -R ub.$(UB.first)/$(UB.products/)HandBrake.app $(UB.products/).
+ $(foreach n,$(UB.contents),$(call UB.BUILD.lipo,$n))
+
+ @sync
+ @echo ""
+ @echo "$@: { $(UB.xcconfigs) } combined -> $(UB.products/)HandBrakeCLI"
+ @echo "$@: UB executable size: `du -sh $(UB.products/)HandBrakeCLI | awk '{ print $$1 }'`"
+ @echo ""
+ @echo "$@: { $(UB.xcconfigs) } combined -> $(UB.products/)HandBrake.app"
+ @echo "$@: UB executable size: `du -sh $(UB.products/)$(1) | awk '{ print $$1 }'`"
+ @echo ""
+endef
diff --git a/macosx/module.xcodebuild b/macosx/module.xcodebuild
index 366057cd2..8073ef3d8 100644
--- a/macosx/module.xcodebuild
+++ b/macosx/module.xcodebuild
@@ -1,15 +1,20 @@
## This file is processed only when shunting build through xcodebuild
-.PHONY: macosx.build macosx.sign macosx.notarize macosx.clean macosx.install macosx.install-strip macosx.uninstall
+.PHONY: macosx.build macosx.ub macosx.sign macosx.notarize macosx.clean macosx.install macosx.install-strip macosx.uninstall
macosx.build:
$(call MACOSX.XCODE,HandBrakeCLI HandBrake,build)
+macosx.ub:
+ $(call UB.BUILD.SERIAL)
+ $(call UB.COMBINE)
+ $(call MACOSX.SIGN)
+
macosx.sign:
- $(call MACOSX.SIGN,HandBrakeCLI HandBrake,sign)
+ $(call MACOSX.SIGN)
macosx.notarize:
- $(call MACOSX.NOTARIZE,HandBrakeCLI HandBrake,notarize)
+ $(call MACOSX.NOTARIZE)
macosx.clean:
$(call MACOSX.XCODE,HandBrakeCLI HandBrake,clean)
@@ -31,6 +36,7 @@ macosx.uninstall:
$(RM.exe) -f $(PREFIX/)bin/HandBrakeCLI
build: macosx.build
+ub: macosx.ub
sign: macosx.sign
notarize: macosx.notarize
clean: macosx.clean
@@ -41,7 +47,7 @@ xclean: clean
###############################################################################
-MACOSX.goals = $(filter-out build sign notarize clean install,$(MAKECMDGOALS))
+MACOSX.goals = $(filter-out build ub sign notarize clean install,$(MAKECMDGOALS))
$(MACOSX.goals): __goals__
@true
diff --git a/macosx/xcconfig/base/arch.arm64.xcconfig b/macosx/xcconfig/base/arch.arm64.xcconfig
new file mode 100644
index 000000000..973b212e5
--- /dev/null
+++ b/macosx/xcconfig/base/arch.arm64.xcconfig
@@ -0,0 +1 @@
+ARCHS = arm64
diff --git a/macosx/xcconfig/osx1011.arm64.xcconfig b/macosx/xcconfig/osx1011.arm64.xcconfig
new file mode 100644
index 000000000..56dd4b9e5
--- /dev/null
+++ b/macosx/xcconfig/osx1011.arm64.xcconfig
@@ -0,0 +1,3 @@
+#include "base/os.osx1011.xcconfig"
+#include "base/arch.arm64.xcconfig"
+EXTERNAL_XCCONFIG = osx1011.arm64