def system_requirements(self): installer = SystemPackageTool() if tools.os_info.is_linux: if tools.os_info.with_pacman or \ tools.os_info.with_yum: installer.install("gcc-fortran") else: installer.install("gfortran") versionfloat = Version(self.settings.compiler.version.value) if self.settings.compiler == "gcc": if versionfloat < "5.0": installer.install( "libgfortran-{}-dev".format(versionfloat)) else: installer.install("libgfortran-{}-dev".format( int(versionfloat))) if tools.os_info.is_macos and Version( self.settings.compiler.version.value) > "7.3": try: installer.install("gcc", update=True, force=True) except Exception: self.output.warn( "brew install gcc failed. Tying to fix it with 'brew link'" ) self.run("brew link --overwrite gcc")
def validate(self): compiler = str(self.settings.compiler) compiler_version = Version(self.settings.compiler.version.value) minimum_compiler_version = { "Visual Studio": "19", "gcc": "8", "clang": "7.0", "apple-clang": "12" } minimum_cpp_standard = 17 if compiler in minimum_compiler_version and \ compiler_version < minimum_compiler_version[compiler]: raise ConanInvalidConfiguration("{} requires a compiler that supports" " at least C++{}. {} {} is not" " supported." .format(self.name, minimum_cpp_standard, compiler, compiler_version)) if compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11": raise ConanInvalidConfiguration("clang 11 with libstdc++ is not supported due to old libstdc++ missing C++17 support") if tools.is_apple_os(self.settings.os): os_version = self.settings.get_safe("os.version") if os_version and Version(os_version) < self._mac_os_minimum_required_version: raise ConanInvalidConfiguration( "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.") if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, minimum_cpp_standard)
def _patch(self): if self.settings.compiler == "Visual Studio": replace = "POCO_INSTALL_PDB(${target_name})" tools.replace_in_file( os.path.join(self._source_subfolder, "cmake", "PocoMacros.cmake"), replace, "# " + replace) if self.options.shared: self.output.warn("Adding ws2_32 dependency...") replace = 'Net Util Foundation Crypt32.lib' if Version(self.version) >= "1.10.0": replace = 'Poco::Net Poco::Util Crypt32.lib' tools.replace_in_file( os.path.join(self._source_subfolder, "NetSSL_Win", "CMakeLists.txt"), replace, replace + " ws2_32 ") replace = 'Foundation ${OPENSSL_LIBRARIES}' if Version(self.version) >= "1.10.0": replace = 'Poco::Foundation OpenSSL::SSL OpenSSL::Crypto' tools.replace_in_file( os.path.join(self._source_subfolder, "Crypto", "CMakeLists.txt"), replace, replace + " ws2_32 Crypt32.lib") # Poco 1.9.x - CMAKE_SOURCE_DIR is required in many places os.rename( os.path.join(self._source_subfolder, "CMakeLists.txt"), os.path.join(self._source_subfolder, "CMakeListsOriginal.cmake")) os.rename("CMakeLists.txt", os.path.join(self._source_subfolder, "CMakeLists.txt"))
def configure(self): if self.options.shared: del self.options.fPIC if self.settings.get_safe("compiler.cppstd"): tools.check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get( str(self.settings.compiler)) if not min_version: self.output.warn("{} recipe lacks information about the {} compiler support.".format( self.name, self.settings.compiler)) else: if tools.Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration("{} requires C++14 support. The current compiler {} {} does not support it.".format( self.name, self.settings.compiler, self.settings.compiler.version)) if self.settings.os == "Windows" and self.settings.arch != "x86_64": raise ConanInvalidConfiguration("Folly requires a 64bit target architecture") elif self.settings.os == "Windows" and self.settings.compiler == "Visual Studio" and \ "MT" in self.settings.compiler.runtime: raise ConanInvalidConfiguration("Folly could not be build with runtime MT") elif self.settings.os == "Macos" and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built by apple-clang as shared library") elif self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built on Windows as a shared library") elif Version(self.version) >= "2020.08.10.00" and self.settings.compiler == "Visual Studio" and \ not self.options.shared: raise ConanInvalidConfiguration("Folly could not be built on Windows as a static library") elif Version(self.version) >= "2020.08.10.00" and self.settings.compiler == "clang" and \ self.options.shared: raise ConanInvalidConfiguration("Folly could not be built by clang as a shared library") self._strip_options_requirements()
def configure(self): if self.settings.compiler == "gcc": if Version(self.settings.compiler.version.value) < "4.8": raise ConanInvalidConfiguration( "g++ >= 4.8 is required, yours is %s" % self.settings.compiler.version) elif self.settings.compiler == "clang" and Version( self.settings.compiler.version.value) < "4.0": raise ConanInvalidConfiguration( "clang >= 4.0 is required, yours is %s" % self.settings.compiler.version) elif self.settings.compiler == "apple-clang" and Version( self.settings.compiler.version.value) < "9.0": raise ConanInvalidConfiguration( "clang >= 9.0 is required, yours is %s" % self.settings.compiler.version) elif self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) > "10.0" and \ self.settings.arch == 'x86': raise ConanInvalidConfiguration( "clang >= 11.0 does not support x86") elif self.settings.compiler == "Visual Studio" and Version( self.settings.compiler.version.value) < "15": raise ConanInvalidConfiguration( "Visual Studio >= 15 is required, yours is %s" % self.settings.compiler.version)
def requirements(self): if Version(self.version) >= "1.7.0": self.requires("fmt/7.0.1") elif Version(self.version) >= "1.5.0": self.requires("fmt/6.2.0") else: self.requires("fmt/6.0.0")
def validate(self): compiler = str(self.settings.compiler) compiler_version = Version(self.settings.compiler.version.value) lib_version = Version(self.version) minimum_compiler_version = { "Visual Studio": "16" if lib_version >= "7.6.0" else "15", "gcc": "8" if lib_version >= "7.5.0" else "7", "clang": "6", "apple-clang": "10" } minimum_cpp_standard = 17 if compiler in minimum_compiler_version and \ compiler_version < minimum_compiler_version[compiler]: raise ConanInvalidConfiguration( "{} requires a compiler that supports" " at least C++{}. {} {} is not" " supported.".format(self.name, minimum_cpp_standard, compiler, compiler_version)) if self.settings.os == "Macos": os_version = self.settings.get_safe("os.version") if os_version and Version( os_version) < self._mac_os_minimum_required_version: raise ConanInvalidConfiguration( "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old." ) if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, minimum_cpp_standard)
def _get_boostrap_toolset(self): if self._is_msvc: comp_ver = self.settings.compiler.version if Version(str(comp_ver)) >= "16": return "vc142" elif Version(str(comp_ver)) >= "15": return "vc141" else: return "vc%s" % comp_ver if tools.os_info.is_windows: return "gcc" if self.settings.compiler == "gcc" else "" if tools.os_info.is_macos: return "clang" with_toolset = { "apple-clang": "clang" }.get(str(self.settings.compiler), str(self.settings.compiler)) # fallback for the case when no unversioned gcc/clang is available if with_toolset in ["gcc", "clang"]: # check for C++ compiler, as b2 uses only C++ one, which may not be installed alongside C compiler compiler = "g++" if with_toolset == "gcc" else "clang++" if not tools.which(compiler): with_toolset = "cxx" if Version(str( self.version)) >= "1.71" else "cc" return with_toolset
def package_info(self): self.cpp_info.filenames["cmake_find_package"] = "folly" self.cpp_info.filenames["cmake_find_package_multi"] = "folly" self.cpp_info.names["cmake_find_package"] = "Folly" self.cpp_info.names["cmake_find_package_multi"] = "Folly" self.cpp_info.names["pkg_config"] = "libfolly" self.cpp_info.components["libfolly"].names[ "cmake_find_package"] = "folly" self.cpp_info.components["libfolly"].names[ "cmake_find_package_multi"] = "folly" self.cpp_info.components["libfolly"].names["pkg_config"] = "libfolly" if Version(self.version) == "2019.10.21.00": self.cpp_info.components["libfolly"].libs = [ "follybenchmark", "folly_test_util", "folly" ] elif Version(self.version) >= "2020.08.10.00": if self.settings.os == "Linux": self.cpp_info.components["libfolly"].libs = [ "folly_exception_counter", "folly_exception_tracer", "folly_exception_tracer_base", "folly_test_util", "follybenchmark", "folly" ] else: self.cpp_info.components["libfolly"].libs = [ "folly_test_util", "follybenchmark", "folly" ] self.cpp_info.components["libfolly"].requires = [ "boost::boost", "bzip2::bzip2", "double-conversion::double-conversion", "gflags::gflags", "glog::glog", "libevent::libevent", "lz4::lz4", "openssl::openssl", "snappy::snappy", "zlib::zlib", "zstd::zstd", "libdwarf::libdwarf", "libsodium::libsodium", "xz_utils::xz_utils" ] if self.settings.os == "Linux": self.cpp_info.components["libfolly"].requires.extend( ["libiberty::libiberty", "libunwind::libunwind"]) self.cpp_info.components["libfolly"].system_libs.extend( ["pthread", "dl", "rt"]) if Version(self.version) >= "2020.08.10.00": self.cpp_info.components["libfolly"].requires.append("fmt::fmt") if self.settings.os == "Linux": self.cpp_info.components["libfolly"].defines.extend( ["FOLLY_HAVE_ELF", "FOLLY_HAVE_DWARF"]) elif self.settings.os == "Windows": self.cpp_info.components["libfolly"].system_libs.extend( ["ws2_32", "iphlpapi", "crypt32"]) if (self.settings.os == "Linux" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++") or \ (self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) == "9.0" and self.settings.compiler.libcxx == "libc++"): self.cpp_info.components["libfolly"].system_libs.append("atomic") if self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version( self.settings.compiler.version.value) >= "11.0": self.cpp_info.components["libfolly"].system_libs.append("c++abi")
def build(self): if Version(self.version) < "1.7" and Version(self.deps_cpp_info["fmt"].version) >= "7": raise ConanInvalidConfiguration("The project {}/{} requires fmt < 7.x".format(self.name, self.version)) # self._disable_werror() if not self.options.header_only: cmake = self._configure_cmake() cmake.build()
def validate(self): # https://github.com/erikzenker/hsm#dependencies if self.settings.compiler == "clang" and Version( self.settings.compiler.version) < 8: raise ConanInvalidConfiguration("clang 8+ is required") if self.settings.compiler == "gcc" and Version( self.settings.compiler.version) < 8: raise ConanInvalidConfiguration("GCC 8+ is required")
def _patch_clang(self): if self.settings.compiler == "clang" and \ Version(self.settings.compiler.version) < "6.0" and \ self.settings.compiler.libcxx == "libc++" and \ Version(self.version) < "3": tools.replace_in_file( os.path.join(self._source_subfolder, "include", "SQLiteCpp", "Utils.h"), "const nullptr_t nullptr = {};", "")
def configure(self): if self.options.shared: del self.options.fPIC if self.settings.compiler == "Visual Studio": if Version(self.settings.compiler.version) < "15": raise ConanInvalidConfiguration("Visual Studio 15 2017 or newer is required") if self.settings.compiler == "gcc" and Version(self.settings.compiler.version.value) < "5.3": raise ConanInvalidConfiguration("GCC 5.3 or newer is required")
def configure(self): if self.settings.compiler != "gcc": # and self.settings.compiler != "clang": raise ConanInvalidConfiguration("Library works only with gcc") # and clang") if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9": raise ConanInvalidConfiguration("Library requires at least g++-9") if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "11": raise ConanInvalidConfiguration("Library requires at least clang++-11") if self.settings.compiler.cppstd not in ["20", "gnu20"]: raise ConanInvalidConfiguration("Library requires at least C++20 support")
def _toolset_version(self): if self._is_msvc: compiler_version = str(self.settings.compiler.version) if Version(compiler_version) >= "16": return "14.2" elif Version(compiler_version) >= "15": return "14.1" else: return "%s.0" % compiler_version return ""
def configure(self): if Version(self.version) < Version("11.0.12"): if self.settings.arch != "x86_64": raise ConanInvalidConfiguration( "Unsupported Architecture. This package currently only supports x86_64." ) if self.settings.os not in ["Windows", "Macos", "Linux"]: raise ConanInvalidConfiguration( "Unsupported os. This package currently only support Linux/Macos/Windows" )
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) + ["folly"] if self.settings.os == "Linux": self.cpp_info.libs.extend(["pthread", "dl"]) elif self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": self.cpp_info.libs.extend(["ws2_32", "Iphlpapi", "Crypt32"]) if (self.settings.os == "Linux" and self.settings.compiler == "clang" and Version(self.settings.compiler.version.value) == "6" and self.settings.compiler.libcxx == "libstdc++") or \ (self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) == "9.0" and self.settings.compiler.libcxx == "libc++"): self.cpp_info.libs.append("atomic")
def build(self): if Version(self.version) < Version("11.0.12"): tools.get(**self.conan_data["sources"][self.version][str( self._settings_build.os)], destination=self._source_subfolder, strip_root=True) else: tools.get(**self.conan_data["sources"][self.version][str( self._settings_build.os)][str(self._settings_build.arch)], destination=self._source_subfolder, strip_root=True)
def supports_cpp14(self): compiler = str(self.settings.compiler) version = Version(str(self.settings.compiler.version)) if compiler == "Visual Studio" and version >= Version("14"): return True if compiler == "gcc" and version >= Version("5"): return True if compiler == "clang" and version >= Version("3.4"): return True if compiler == "apple-clang" and version >= Version("6.1"): return True return False
def _build_visual_studio(self): # since VS2015 vsnprintf is built-in if Version(self.settings.compiler.version) >= "14": path = os.path.join(self._source_subfolder, "src", "lcms2_internal.h") tools.replace_in_file(path, "# define vsnprintf _vsnprintf", "") with tools.chdir(os.path.join(self._source_subfolder, "Projects", "VC2013")): target = "lcms2_DLL" if self.options.shared else "lcms2_static" upgrade_project = Version(self.settings.compiler.version) > "12" # run build msbuild = MSBuild(self) msbuild.build("lcms2.sln", targets=[target], platforms={"x86": "Win32"}, upgrade_project=upgrade_project)
def validate(self): if self.settings.compiler == "Visual Studio": if tools.Version(self.version) > "8.0.17": if Version(self.settings.compiler.version) < "16": raise ConanInvalidConfiguration("Visual Studio 16 2019 or newer is required") else: if Version(self.settings.compiler.version) < "15": raise ConanInvalidConfiguration("Visual Studio 15 2017 or newer is required") if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5.3": raise ConanInvalidConfiguration("GCC 5.3 or newer is required") if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "6": raise ConanInvalidConfiguration("clang 6 or newer is required")
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) self.cpp_info.libs.sort(reverse=True) self.cpp_info.includedirs = ["include"] self.cpp_info.libdirs = ["lib"] self.cpp_info.bindirs = ["bin"] self.env_info.LD_LIBRARY_PATH.append( os.path.join(self.package_folder, "lib")) self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) for libpath in self.deps_cpp_info.lib_paths: self.env_info.LD_LIBRARY_PATH.append(libpath) if self.settings.os == "Linux": self.cpp_info.libs.extend(["pthread", "m", "dl"]) if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++": self.cpp_info.libs.append("atomic") elif self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": self.cpp_info.libs.extend(["ws2_32", "Iphlpapi", "Crypt32"]) if (self.settings.os == "Linux" and self.settings.compiler == "clang" and Version(self.settings.compiler.version.value) == "6" and self.settings.compiler.libcxx == "libstdc++") or \ (self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) == "9.0" and self.settings.compiler.libcxx == "libc++"): self.cpp_info.libs.append("atomic") self.cpp_info.includedirs.append( os.path.join(self.package_folder, "include")) self.cpp_info.includedirs.append(self.package_folder) bindir = os.path.join(self.package_folder, "bin") self.output.info( "Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) libdir = os.path.join(self.package_folder, "lib") self.output.info( "Appending PATH environment variable: {}".format(libdir)) self.env_info.PATH.append(libdir) self.cpp_info.libs = list(self.cling_libs.keys()) self.cpp_info.libs += list(self.llvm_libs.keys()) #self.cpp_info.libs += ['c++abi'] #self.cpp_info.libs.remove('profile_rt') #self.cpp_info.libs = [lib for lib in self.cpp_info.libs if "profile_rt" not in lib] #self.cpp_info.defines += ['LLVMDIR=%s' % (cpu_count)] self.output.info("LIBRARIES: %s" % self.cpp_info.libs) self.output.info("Package folder: %s" % self.package_folder) self.env_info.CONAN_CLING_ROOT = self.package_folder
def _patch_sources(self): if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "14": # since VS2015 vsnprintf is built-in path = os.path.join(self._source_subfolder, "src", "lcms2_internal.h") tools.replace_in_file(path, "# define vsnprintf _vsnprintf", "") if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "16": # since VS2019, don't need to specify the WindowsTargetPlatformVersion path = os.path.join(self._source_subfolder, "Projects", "VC2015", "lcms2_static", "lcms2_static.vcxproj") tools.replace_in_file(path, "<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>", "") if self.settings.os == "Android" and tools.os_info.is_windows: # remove escape for quotation marks, to make ndk on windows happy tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g")
def _toolset_version_and_exe(self): compiler_version = str(self.settings.compiler.version) major = compiler_version.split(".")[0] if "." not in compiler_version: compiler_version += ".0" compiler = str(self.settings.compiler) if self._is_msvc: if Version(compiler_version) >= "16": _msvc_version = "14.2" elif Version(compiler_version) >= "15": _msvc_version = "14.1" else: _msvc_version = compiler_version return "msvc", _msvc_version, "" elif self.settings.os == "Windows" and self.settings.compiler == "clang": return "clang-win", compiler_version, "" elif self.settings.os == "Emscripten" and self.settings.compiler == "clang": return "emscripten", compiler_version, self._cxx elif self.settings.compiler == "gcc" and tools.is_apple_os( self.settings.os): return "darwin", compiler_version, self._cxx elif compiler == "gcc" and Version(major) >= "5": # For GCC >= v5 we only need the major otherwise Boost doesn't find the compiler # The NOT windows check is necessary to exclude MinGW: if not tools.which("g++-%s" % major): # In fedora 24, 25 the gcc is 6, but there is no g++-6 and the detection is 6.3.1 # so b2 fails because 6 != 6.3.1. Specify the exe to avoid the smart detection executable = tools.which("g++") or "" else: executable = "" return compiler, compiler_version, executable elif self.settings.compiler == "apple-clang": return "clang-darwin", compiler_version, self._cxx elif self.settings.os == "Android" and self.settings.compiler == "clang": return "clang-linux", compiler_version, self._cxx elif str(self.settings.compiler) in ["clang", "gcc"]: # For GCC < v5 and Clang we need to provide the entire version string return compiler, compiler_version, "" elif self.settings.compiler == "sun-cc": return "sunpro", compiler_version, "" elif self.settings.compiler == "intel": toolset = { "Macos": "intel-darwin", "Windows": "intel-win", "Linux": "intel-linux" }.get(str(self.settings.os)) return toolset, compiler_version, "" else: return compiler, compiler_version, ""
def _has_support_for_cpp17(self): supported_compilers = [("apple-clang", 10), ("clang", 5), ("gcc", 7), ("Visual Studio", 15.7)] compiler, version = self.settings.compiler, Version( self.settings.compiler.version) return any(compiler == sc[0] and version >= sc[1] for sc in supported_compilers)
def config_options(self): if self.settings.os == "Windows": del self.options.fPIC if not self._is_x86: del self.options.with_sse2 del self.options.with_ssse3 del self.options.with_sse4_1 del self.options.with_sse4_2 del self.options.with_avx2 del self.options.with_bmi2 del self.options.with_rdrand del self.options.with_rdseed del self.options.with_aes_ni del self.options.with_sha_ni if not self._is_arm: del self.options.with_neon del self.options.with_armv8crypto if not self._is_ppc: del self.options.with_altivec del self.options.with_powercrypto # --single-amalgamation option is no longer available # See also https://github.com/randombit/botan/pull/2246 if Version(self.version) >= "2.14.0": del self.options.single_amalgamation
def configure(self): if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": del self.options.fPIC compiler_version = Version(self.settings.compiler.version.value) if compiler_version < "14": raise ConanInvalidConfiguration("On Windows Protobuf can only be built with " "Visual Studio 2015 or higher.")
def package_info(self): compiler = self.settings.compiler version = Version(self.settings.compiler.version) if compiler == "gcc": self.cpp_info.cxxflags = ["-Wno-non-template-friend"] elif compiler == "Visual Studio": self.cpp_info.cxxflags = ["/utf-8"]
def _build_msvc(self): # windows\INSTALL-MSVC.txt if self.settings.compiler.version == 15: # emulate VS2019+ meaning of WindowsTargetPlatformVersion == "10.0" # undocumented method, but officially recommended workaround by microsoft at at # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"), "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>", "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>") tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"), "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>", "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>") msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013" with tools.chdir(os.path.join(self._source_subfolder, "windows", msvc_version)): target = "liblzma_dll" if self.options.shared else "liblzma" msbuild = MSBuild(self) msbuild.build( "xz_win.sln", targets=[target], build_type=self._effective_msbuild_type(), platforms={"x86": "Win32", "x86_64": "x64"}, use_env=False, upgrade_project=False)
def build(self): for filename in glob.glob("patches/*.patch"): self.output.info('applying patch "%s"' % filename) tools.patch(base_path=self._source_subfolder, patch_file=filename) if self._is_msvc: run_configure_icu_file = os.path.join(self._source_subfolder, 'source', 'runConfigureICU') flags = "-%s" % self.settings.compiler.runtime if self.settings.get_safe("build_type") in [ 'Debug', 'RelWithDebInfo' ] and Version(self.settings.compiler.version) >= "12": flags += " -FS" tools.replace_in_file(run_configure_icu_file, "-MDd", flags) tools.replace_in_file(run_configure_icu_file, "-MD", flags) self._workaround_icu_20545() self._env_build = AutoToolsBuildEnvironment(self) if not self.options.get_safe("shared"): self._env_build.defines.append("U_STATIC_IMPLEMENTATION") if tools.is_apple_os(self.settings.os): self._env_build.defines.append("_DARWIN_C_SOURCE") if self.settings.get_safe("os.version"): self._env_build.flags.append( tools.apple_deployment_target_flag( self.settings.os, self.settings.os.version)) if "msys2" in self.deps_user_info: self._env_build.vars["PYTHON"] = tools.unix_path( os.path.join(self.deps_env_info["msys2"].MSYS_BIN, "python"), tools.MSYS2) build_dir = os.path.join(self.build_folder, self._source_subfolder, 'build') os.mkdir(build_dir) with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.environment_append(self._env_build.vars): with tools.chdir(build_dir): # workaround for https://unicode-org.atlassian.net/browse/ICU-20531 os.makedirs(os.path.join("data", "out", "tmp")) self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows) if self.options.get_safe("silent"): silent = '--silent' if self.options.silent else 'VERBOSE=1' else: silent = '--silent' command = "make {silent} -j {cpu_count}".format( silent=silent, cpu_count=tools.cpu_count()) self.run(command, win_bash=tools.os_info.is_windows) if self.options.get_safe("with_unit_tests"): command = "make {silent} check".format(silent=silent) self.run(command, win_bash=tools.os_info.is_windows) command = "make {silent} install".format(silent=silent) self.run(command, win_bash=tools.os_info.is_windows) self._install_name_tool()