diff --git a/recipes/coin-utils/all/conandata.yml b/recipes/coin-utils/all/conandata.yml index b7e4e62e0653d..c5932943dfcfc 100644 --- a/recipes/coin-utils/all/conandata.yml +++ b/recipes/coin-utils/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.11.11": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.11.tar.gz" + sha256: "27da344479f38c82112d738501643dcb229e4ee96a5f87d4f406456bdc1b2cb4" "2.11.10": url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.10.tar.gz" sha256: "80c7c215262df8d6bd2ba171617c5df844445871e9891ec6372df12ccbe5bcfd" @@ -13,22 +16,18 @@ sources: sha256: "d4effff4452e73356eed9f889efd9c44fe9cd68bd37b608a5ebb2c58bd45ef81" patches: "2.11.10": - - patch_file: "patches/0001-no-check-pkgconfig.patch" - patch_file: "patches/0003-cpp17-compat.patch" patch_description: "C++17 compatibility" patch_type: "portability" "2.11.9": - - patch_file: "patches/0001-no-check-pkgconfig.patch" - patch_file: "patches/0003-cpp17-compat.patch" patch_description: "C++17 compatibility" patch_type: "portability" "2.11.6": - - patch_file: "patches/0001-no-check-pkgconfig.patch" - patch_file: "patches/0002-cpp17-compat.patch" patch_description: "C++17 compatibility" patch_type: "portability" "2.11.4": - - patch_file: "patches/0001-no-check-pkgconfig.patch" - patch_file: "patches/0002-cpp17-compat.patch" patch_description: "C++17 compatibility" patch_type: "portability" diff --git a/recipes/coin-utils/all/conanfile.py b/recipes/coin-utils/all/conanfile.py index 78854eb346b37..7250d6fa58d50 100644 --- a/recipes/coin-utils/all/conanfile.py +++ b/recipes/coin-utils/all/conanfile.py @@ -1,10 +1,11 @@ +import shutil + from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name, is_apple_os from conan.tools.build import cross_building from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir -from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os @@ -28,10 +29,12 @@ class CoinUtilsConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "with_glpk": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_glpk": True, } @property @@ -55,22 +58,15 @@ def layout(self): def requirements(self): self.requires("bzip2/1.0.8") self.requires("zlib/[>=1.2.11 <2]") - # TODO: add blas and lapack support - - def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("coin-utils does not provide a shared library on Windows") - # FIXME: This issue likely comes from very old autotools versions used to produce configure. - # It might be fixed by calling autoreconf, but https://github.com/coin-or-tools/BuildTools - # should be packaged and added to build requirements. - if hasattr(self, "settings_build") and cross_building(self) and self.options.shared: - raise ConanInvalidConfiguration("coin-utils shared not supported yet when cross-building") + self.requires("openblas/0.3.26") + if self.options.with_glpk: + self.requires("glpk/4.48") # v4.49+ are not supported due to dropped lpx_* functions def build_requirements(self): - if is_msvc(self): - self.tool_requires("automake/1.16.5") - else: - self.tool_requires("gnu-config/cci.20210814") + self.tool_requires("coin-buildtools/0.8.11") + self.tool_requires("gnu-config/cci.20210814") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/2.1.0") if self._settings_build.os == "Windows": self.win_bash = True if not self.conf.get("tools.microsoft.bash:path", check_type=str): @@ -82,13 +78,40 @@ def source(self): def generate(self): env = VirtualBuildEnv(self) env.generate() + if not cross_building(self): env = VirtualRunEnv(self) env.generate(scope="build") + deps = PkgConfigDeps(self) + deps.generate() + + def _add_pkg_config_alias(src_name, dst_name): + shutil.copy(os.path.join(self.generators_folder, f"{src_name}.pc"), + os.path.join(self.generators_folder, f"{dst_name}.pc")) + + _add_pkg_config_alias("openblas", "coinblas") + _add_pkg_config_alias("openblas", "coinlapack") + if self.options.with_glpk: + _add_pkg_config_alias("glpk", "coinglpk") + tc = AutotoolsToolchain(self) - tc.configure_args.append("--without-blas") - tc.configure_args.append("--without-lapack") + tc.configure_args.extend([ + # the coin*.pc pkg-config files are only used when set to BUILD + "--with-blas=BUILD", + "--with-lapack=BUILD", + "--with-glpk=BUILD" if self.options.with_glpk else "--without-glpk", + # These are only used for sample datasets + "--without-netlib", + "--without-sample", + ]) + if self.settings.os in ["Linux", "FreeBSD"]: + # enables compilation of thread aware CoinUtils + # requires pthreads and rt + tc.configure_args.append("--enable-coinutils-threads") + # TODO: maybe add as options + # tc.configure_args.append("--enable-coinutils-mempool-override-new") + # tc.configure_args.append("--enable-coinutils-mempool-maxpooled=value") if is_msvc(self): tc.configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") tc.extra_cxxflags.append("-EHsc") @@ -142,14 +165,17 @@ def generate(self): def build(self): apply_conandata_patches(self) - if not is_msvc(self): - for gnu_config in [ - self.conf.get("user.gnu-config:config_guess", check_type=str), - self.conf.get("user.gnu-config:config_sub", check_type=str), - ]: - if gnu_config: - copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + copy(self, "*", os.path.join(self.dependencies.build["coin-buildtools"].package_folder, "res"), + os.path.join(self.source_folder, "BuildTools")) + copy(self, "*", os.path.join(self.dependencies.build["coin-buildtools"].package_folder, "res"), + os.path.join(self.source_folder, "CoinUtils", "BuildTools")) + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) autotools = Autotools(self) + autotools.autoreconf() autotools.configure() autotools.make() @@ -171,6 +197,6 @@ def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "coin")) if not self.options.shared: if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] + self.cpp_info.system_libs = ["m", "pthread", "rt"] if is_apple_os(self): self.cpp_info.frameworks.append("Accelerate") diff --git a/recipes/coin-utils/all/patches/0001-no-check-pkgconfig.patch b/recipes/coin-utils/all/patches/0001-no-check-pkgconfig.patch deleted file mode 100644 index bb060ee6642bb..0000000000000 --- a/recipes/coin-utils/all/patches/0001-no-check-pkgconfig.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- CoinUtils/Makefile.in -+++ CoinUtils/Makefile.in -@@ -842,8 +842,8 @@ - - install-data-hook: - @$(mkdir_p) "$(addlibsdir)" --@COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ --@COIN_HAS_PKGCONFIG_TRUE@ "$(PKG_CONFIG)" --libs coinutils > $(addlibsdir)/coinutils_addlibs.txt -+@COIN_HAS_PKGCONFIG_TRUE@ #PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ -+@COIN_HAS_PKGCONFIG_TRUE@ #"$(PKG_CONFIG)" --libs coinutils > $(addlibsdir)/coinutils_addlibs.txt - @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCoinUtils.lib @COINUTILSLIB_LIBS_INSTALLED@" > $(addlibsdir)/coinutils_addlibs.txt - @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCoinUtils @COINUTILSLIB_LIBS_INSTALLED@ > $(addlibsdir)/coinutils_addlibs.txt - diff --git a/recipes/coin-utils/config.yml b/recipes/coin-utils/config.yml index 3e9050a77e486..7a2a28465144c 100644 --- a/recipes/coin-utils/config.yml +++ b/recipes/coin-utils/config.yml @@ -1,4 +1,6 @@ versions: + "2.11.11": + folder: "all" "2.11.10": folder: "all" "2.11.9":