From bf0117cce987dd92f6e658de0e186a282677b17f Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Thu, 25 Jan 2018 15:14:36 +0100 Subject: iOS, simplified dylib build Change-Id: Icea9a5e4796dda288fafcd478a769fa7087baab2 --- ios/CustomTarget_iOS_link.mk | 87 ++++++++++++++++++++++++++++++++++++ ios/CustomTarget_iOS_prelink.mk | 98 ----------------------------------------- ios/Module_ios.mk | 5 ++- ios/StaticLibrary_iOSkit.mk | 28 ------------ 4 files changed, 90 insertions(+), 128 deletions(-) create mode 100644 ios/CustomTarget_iOS_link.mk delete mode 100644 ios/CustomTarget_iOS_prelink.mk delete mode 100644 ios/StaticLibrary_iOSkit.mk diff --git a/ios/CustomTarget_iOS_link.mk b/ios/CustomTarget_iOS_link.mk new file mode 100644 index 000000000000..ab5ad721d8d7 --- /dev/null +++ b/ios/CustomTarget_iOS_link.mk @@ -0,0 +1,87 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#- Env ------------------------------------------------------------------------ +IOSGEN = $(SRCDIR)/ios/generated +IOSLIBS := $(shell \ + (export INSTDIR=$(INSTDIR);export OS=$(OS); \ + export WORKDIR=$(WORKDIR);export LIBO_LIB_FOLDER=$(LIBO_LIB_FOLDER); \ + $(SRCDIR)/bin/lo-all-static-libs)) +IOSOBJ = $(WORKDIR)/ios/Kit.o +IOSSRC = $(SRCDIR)/ios/source/LibreOfficeKit.c + +ifeq ($(ENABLE_DEBUG),TRUE) +ifeq ($(CPUNAME),X86_64) +IOSKIT = $(IOSGEN)/simulator/libKit.dylib +else +IOSKIT = $(IOSGEN)/debug/libKit.dylib +endif +else +ifeq ($(CPUNAME),ARM64) +IOSKIT = $(IOSGEN)/release/libKit.dylib +endif +endif + + + +#- Top level ----------------------------------------------------------------- +$(eval $(call gb_CustomTarget_CustomTarget,ios/iOS_link)) + +$(call gb_CustomTarget_get_target,ios/iOS_link): $(IOSKIT) + + +#- build --------------------------------------------------------------------- +$(IOSOBJ): $(IOSSRC) $(call gb_CustomTarget_get_target,ios/iOS_setup) + $(call gb_Output_announce,iOS compile interface,$(true),C,2) + $(gb_CC) $(gb_COMPILERDEFS) $(gb_OSDEFS) $(gb_CFLAGS) \ + -DDISABLE_DYNLOADING -DLIBO_INTERNAL_ONLY \ + -fvisibility=hidden -Werror -O0 -fstrict-overflow \ + $(if $(ENABLE_DEBUG),$(gb_DEBUG_CFLAGS) -g) \ + -c $(IOSSRC) -o $(IOSOBJ) \ + -I$(SRCDIR)/include -I$(BUILDDIR)/config_host \ + +$(IOSKIT): $(IOSOBJ) $(IOSLIBS) + $(call gb_Output_announce,iOS dylib,$(true),LNK,2) + $(gb_CC) -dynamiclib \ + -Xlinker -rpath -Xlinker @executable_path/Frameworks \ + -Xlinker -rpath -Xlinker @loader_path/Frameworks \ + -dead_strip \ + -Xlinker -export_dynamic \ + -Xlinker -no_deduplicate \ + -Xlinker -objc_abi_version -Xlinker 2 \ + -fobjc-link-runtime \ + -framework CoreFoundation \ + -framework CoreGraphics \ + -framework CoreText \ + -liconv \ + -lc++ \ + -lz \ + -lpthread \ + -single_module \ + -compatibility_version 1 \ + -current_version 1 \ + $(IOSLIBS) \ + $(IOSOBJ) \ + -o $(IOSKIT) +ifeq ($(origin IOS_CODEID),undefined) + @echo "please define environment variable IOS_CODEID as\n" \ + "export IOS_CODEID=" + @exit -1 +else + codesign -s "$(IOS_CODEID)" $(IOSKIT) +endif + + +#- clean ios ----------------------------------------------------------------- +$(call gb_CustomTarget_get_clean_target,ios/iOS_link): + rm -f $(IOSKIT).dylib + + + +# vim: set noet sw=4 ts=4: diff --git a/ios/CustomTarget_iOS_prelink.mk b/ios/CustomTarget_iOS_prelink.mk deleted file mode 100644 index 0534264d416c..000000000000 --- a/ios/CustomTarget_iOS_prelink.mk +++ /dev/null @@ -1,98 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -#- Env ------------------------------------------------------------------------ -IOSLIB = '' -IOSLD = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -IOSCLANG = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -IOSOBJ = $(WORKDIR)/CObject/ios/Kit.o - -ifeq ($(ENABLE_DEBUG),TRUE) -ifeq ($(CPUNAME),X86_64) -IOSKIT = $(IOSGEN)/simulator/libKit -else -IOSKIT = $(IOSGEN)/debug/libKit -endif -else -ifeq ($(CPUNAME),ARM64) -IOSKIT = $(IOSGEN)/release/libKit -endif -endif - - - -#- Top level ----------------------------------------------------------------- -$(eval $(call gb_CustomTarget_CustomTarget,ios/iOS_prelink)) - -$(call gb_CustomTarget_get_target,ios/iOS_prelink): $(IOSKIT).dylib - - - -#- build --------------------------------------------------------------------- -.PHONY: FORCE -FORCE: - - -IOSPREBUILD: FORCE - $(eval IOSLIBS = `$(SRCDIR)/bin/lo-all-static-libs`) - - - -$(IOSKIT).a: IOSPREBUILD $(WORKDIR)/ios $(call gb_StaticLibrary_get_target,iOS_kitBridge) \ - $(IOSLIBS) - $(call gb_Output_announce,iOS prelink object,$(true),LNK,2) - $(IOSLD) -r -ios_version_min $(IOS_DEPLOYMENT_VERSION) \ - -syslibroot $(MACOSX_SDK_PATH) \ - -arch `echo $(CPUNAME) | tr '[:upper:]' '[:lower:]'` \ - -o $(IOSOBJ) \ - $(WORKDIR)/CObject/ios/source/LibreOfficeKit.o \ - $(IOSLIBS) - $(AR) -r $(IOSKIT).a $(IOSOBJ) - - -$(IOSKIT).dylib: $(IOSKIT).a - $(call gb_Output_announce,iOS dylib,$(true),LNK,2) - $(IOSCLANG) -dynamiclib -mios-simulator-version-min=$(IOS_DEPLOYMENT_VERSION) \ - -arch `echo $(CPUNAME) | tr '[:upper:]' '[:lower:]'` \ - -isysroot $(MACOSX_SDK_PATH) \ - -Xlinker -rpath -Xlinker @executable_path/Frameworks \ - -Xlinker -rpath -Xlinker @loader_path/Frameworks \ - -dead_strip \ - -Xlinker -export_dynamic \ - -Xlinker -no_deduplicate \ - -Xlinker -objc_abi_version -Xlinker 2 \ - -fobjc-link-runtime \ - -framework CoreFoundation \ - -framework CoreGraphics \ - -framework CoreText \ - -liconv \ - -lc++ \ - -lz \ - -lpthread \ - -single_module \ - -compatibility_version 1 \ - -current_version 1 \ - $(IOSOBJ) \ - -o $(IOSKIT).dylib -ifeq ($(origin IOS_CODEID),undefined) - @echo "please define environment variable IOS_CODEID as\n" \ - "export IOS_CODEID=" - @exit -1 -else - codesign -s "$(IOS_CODEID)" $(IOSKIT).dylib -endif - - - - -#- clean ios ----------------------------------------------------------------- -$(call gb_CustomTarget_get_clean_target,ios/iOS_prelink): - rm -f $(IOSKIT).a $(IOSKIT).dylib - - - -# vim: set noet sw=4 ts=4: diff --git a/ios/Module_ios.mk b/ios/Module_ios.mk index c280713cc198..111391b31bee 100644 --- a/ios/Module_ios.mk +++ b/ios/Module_ios.mk @@ -12,11 +12,12 @@ ifeq ($(OS),IOS) $(eval $(call gb_Module_add_targets,ios,\ CustomTarget_iOS_setup \ - StaticLibrary_iOSkit \ - CustomTarget_iOS_prelink \ + CustomTarget_iOS_link \ )) + + endif # vim: set noet sw=4 ts=4: diff --git a/ios/StaticLibrary_iOSkit.mk b/ios/StaticLibrary_iOSkit.mk deleted file mode 100644 index a543e494a344..000000000000 --- a/ios/StaticLibrary_iOSkit.mk +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -$(eval $(call gb_StaticLibrary_StaticLibrary,iOS_kitBridge)) - -$(eval $(call gb_StaticLibrary_add_cobjects,iOS_kitBridge,\ - ios/source/LibreOfficeKit \ -)) - -$(call gb_StaticLibrary_get_target,ios/iOS_kitBridge): $(call gb_CustomTarget_get_target,ios/iOS_setup) - -# vim: set noet sw=4 ts=4: -- cgit