From d738862d4a932a0238569e3434219b337b6c1701 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 11 May 2017 11:47:29 +0200 Subject: [PATCH] add possibility to compile SDK in static --- prepare.py | 83 +++++++++++++++++++++++++--------------- submodules/cmake-builder | 2 +- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/prepare.py b/prepare.py index f2030b24a..6029d2e48 100755 --- a/prepare.py +++ b/prepare.py @@ -236,6 +236,10 @@ class IOSPreparator(prepare.Preparator): os.chmod(git_hook_path, 0755) def generate_makefile(self, generator, project_file=''): + if '-DENABLE_STATIC_ONLY=ON' in sys.argv or '-DENABLE_STATIC_ONLY=YES' in sys.argv: + static="true" + else: + static="false" platforms = self.args.target arch_targets = "" for arch in platforms: @@ -249,12 +253,12 @@ class IOSPreparator(prepare.Preparator): multiarch = "" for arch in platforms[1:]: multiarch += \ - """\tif test -f "$${arch}_path"; then \\ -\t\tall_paths=`echo $$all_paths $${arch}_path`; \\ -\t\tall_archs="$$all_archs,{arch}" ; \\ -\telse \\ -\t\techo "WARNING: archive `basename $$archive` exists in {first_arch} tree but does not exists in {arch} tree: $${arch}_path."; \\ -\tfi; \\ + """\t\t\tif test -f "$${arch}_path"; then \\ +\t\t\t\tall_paths=`echo $$all_paths $${arch}_path`; \\ +\t\t\t\tall_archs="$$all_archs,{arch}" ; \\ +\t\t\telse \\ +\t\t\t\techo "WARNING: archive `basename $$archive` exists in {first_arch} tree but does not exists in {arch} tree: $${arch}_path."; \\ +\t\t\tfi; \\ """.format(first_arch=platforms[0], arch=arch) makefile = """ archs={archs} @@ -265,32 +269,51 @@ LINPHONE_IPHONE_VERSION=$(shell git describe --always) all: build sdk: -\tarchives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name '*.framework'` && \\ -\trm -rf liblinphone-sdk/apple-darwin && \\ -\tmkdir -p liblinphone-sdk/apple-darwin && \\ -\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/share liblinphone-sdk/apple-darwin/. && \\ -\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/lib liblinphone-sdk/apple-darwin/. && \\ -\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/include liblinphone-sdk/apple-darwin/. && \\ -\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/Frameworks liblinphone-sdk/apple-darwin/. && \\ -\tfor archive in $$archives ; do \\ -\t\tarmv7_path=`echo $$archive | sed -e "s/{first_arch}/armv7/"`; \\ -\t\tarm64_path=`echo $$archive | sed -e "s/{first_arch}/arm64/"`; \\ -\t\ti386_path=`echo $$archive | sed -e "s/{first_arch}/i386/"`; \\ -\t\tx86_64_path=`echo $$archive | sed -e "s/{first_arch}/x86_64/"`; \\ -\t\tdestpath=`echo $$archive | sed -e "s/-debug//" | sed -e "s/{first_arch}-//" | sed -e "s/\.ios//"`; \\ -\t\tall_paths=`echo $$archive`; \\ -\t\tall_archs="{first_arch}"; \\ -\t\tarchive_name=`basename $$archive`; \\ -\t\tframework_name=`echo $$archive_name | cut -d '.' -f 1`; \\ -\t\tmkdir -p `dirname $$destpath`; \\ -\t\t{multiarch} \\ -\t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\ -\t\tlipo -create -output $$destpath/$$framework_name $$armv7_path/$$framework_name $$arm64_path/$$framework_name $$x86_64_path/$$framework_name; \\ -\tdone; \\ +\tif {static}; then \\ +\t\tarchives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name '*.a'` && \\ +\t\trm -rf liblinphone-sdk/apple-darwin && \\ +\t\tmkdir -p liblinphone-sdk/apple-darwin && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/include liblinphone-sdk/apple-darwin/. && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/share liblinphone-sdk/apple-darwin/. && \\ +\t\tfor archive in $$archives ; do \\ +\t\t\tarmv7_path=`echo $$archive | sed -e "s/{first_arch}/armv7/"`; \\ +\t\t\tarm64_path=`echo $$archive | sed -e "s/{first_arch}/arm64/"`; \\ +\t\t\tdestpath=`echo $$archive | sed -e "s/-debug//" | sed -e "s/{first_arch}-//" | sed -e "s/\.ios//"`; \\ +\t\t\tall_paths=`echo $$archive`; \\ +\t\t\tall_archs="{first_arch}"; \\ +\t\t\tmkdir -p `dirname $$destpath`; \\ +{multiarch} \\ +\t\t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\ +\t\t\tlipo -create $$all_paths -output $$destpath; \\ +\t\tdone; \\ +\telse \\ +\t\tarchives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name '*.framework'` && \\ +\t\trm -rf liblinphone-sdk/apple-darwin && \\ +\t\tmkdir -p liblinphone-sdk/apple-darwin && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/share liblinphone-sdk/apple-darwin/. && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/lib liblinphone-sdk/apple-darwin/. && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/include liblinphone-sdk/apple-darwin/. && \\ +\t\tcp -rf liblinphone-sdk/{first_arch}-apple-darwin.ios/Frameworks liblinphone-sdk/apple-darwin/. && \\ +\t\tfor archive in $$archives ; do \\ +\t\t\tarmv7_path=`echo $$archive | sed -e "s/{first_arch}/armv7/"`; \\ +\t\t\tarm64_path=`echo $$archive | sed -e "s/{first_arch}/arm64/"`; \\ +\t\t\ti386_path=`echo $$archive | sed -e "s/{first_arch}/i386/"`; \\ +\t\t\tx86_64_path=`echo $$archive | sed -e "s/{first_arch}/x86_64/"`; \\ +\t\t\tdestpath=`echo $$archive | sed -e "s/-debug//" | sed -e "s/{first_arch}-//" | sed -e "s/\.ios//"`; \\ +\t\t\tall_paths=`echo $$archive`; \\ +\t\t\tall_archs="{first_arch}"; \\ +\t\t\tarchive_name=`basename $$archive`; \\ +\t\t\tframework_name=`echo $$archive_name | cut -d '.' -f 1`; \\ +\t\t\tmkdir -p `dirname $$destpath`; \\ +{multiarch} \\ +\t\t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\ +\t\t\tlipo -create -output $$destpath/$$framework_name $$armv7_path/$$framework_name $$arm64_path/$$framework_name $$x86_64_path/$$framework_name; \\ +\t\tdone; \\ +\tfi; \\ \tif test -s WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; then \\ \t\techo 'NOTE: the following libraries were STUBBED:'; \\ \t\tcat WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; \\ -\tfi +\tfi; \\ build: $(addsuffix -build, $(archs)) \t$(MAKE) sdk @@ -340,7 +363,7 @@ help: help-prepare-options """.format(archs=' '.join(platforms), arch_opts='|'.join(platforms), first_arch=platforms[0], options=' '.join(sys.argv), arch_targets=arch_targets, - multiarch=multiarch, generator=generator) + multiarch=multiarch, generator=generator,static=static) f = open('Makefile', 'w') f.write(makefile) f.close() diff --git a/submodules/cmake-builder b/submodules/cmake-builder index 95cad0da5..2b02680e5 160000 --- a/submodules/cmake-builder +++ b/submodules/cmake-builder @@ -1 +1 @@ -Subproject commit 95cad0da5c21cf36c99ce63618935da3f7eaaca1 +Subproject commit 2b02680e5758843b865319eae1cd6c1aefc2f2a7