diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-10-20 13:15:32 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-11-01 19:37:46 +0100 |
commit | 8869bc853a34b5a15324fb6ce42f638851866d16 (patch) | |
tree | 15b7d248a4111e75b92b08fce76616020d459430 | |
parent | a02ba0ed435a6fa2c5774a74759cf3cbae2ddcc0 (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>
(cherry picked from commit d5c11ddae9e54668f5d8997f4c37dd542e656d4f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141702
(cherry picked from commit 28481066174a6673e997b325ca02f2bbd21e967b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141914
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | Makefile.in | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in index a5ae689b614e..f15ed75d8acf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -201,7 +201,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 unfortunately 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 build 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 |