Skip to content

Commit

Permalink
(#15821) icu: small fixes to support Conan 2.0
Browse files Browse the repository at this point in the history
* icu: fix issues with Conan 2

* icu: remove unnecessary line
  • Loading branch information
jcar87 authored Feb 9, 2023
1 parent b7ecc20 commit 029722d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 38 deletions.
12 changes: 0 additions & 12 deletions recipes/icu/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ sources:
"68.2":
url: "https://github.com/unicode-org/icu/releases/download/release-68-2/icu4c-68_2-src.tgz"
sha256: "c79193dee3907a2199b8296a93b52c5cb74332c26f3d167269487680d479d625"
"67.1":
url: "https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz"
sha256: "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc"
"66.1":
url: "https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz"
sha256: "52a3f2209ab95559c1cf0a14f24338001f389615bf00e2585ef3dbc43ecf0a2e"
"65.1":
url: "https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-src.tgz"
sha256: "53e37466b3d6d6d01ead029e3567d873a43a5d1c668ed2278e253b683136d948"
patches:
"72.1":
- patch_file: "patches/0001-69.1-fix-mingw.patch"
Expand All @@ -39,6 +30,3 @@ patches:
- patch_file: "patches/0001-69.1-fix-mingw.patch"
"68.2":
- patch_file: "patches/0001-67.1-fix-mingw.patch"
"67.1":
- patch_file: "patches/6aba9344a18f4f32e8070ee53b79495630901c26.patch"
- patch_file: "patches/0001-67.1-fix-mingw.patch"
38 changes: 18 additions & 20 deletions recipes/icu/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import glob
import hashlib
import os
import shutil

from conan import ConanFile
from conan.tools.apple import is_apple_os
from conan.tools.build import cross_building, stdcpp_library
from conan.tools.env import Environment, VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm, rmdir, save
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, unix_path
from conan.tools.scm import Version
from conans.tools import get_gnu_triplet
import glob
import hashlib
import os
import shutil
from conan.tools.microsoft import check_min_vs, is_msvc, unix_path

required_conan_version = ">=1.57.0"

Expand Down Expand Up @@ -91,7 +90,7 @@ def build_requirements(self):
self.tool_requires("msys2/cci.latest")

if cross_building(self) and hasattr(self, "settings_build"):
self.tool_requires(self.ref)
self.tool_requires(str(self.ref))

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -101,8 +100,7 @@ def generate(self):
env.generate()

tc = AutotoolsToolchain(self)
if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \
(str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"):
if check_min_vs(self, "180", raise_invalid=False):
tc.extra_cflags.append("-FS")
tc.extra_cxxflags.append("-FS")
if not self.options.shared:
Expand All @@ -127,16 +125,14 @@ def generate(self):
base_path = unix_path(self, self.dependencies.build["icu"].package_folder)
tc.configure_args.append(f"--with-cross-build={base_path}")
if self.settings.os in ["iOS", "tvOS", "watchOS"]:
gnu_triplet = get_gnu_triplet("Macos", str(self.settings.arch))
tc.configure_args.append(f"--host={gnu_triplet}")
elif is_msvc(self):
# ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546)
host = get_gnu_triplet(str(self.settings.os), str(self.settings.arch), "gcc")
build = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), "gcc")
tc.configure_args.extend([
f"--host={host}",
f"--build={build}",
])
# ICU build scripts interpret all Apple platforms as 'darwin'.
# Since this can coincide with the `build` triple, we need to tweak
# the build triple to avoid the collision and ensure the scripts
# know we are cross-building.
host_triplet = f"{str(self.settings.arch)}-apple-darwin"
build_triplet = f"{str(self._settings_build.arch)}-apple"
tc.update_configure_args({"--host": host_triplet,
"--build": build_triplet})
else:
arch64 = ["x86_64", "sparcv9", "ppc64", "ppc64le", "armv8", "armv8.3", "mips64"]
bits = "64" if self.settings.arch in arch64 else "32"
Expand All @@ -151,6 +147,8 @@ def generate(self):
env = Environment()
env.define("CC", "cl -nologo")
env.define("CXX", "cl -nologo")
if cross_building(self):
env.define("icu_cv_host_frag", "mh-msys-msvc")
env.vars(self).save_script("conanbuild_icu_msvc")

def _patch_sources(self):
Expand Down
6 changes: 0 additions & 6 deletions recipes/icu/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@ versions:
folder: all
"68.2":
folder: all
"67.1":
folder: all
"66.1":
folder: all
"65.1":
folder: all

0 comments on commit 029722d

Please sign in to comment.