From 65392aa2ed979490fa55ac4d69e72d0f59f656c8 Mon Sep 17 00:00:00 2001 From: Andrew Wooster Date: Sun, 5 Jun 2016 18:57:18 -0700 Subject: [PATCH] Fixes #176: Enables bitcode when building binary library releases. Some more info here: https://forums.developer.apple.com/message/7038 --- etc/bin/build_distribution.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/etc/bin/build_distribution.py b/etc/bin/build_distribution.py index d804aeeef..504584e47 100755 --- a/etc/bin/build_distribution.py +++ b/etc/bin/build_distribution.py @@ -54,11 +54,14 @@ class Builder(object): BINARY_DIST = "BINARY_DIST" build_root = "/tmp/apptentive_connect_build" dist_type = None - def __init__(self, verbose=False, dist_type=None): + enable_bitcode = True + + def __init__(self, verbose=False, dist_type=None, enable_bitcode=True): if not dist_type: dist_type = self.BINARY_DIST self.verbose = verbose self.dist_type = dist_type + self.enable_bitcode = enable_bitcode if dist_type not in [self.BINARY_DIST]: log("Unknown dist_type: %s" % dist_type) sys.exit(1) @@ -73,7 +76,8 @@ def build(self): if status != 0: target_type = "simulator" if is_simulator else "device" arch_type = "64bit" if is_64bit else "not 64bit" - log("Building for %s %s failed with code: %d" % (target_type, arch_type, status)) + bitcode_type = "bitcode enabled" if self.enable_bitcode else "bitcode disabled" + log("Building for %s %s %s failed with code: %d" % (target_type, arch_type, bitcode_type, status)) log(output) return False library_dir = self._output_dir() @@ -158,7 +162,10 @@ def _xcode_options(self, is_simulator=False, is_64bit=False): products_dir = self._products_dir(is_simulator=is_simulator, is_64bit=is_64bit) symroot = os.path.join(self.build_root, "symroot") temp_dir = os.path.join(self.build_root, "target_temp_dir") - return "CONFIGURATION_BUILD_DIR=%s SYMROOT=%s TARGET_TEMP_DIR=%s" % (escape_arg(products_dir), escape_arg(symroot), escape_arg(temp_dir)) + options = "CONFIGURATION_BUILD_DIR=%s SYMROOT=%s TARGET_TEMP_DIR=%s" % (escape_arg(products_dir), escape_arg(symroot), escape_arg(temp_dir)) + if self.enable_bitcode: + options += " ENABLE_BITCODE=YES OTHER_CFLAGS='-fembed-bitcode'" + return options def _lipo_command(self): output_dir = self._output_dir()