Commit 6c5f0c0e authored by Benjamin REIS's avatar Benjamin REIS

modify ios.py and prepare.py

parent e32ae655
......@@ -48,7 +48,7 @@ class IOSTarget(prepare.Target):
current_path = os.path.dirname(os.path.realpath(__file__))
self.config_file = 'configs/config-ios-' + arch + '.cmake'
self.toolchain_file = 'toolchains/toolchain-ios-' + arch + '.cmake'
self.output = 'liblinphone-sdk/' + arch + '-apple-darwin.ios'
self.output = 'iOS/liblinphone-sdk/' + arch + '-apple-darwin.ios'
self.external_source_path = os.path.join(current_path, 'submodules')
......@@ -101,8 +101,6 @@ class IOSPreparator(prepare.Preparator):
def parse_args(self):
prepare.Preparator.parse_args(self)
self.additional_args += ["-DLINPHONE_IOS_DEPLOYMENT_TARGET=" + self.extract_deployment_target()]
self.additional_args += ["-DLINPHONE_BUILDER_DUMMY_LIBRARIES=" + ' '.join(self.extract_libs_list())]
if self.args.all_codecs:
self.additional_args += ["-DENABLE_GPL_THIRD_PARTIES=ON"]
self.additional_args += ["-DENABLE_NON_FREE_CODECS=ON"]
......@@ -126,30 +124,11 @@ class IOSPreparator(prepare.Preparator):
os.remove('Makefile')
if os.path.isdir('iOS') and not os.listdir('iOS'):
os.rmdir('iOS')
if os.path.isdir('liblinphone-sdk'):
l = os.listdir('liblinphone-sdk')
if len(l) == 1 and l[0] == 'apple-darwin':
shutil.rmtree('liblinphone-sdk', ignore_errors=False)
def extract_from_xcode_project_with_regex(self, regex):
l = []
f = open('linphone.xcodeproj/project.pbxproj', 'r')
lines = f.readlines()
f.close()
for line in lines:
m = regex.search(line)
if m is not None:
l += [m.group(1)]
return list(set(l))
def extract_deployment_target(self):
regex = re.compile("IPHONEOS_DEPLOYMENT_TARGET = (.*);")
return self.extract_from_xcode_project_with_regex(regex)[0]
#if os.path.isdir('liblinphone-sdk'):
# l = os.listdir('liblinphone-sdk')
# if len(l) == 1 and l[0] == 'apple-darwin':
# shutil.rmtree('liblinphone-sdk', ignore_errors=False)
def extract_libs_list(self):
# name = libspeexdsp.a; path = "liblinphone-sdk/apple-darwin/lib/libspeexdsp.a"; sourceTree = "<group>"; };
regex = re.compile("name = \"*(lib\S+)\.a(\")*; path = \"liblinphone-sdk/apple-darwin/")
return self.extract_from_xcode_project_with_regex(regex)
def detect_package_manager(self):
if find_executable("brew"):
......@@ -222,13 +201,6 @@ class IOSPreparator(prepare.Preparator):
self.detect_package_manager(),
" ".join(self.missing_dependencies.values())))
def install_git_hook(self):
git_hook_path = ".git{sep}hooks{sep}pre-commit".format(sep=os.sep)
if os.path.isdir(".git{sep}hooks".format(sep=os.sep)) and not os.path.isfile(git_hook_path):
info("Installing Git pre-commit hook")
shutil.copyfile(".git-pre-commit", git_hook_path)
os.chmod(git_hook_path, 0755)
def generate_makefile(self, generator, project_file=''):
platforms = self.args.target
arch_targets = ""
......@@ -256,14 +228,16 @@ LINPHONE_IPHONE_VERSION=$(shell git describe --always)
.PHONY: all
.SILENT: sdk
all: build
all: generate-ios-sdk
sdk:
\tarchives=`find liblinphone-sdk/{first_arch}-apple-darwin.ios -name '*.a'` && \\
\trm -rf liblinphone-sdk/apple-darwin && \\
\tmkdir -p 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/share liblinphone-sdk/apple-darwin/. && \\
\tarchives=`find iOS/liblinphone-sdk/{first_arch}-apple-darwin.ios -name '*.framework'` && \\
\trm -rf iOS/liblinphone-sdk/apple-darwin && \\
\tmkdir -p iOS/liblinphone-sdk/apple-darwin && \\
\tcp -rf iOS/liblinphone-sdk/{first_arch}-apple-darwin.ios/share iOS/liblinphone-sdk/apple-darwin/. && \\
\tcp -rf iOS/liblinphone-sdk/{first_arch}-apple-darwin.ios/lib iOS/liblinphone-sdk/apple-darwin/. && \\
\tcp -rf iOS/liblinphone-sdk/{first_arch}-apple-darwin.ios/include iOS/liblinphone-sdk/apple-darwin/. && \\
\tcp -rf iOS/liblinphone-sdk/{first_arch}-apple-darwin.ios/Frameworks iOS/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/"`; \\
......@@ -272,42 +246,17 @@ sdk:
\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 $$all_paths -output $$destpath; \\
\t\tlipo -create -output $$destpath/$$framework_name $$armv7_path/$$framework_name $$arm64_path/$$framework_name $$x86_64_path/$$framework_name; \\
\tdone; \\
\tif test -s iOS/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; then \\
\t\techo 'NOTE: the following libraries were STUBBED:'; \\
\t\tcat iOS/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; \\
\tfi
build: $(addsuffix -build, $(archs))
generate-ios-sdk: $(addsuffix -build, $(archs))
\t$(MAKE) sdk
ipa: build
\txcodebuild -configuration Release \\
\t&& xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/linphone.app -o $$PWD/linphone-iphone.ipa
zipsdk: sdk
\techo "Generating SDK zip file for version $(LINPHONE_IPHONE_VERSION)"
\tzip -r liblinphone-iphone-sdk-$(LINPHONE_IPHONE_VERSION).zip \\
\tliblinphone-sdk/apple-darwin \\
\tliblinphone-tutorials \\
\t-x liblinphone-tutorials/hello-world/build\* \\
\t-x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.pbxuser \\
\t-x liblinphone-tutorials/hello-world/hello-world.xcodeproj/*.mode1v3
pull-transifex:
\ttx pull -af
push-transifex:
\t./Tools/i18n_generate_strings_files.sh && \\
\ttx push -s -f --no-interactive
zipres:
\t@tar -czf ios_assets.tar.gz Resources iTunesArtwork
{arch_targets}
help-prepare-options:
......@@ -322,16 +271,14 @@ help: help-prepare-options
\t@echo ""
\t@echo "Available targets:"
\t@echo ""
\t@echo " * all or build: builds all architectures and creates the liblinphone SDK"
\t@echo " * all or generate-ios-sdk: builds all architectures and creates the liblinphone SDK"
\t@echo " * sdk: creates the liblinphone SDK. Use this only after a full build"
\t@echo " * zipsdk: generates a ZIP archive of liblinphone-sdk/apple-darwin containing the SDK. Use this only after SDK is built."
\t@echo " * zipres: creates a tar.gz file with all the resources (images)"
\t@echo ""
""".format(archs=' '.join(platforms), arch_opts='|'.join(platforms),
first_arch=platforms[0], options=' '.join(sys.argv),
arch_targets=arch_targets,
multiarch=multiarch, generator=generator)
f = open('Makefile', 'w')
f = open('Makefile.ios', 'w')
f.write(makefile)
f.close()
......@@ -343,7 +290,6 @@ def main():
if preparator.check_environment() != 0:
preparator.show_environment_errors()
return 1
preparator.install_git_hook()
return preparator.run()
if __name__ == "__main__":
......
......@@ -30,6 +30,7 @@ from distutils.spawn import find_executable
from logging import error, warning, info
from subprocess import Popen
from android import AndroidPreparator
from ios import IOSPreparator
sys.dont_write_bytecode = True
sys.path.insert(0, 'submodules/cmake-builder')
try:
......@@ -48,6 +49,13 @@ def main():
android.parse_args()
android.run()
ios = IOSPreparator()
if ios.check_environment() != 0:
ios.show_environment_errors()
return 1
ios.parse_args()
ios.run()
makefile = """
.PHONY: all
.NOTPARALLEL: all
......@@ -55,8 +63,9 @@ def main():
VERSION=$(shell git --git-dir=submodules/linphone/.git --work-tree=submodules/linphone describe)
include Makefile.android
include Makefile.ios
all: generate-android-sdk sdk
all: generate-android-sdk generate-ios-sdk sdk
sdk:
\tzip -r liblinphone-xamarin-sdk-$(VERSION).zip Xamarin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment