From 94f70904d93adda3f4c03b7c329072462376d234 Mon Sep 17 00:00:00 2001 From: Kleto Zan Date: Mon, 5 Dec 2022 07:53:57 -0300 Subject: [PATCH 1/4] openssl: add embed-bitcode if tools.apple:enable_bitcode is set --- recipes/openssl/1.x.x/conanfile.py | 2 ++ recipes/openssl/3.x.x/conanfile.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index 33409d111d88c..2b07e5affae10 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -757,6 +757,8 @@ def build(self): xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) + if self.settings.os in ["iOS", "tvOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + env_vars["CFLAGS"] = "-fembed-bitcode" with tools.environment_append(env_vars): if self._full_version > "1.1.0": self._create_targets() diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index 05de257a52c5f..f9ffd1602541e 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -606,6 +606,8 @@ def build(self): xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) + if self.settings.os in ["iOS", "tvOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + env_vars["CFLAGS"] = "-fembed-bitcode" with tools.environment_append(env_vars): self._create_targets() with self._make_context(): From f1652ae3c645217244f7f83aa0b8a73c1a15b299 Mon Sep 17 00:00:00 2001 From: Kleto Zan Date: Mon, 5 Dec 2022 08:51:38 -0300 Subject: [PATCH 2/4] openssl: add embed-bitcode to watchOS --- recipes/openssl/1.x.x/conanfile.py | 2 +- recipes/openssl/3.x.x/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index 2b07e5affae10..c20905fe0aa42 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -757,7 +757,7 @@ def build(self): xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - if self.settings.os in ["iOS", "tvOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): env_vars["CFLAGS"] = "-fembed-bitcode" with tools.environment_append(env_vars): if self._full_version > "1.1.0": diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index f9ffd1602541e..62685cc468225 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -606,7 +606,7 @@ def build(self): xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - if self.settings.os in ["iOS", "tvOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): env_vars["CFLAGS"] = "-fembed-bitcode" with tools.environment_append(env_vars): self._create_targets() From 4dd960cf948ffd02552e07277506179e31a0616d Mon Sep 17 00:00:00 2001 From: Kleto Zan Date: Mon, 5 Dec 2022 09:23:43 -0300 Subject: [PATCH 3/4] openssl: do not override CFLAGS, append instead --- recipes/openssl/1.x.x/conanfile.py | 3 ++- recipes/openssl/3.x.x/conanfile.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index c20905fe0aa42..d8ce6a3abfe8c 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -758,7 +758,8 @@ def build(self): env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): - env_vars["CFLAGS"] = "-fembed-bitcode" + cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) + env_vars["CFLAGS"] = "%s %s" % (cflags, "-fembed-bitcode") with tools.environment_append(env_vars): if self._full_version > "1.1.0": self._create_targets() diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index 62685cc468225..7c2c2389969e4 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -607,7 +607,8 @@ def build(self): env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): - env_vars["CFLAGS"] = "-fembed-bitcode" + cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) + env_vars["CFLAGS"] = "%s %s" % (cflags, "-fembed-bitcode") with tools.environment_append(env_vars): self._create_targets() with self._make_context(): From fee9eda398d7d644f28549155541f63dad315b87 Mon Sep 17 00:00:00 2001 From: Kleto Zan Date: Tue, 17 Jan 2023 18:18:02 -0300 Subject: [PATCH 4/4] openssl: set bitcode in templates instead of env vars --- recipes/openssl/1.x.x/conanfile.py | 4 ++++ recipes/openssl/3.x.x/conanfile.py | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index d8ce6a3abfe8c..d0f8f1ef35c5f 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -621,6 +621,10 @@ def _create_targets(self): if self.options.get_safe("fPIC", True): shared_cflag='shared_cflag => "-fPIC",' + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + cflags.append("-fembed-bitcode") + cxxflags.append("-fembed-bitcode") + config = config_template.format(targets=targets, target=self._target, ancestor=ancestor, diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index 7c2c2389969e4..d92e93ed55602 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -506,6 +506,10 @@ def _create_targets(self): if self.options.get_safe("fPIC", True): shared_cflag = 'shared_cflag => "-fPIC",' + if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): + cflags.append("-fembed-bitcode") + cxxflags.append("-fembed-bitcode") + config = config_template.format( targets=targets, target=self._target, @@ -606,9 +610,6 @@ def build(self): xcrun = tools.XCRun(self.settings) env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - if self.settings.os in ["iOS", "tvOS", "watchOS"] and self.conf.get("tools.apple:enable_bitcode", check_type=bool): - cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) - env_vars["CFLAGS"] = "%s %s" % (cflags, "-fembed-bitcode") with tools.environment_append(env_vars): self._create_targets() with self._make_context():