summaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-10-20 13:15:32 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-10-23 12:13:09 +0200
commitd5c11ddae9e54668f5d8997f4c37dd542e656d4f (patch)
treef3337b25d763efaef9440836a15b88d70e155f53 /Makefile.in
parent6e6c6f697b019348161648d9d26398bf64de83ef (diff)
build appstore packages with symbols/add targets to merge into universal build
while there is no builtin support to create a fat binary during the actual build phase, we have a post-processing script that can merge two separately built architectures into an universal binary one. Thus enhance the makefile to support a more convenient way to build the two archs without the need to manually move the package out of the way to build the other arch. 1) assemble one architecture's package via "make mac-app-store-package.prepare" 2) make clean and change targets in autogen.input to build for the other architecture 3) build the other architecture and combine into universal binary and also package into the final deliverable via make mac-app-store-package.universal (of course you can also use the .prepare target separately also in the second build, and just mac-app-store-package will build the deliverable for the current architecture like it did before) Change-Id: I02c14e9b8c4f6e39d0d50cd3b4ffdd060b2d69bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141557 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in50
1 files changed, 45 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in
index 3cfbb6a90bb2..203611de0fe9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -200,7 +200,7 @@ include $(SRCDIR)/compilerplugins/Makefile.mk
#
# Distclean
#
-distclean : clean compilerplugins-clean
+distclean : clean compilerplugins-clean mac-app-store-package.clean
rm -fr \
$(BUILDDIR)/Makefile \
$(BUILDDIR)/aclocal.m4 \
@@ -398,16 +398,56 @@ endif
endif
@$(call gb_Top_InstallFinished,Test Installation,$(TESTINSTALLDIR))
-mac-app-store-package: test-install
+# target to bypass the packaging steps/to only assemble the package
+mac-app-store-package.prepare: $(BUILDDIR)/$(PLATFORMID)/done
+
+# shorthand target to build a complete package for the currently building architecture
+mac-app-store-package: mac-app-store-package.$(PLATFORMID)
+
+# recipe/targets to do the actual packaging
+# the symbolication switch to productbuild unforunately is undocumented, but that is what XCode
+# uses when it creates a package with symbols for uploading to the appstore
+mac-app-store-package.$(PLATFORMID) mac-app-store-package.universal: mac-app-store-package.%: $(BUILDDIR)/%/done
ifneq ($(MACOSX_PACKAGE_SIGNING_IDENTITY),)
- rm -rf "$(PRODUCTNAME).app"
- mv "$(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app" "$(PRODUCTNAME).app"
- productbuild --component "$(PRODUCTNAME).app" /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) $(PRODUCTNAME_WITHOUT_SPACES).pkg
+ $(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $*/"$(PRODUCTNAME)".app
+ productbuild $(if $(ENABLE_SYMBOLS_FOR),--symbolication $*/Symbols) --component $*/"$(PRODUCTNAME)".app /Applications --sign $(MACOSX_PACKAGE_SIGNING_IDENTITY) $(PRODUCTNAME_WITHOUT_SPACES).pkg
else
@echo You did not provide an installer signing identity with --enable-macosx-package-signing
@exit 1
endif
+# the builds need to persist a standard "make clean" to be able to combine them into an universal
+# binary, so provide an additional target that can be used standalone or via make distclean
+mac-app-store-package.clean:
+ rm -rf \
+ $(BUILDDIR)/macosx_x86_64 \
+ $(BUILDDIR)/macosx_aarch64 \
+ $(BUILDDIR)/universal \
+ $(BUILDDIR)/$(PRODUCTNAME_WITHOUT_SPACES).pkg
+
+# used by the mac-app-store targets
+$(BUILDDIR)/$(PLATFORMID)/done: test-install
+ rm -rf $(PLATFORMID)
+ mkdir -p $(PLATFORMID)/Symbols
+ mv $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app $(PLATFORMID)/"$(PRODUCTNAME)".app
+ifneq ($(ENABLE_SYMBOLS_FOR),)
+ symbols -arch all -symbolsPackageDir $(PLATFORMID)/Symbols $(PLATFORMID)/"$(PRODUCTNAME)".app/Contents/Frameworks/[^L]* $(PLATFORMID)/"$(PRODUCTNAME)".app/Contents/MacOS/*
+ strip -S $(PLATFORMID)/"$(PRODUCTNAME)".app/Contents/Frameworks/[^L]* $(PLATFORMID)/"$(PRODUCTNAME)".app/Contents/MacOS/*
+endif
+ touch $@
+
+# build one arch using the mac-app-store-package.prepare target, make clean and change the autogen.input
+# to buid for the other target, then use mac-app-store-package.universal to build for the other arch and
+# combine the two into a universal binary
+$(BUILDDIR)/universal/done: $(BUILDDIR)/macosx_x86_64/done $(BUILDDIR)/macosx_aarch64/done
+ rm -rf universal
+ mkdir -p universal/Symbols
+ifneq ($(ENABLE_SYMBOLS_FOR),)
+ cp -a macosx_x86_64/Symbols/* macosx_aarch64/Symbols/* universal/Symbols/
+endif
+ $(SRCDIR)/bin/merge-app-bundles macosx_x86_64/"$(PRODUCTNAME)".app macosx_aarch64/"$(PRODUCTNAME)".app universal/"$(PRODUCTNAME)".app
+ touch $@
+
distro-pack-install: install
$(SRCDIR)/bin/distro-install-clean-up
$(SRCDIR)/bin/distro-install-desktop-integration