From 0694f9880c1978d1eec630bc41534f3fdfbd30d3 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 15 Apr 2024 08:41:47 +0300 Subject: [PATCH 1/4] coin-cgl: add 0.60.8, apply autoreconf, add glpk dep --- recipes/coin-cgl/all/conandata.yml | 10 +-- recipes/coin-cgl/all/conanfile.py | 76 ++++++++++--------- .../0.60.3-0001-no-pkg-config-check.patch | 13 ---- .../0.60.6-0001-no-pkg-config-check.patch | 13 ---- recipes/coin-cgl/config.yml | 2 + 5 files changed, 46 insertions(+), 68 deletions(-) delete mode 100644 recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch delete mode 100644 recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch diff --git a/recipes/coin-cgl/all/conandata.yml b/recipes/coin-cgl/all/conandata.yml index 9cf464447df6f..d49a202466ca2 100644 --- a/recipes/coin-cgl/all/conandata.yml +++ b/recipes/coin-cgl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.60.8": + url: "https://github.com/coin-or/Cgl/archive/releases/0.60.8.tar.gz" + sha256: "1482ba38afb783d124df8d5392337f79fdd507716e9f1fb6b98fc090acd1ad96" "0.60.7": url: "https://github.com/coin-or/Cgl/archive/releases/0.60.7.tar.gz" sha256: "93b30a80b5d2880c2e72d5877c64bdeaf4d7c1928b3194ea2f88b1aa4517fb1b" @@ -8,10 +11,3 @@ sources: "0.60.3": url: "https://github.com/coin-or/Cgl/archive/refs/tags/releases/0.60.3.tar.gz" sha256: "cfeeedd68feab7c0ce377eb9c7b61715120478f12c4dd0064b05ad640e20f3fb" -patches: - "0.60.7": - - patch_file: "patches/0.60.6-0001-no-pkg-config-check.patch" - "0.60.6": - - patch_file: "patches/0.60.6-0001-no-pkg-config-check.patch" - "0.60.3": - - patch_file: "patches/0.60.3-0001-no-pkg-config-check.patch" diff --git a/recipes/coin-cgl/all/conanfile.py b/recipes/coin-cgl/all/conanfile.py index df23309955a25..e202d165ddf8b 100644 --- a/recipes/coin-cgl/all/conanfile.py +++ b/recipes/coin-cgl/all/conanfile.py @@ -1,13 +1,12 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.build import cross_building from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.files import copy, get, rename, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag, unix_path import os +import shutil required_conan_version = ">=1.57.0" @@ -24,19 +23,18 @@ class CoinCglConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "with_glpk": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_glpk": True, } @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def export_sources(self): - export_conandata_patches(self) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -49,27 +47,23 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("coin-utils/2.11.9") - self.requires("coin-osi/0.108.7") - self.requires("coin-clp/1.17.7") + self.requires("coin-utils/2.11.11") + self.requires("coin-osi/0.108.10") + self.requires("coin-clp/1.17.9") + if self.options.with_glpk: + self.requires("glpk/4.48") + # BLAS and LAPACK are not used + # TODO: add support for: Cplex, Mosek, Xpress, Vol, DyLP def build_requirements(self): + 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.0.3") + 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): self.tool_requires("msys2/cci.latest") - if is_msvc(self): - self.tool_requires("automake/1.16.5") - - def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("coin-cgl does not support shared builds on Windows") - # FIXME: This issue likely comes from very old autotools versions used to produce configure. - if hasattr(self, "settings_build") and cross_building(self) and self.options.shared: - raise ConanInvalidConfiguration("coin-cgl shared not supported yet when cross-building") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -78,10 +72,26 @@ def generate(self): env = VirtualBuildEnv(self) env.generate() + 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")) + + if self.options.with_glpk: + _add_pkg_config_alias("glpk", "coinglpk") + tc = AutotoolsToolchain(self) tc.configure_args.extend([ - "--without-blas", - "--without-lapack", + "--with-osiglpk" if self.options.with_glpk else "--without-osiglpk", + "--without-vol", + "--without-dylp", + "--without-osicpx", + "--without-osimsk", + "--without-osixpr", + "--without-osivol", + "--without-sample", ]) if is_msvc(self): tc.extra_cxxflags.append("-EHsc") @@ -98,9 +108,6 @@ def generate(self): env.define("LD", f"{compile_wrapper} link -nologo") env.define("AR", f"{ar_wrapper} \"lib -nologo\"") env.define("NM", "dumpbin -symbols") - env.define("OBJDUMP", ":") - env.define("RANLIB", ":") - env.define("STRIP", ":") if self._settings_build.os == "Windows": # TODO: Something to fix in conan client or pkgconf recipe? # This is a weird workaround when build machine is Windows. Here we have to inject regular @@ -108,19 +115,18 @@ def generate(self): env.define("PKG_CONFIG_PATH", self.generators_folder) tc.generate(env) - deps = PkgConfigDeps(self) - deps.generate() - 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, "Cgl", "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() diff --git a/recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch b/recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch deleted file mode 100644 index 8e86185392524..0000000000000 --- a/recipes/coin-cgl/all/patches/0.60.3-0001-no-pkg-config-check.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- Cgl/Makefile.in -+++ Cgl/Makefile.in -@@ -886,8 +886,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 cgl > $(addlibsdir)/cgl_addlibs.txt -+@COIN_HAS_PKGCONFIG_TRUE@ #PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ -+@COIN_HAS_PKGCONFIG_TRUE@ #$(PKG_CONFIG) --libs cgl > $(addlibsdir)/cgl_addlibs.txt - @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@" > $(addlibsdir)/cgl_addlibs.txt - @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ > $(addlibsdir)/cgl_addlibs.txt - diff --git a/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch b/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch deleted file mode 100644 index 4e3b6ea5ea929..0000000000000 --- a/recipes/coin-cgl/all/patches/0.60.6-0001-no-pkg-config-check.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- Cgl/Makefile.in -+++ Cgl/Makefile.in -@@ -894,8 +894,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 cgl > $(addlibsdir)/cgl_addlibs.txt -+@COIN_HAS_PKGCONFIG_TRUE@ #PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ -+@COIN_HAS_PKGCONFIG_TRUE@ #$(PKG_CONFIG) --libs cgl > $(addlibsdir)/cgl_addlibs.txt - @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libCgl.lib @CGLLIB_LIBS_INSTALLED@" > $(addlibsdir)/cgl_addlibs.txt - @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lCgl @CGLLIB_LIBS_INSTALLED@ > $(addlibsdir)/cgl_addlibs.txt - diff --git a/recipes/coin-cgl/config.yml b/recipes/coin-cgl/config.yml index 19787257e6449..240f9891bc54e 100644 --- a/recipes/coin-cgl/config.yml +++ b/recipes/coin-cgl/config.yml @@ -1,4 +1,6 @@ versions: + "0.60.8": + folder: "all" "0.60.7": folder: "all" "0.60.6": From b0530189cc724da9ce33def22a28082257ce5d37 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 29 Jul 2024 12:59:42 +0300 Subject: [PATCH 2/4] Use pkgconf/[>=2.2 <3] --- recipes/coin-cgl/all/conanfile.py | 2 +- recipes/coin-cgl/all/test_package/conanfile.py | 2 +- recipes/coin-cgl/all/test_v1_package/conanfile.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/coin-cgl/all/conanfile.py b/recipes/coin-cgl/all/conanfile.py index e202d165ddf8b..858e48bc396d7 100644 --- a/recipes/coin-cgl/all/conanfile.py +++ b/recipes/coin-cgl/all/conanfile.py @@ -59,7 +59,7 @@ def build_requirements(self): 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") + self.tool_requires("pkgconf/[>=2.2 <3]") if self._settings_build.os == "Windows": self.win_bash = True if not self.conf.get("tools.microsoft.bash:path", check_type=str): diff --git a/recipes/coin-cgl/all/test_package/conanfile.py b/recipes/coin-cgl/all/test_package/conanfile.py index 7ab87ca07735c..2d330f0452348 100644 --- a/recipes/coin-cgl/all/test_package/conanfile.py +++ b/recipes/coin-cgl/all/test_package/conanfile.py @@ -17,7 +17,7 @@ def requirements(self): def build_requirements(self): if not self.conf.get("tools.gnu:pkg_config", check_type=str): - self.tool_requires("pkgconf/2.0.3") + self.tool_requires("pkgconf/[>=2.2 <3]") def build(self): cmake = CMake(self) diff --git a/recipes/coin-cgl/all/test_v1_package/conanfile.py b/recipes/coin-cgl/all/test_v1_package/conanfile.py index b3607270e232e..f72755da5940c 100644 --- a/recipes/coin-cgl/all/test_v1_package/conanfile.py +++ b/recipes/coin-cgl/all/test_v1_package/conanfile.py @@ -7,7 +7,7 @@ class TestPackageConan(ConanFile): generators = "cmake", "pkg_config" def build_requirements(self): - self.build_requires("pkgconf/2.0.3") + self.build_requires("pkgconf/[>=2.2 <3]") def build(self): cmake = CMake(self) From 5ca078cbbf042c506e571e31b845b6ade7c3729b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 14 Oct 2024 19:00:41 +0300 Subject: [PATCH 3/4] coin-cgl: --disable-dependency-linking --- recipes/coin-cgl/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/coin-cgl/all/conanfile.py b/recipes/coin-cgl/all/conanfile.py index 858e48bc396d7..612e57bc02471 100644 --- a/recipes/coin-cgl/all/conanfile.py +++ b/recipes/coin-cgl/all/conanfile.py @@ -92,6 +92,8 @@ def _add_pkg_config_alias(src_name, dst_name): "--without-osixpr", "--without-osivol", "--without-sample", + "--disable-dependency-linking", + "F77=unavailable", ]) if is_msvc(self): tc.extra_cxxflags.append("-EHsc") From 58085dcc1519871e3c5dea57cb794610c6a2ec1a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 13 Nov 2024 14:10:04 +0200 Subject: [PATCH 4/4] coin-cgl: drop test_v1_package --- .../all/test_v1_package/CMakeLists.txt | 8 -------- .../coin-cgl/all/test_v1_package/conanfile.py | 20 ------------------- 2 files changed, 28 deletions(-) delete mode 100644 recipes/coin-cgl/all/test_v1_package/CMakeLists.txt delete mode 100644 recipes/coin-cgl/all/test_v1_package/conanfile.py diff --git a/recipes/coin-cgl/all/test_v1_package/CMakeLists.txt b/recipes/coin-cgl/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0d20897301b68..0000000000000 --- a/recipes/coin-cgl/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/coin-cgl/all/test_v1_package/conanfile.py b/recipes/coin-cgl/all/test_v1_package/conanfile.py deleted file mode 100644 index f72755da5940c..0000000000000 --- a/recipes/coin-cgl/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,20 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "pkg_config" - - def build_requirements(self): - self.build_requires("pkgconf/[>=2.2 <3]") - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True)