diff --git a/recipes/coin-buildtools/all/conandata.yml b/recipes/coin-buildtools/all/conandata.yml new file mode 100644 index 00000000000000..35224d6d7c685d --- /dev/null +++ b/recipes/coin-buildtools/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.8.11": + url: "https://github.com/coin-or-tools/BuildTools/archive/refs/tags/releases/0.8.11.tar.gz" + sha256: "ec4cec2455537b4911b1ce223f1f946f5afa2ea6264fc96ae4da6bea63af34dc" +patches: + "0.8.11": + - patch_file: "patches/0.8.11-m4-tweaks.patch" + patch_type: "portability" + patch_description: "Fixes to Autotools M4 scripts for compatibility with Conan" + patch_source: "https://github.com/microsoft/vcpkg/pull/29398" diff --git a/recipes/coin-buildtools/all/conanfile.py b/recipes/coin-buildtools/all/conanfile.py new file mode 100644 index 00000000000000..83b3d2f186aea9 --- /dev/null +++ b/recipes/coin-buildtools/all/conanfile.py @@ -0,0 +1,71 @@ +import os + +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, mkdir +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + +required_conan_version = ">=1.52.0" + + +class CoinBuildtoolsConan(ConanFile): + name = "coin-buildtools" + description = "Macros and patches for GNU autotools for COIN-OR projects." + topics = ("coin", "autotools") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/coin-or-tools/BuildTools" + license = "EPL-2.0" + + package_type = "application" + settings = "os", "arch", "build_type", "compiler" + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def requirements(self): + # https://github.com/coin-or-tools/BuildTools/blob/20208f47f7bbc0056a92adefdfd43fded969f674/install_autotools.sh#L9-L12 + self.requires("autoconf/2.71", run=True) + self.requires("autoconf-archive/2023.02.20", run=True) + self.requires("automake/1.16.5", run=True) + self.requires("libtool/2.4.7", run=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) + + @staticmethod + def _chmod_plus_x(name): + if os.name == "posix": + os.chmod(name, os.stat(name).st_mode | 0o111) + + def package(self): + resdir = os.path.join(self.package_folder, "res") + copy(self, "*", self.source_folder, resdir) + if self.version.startswith("cci."): + mkdir(self, os.path.join(self.package_folder, "licenses")) + rename(self, os.path.join(resdir, "LICENSE"), + os.path.join(self.package_folder, "licenses", "LICENSE")) + copy(self, "*.m4", self.source_folder, os.path.join(self.package_folder, "bin")) + rename(self, os.path.join(resdir, "run_autotools"), + os.path.join(self.package_folder, "bin", "run_autotools")) + self._chmod_plus_x(os.path.join(self.package_folder, "bin", "run_autotools")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] + + aclocal_dir = unix_path(self, os.path.join(self.package_folder, "res")) + self.buildenv_info.define_path("ACLOCAL", f'aclocal -I "{aclocal_dir}"') + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.ACLOCAL_PATH.append(aclocal_dir) diff --git a/recipes/coin-buildtools/all/patches/0.8.11-m4-tweaks.patch b/recipes/coin-buildtools/all/patches/0.8.11-m4-tweaks.patch new file mode 100644 index 00000000000000..04fb243b376534 --- /dev/null +++ b/recipes/coin-buildtools/all/patches/0.8.11-m4-tweaks.patch @@ -0,0 +1,45 @@ +Adapted from https://github.com/microsoft/vcpkg/blob/ad3bae57455a3c3ce528fcd47d8e8027d0498add/ports/coin-or-buildtools/buildtools.patch +--- a/coin.m4 ++++ b/coin.m4 +@@ -2137,14 +2137,12 @@ + AC_COIN_CHECK_HEADER([zlib.h],[coin_has_zlib=yes]) + + if test $coin_has_zlib = yes; then +- AC_CHECK_LIB([z],[gzopen],[:],[coin_has_zlib=no]) ++ AC_SEARCH_LIBS([gzopen],[z zlib zlibd],[],[coin_has_zlib=no]) + fi + + if test $coin_has_zlib = yes; then + coin_foreach_w([myvar], [$1], [ +- m4_toupper(myvar)_LIBS="-lz $m4_toupper(myvar)_LIBS" +- m4_toupper(myvar)_PCLIBS="-lz $m4_toupper(myvar)_PCLIBS" +- m4_toupper(myvar)_LIBS_INSTALLED="-lz $m4_toupper(myvar)_LIBS_INSTALLED" ++ m4_toupper(myvar)_LFLAGS="$ac_cv_search_gzopen $m4_toupper(myvar)_LFLAGS" + ]) + AC_DEFINE([COIN_HAS_ZLIB],[1],[Define to 1 if zlib is available]) + fi +@@ -2181,14 +2179,12 @@ + AC_COIN_CHECK_HEADER([bzlib.h],[coin_has_bzlib=yes]) + + if test $coin_has_bzlib = yes; then +- AC_CHECK_LIB([bz2],[BZ2_bzReadOpen],[:],[coin_has_bzlib=no]) ++ AC_SEARCH_LIBS([BZ2_bzReadOpen],[bz2 bz2d],[],[coin_has_bzlib=no]) + fi + + if test $coin_has_bzlib = yes; then + coin_foreach_w([myvar], [$1], [ +- m4_toupper(myvar)_LIBS="-lbz2 $m4_toupper(myvar)_LIBS" +- m4_toupper(myvar)_PCLIBS="-lbz2 $m4_toupper(myvar)_PCLIBS" +- m4_toupper(myvar)_LIBS_INSTALLED="-lbz2 $m4_toupper(myvar)_LIBS_INSTALLED" ++ m4_toupper(myvar)_LFLAGS="$ac_cv_search_BZ2_bzReadOpen $m4_toupper(myvar)_LFLAGS" + ]) + AC_DEFINE([COIN_HAS_BZLIB],[1],[Define to 1 if bzlib is available]) + fi +@@ -3069,6 +3065,7 @@ + COIN_PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/share/pkgconfig:${COIN_PKG_CONFIG_PATH}" + ],[]) + ++COIN_PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + AC_SUBST(COIN_PKG_CONFIG_PATH) + + # assemble additional pkg-config search paths for uninstalled projects diff --git a/recipes/coin-buildtools/all/test_package/conanfile.py b/recipes/coin-buildtools/all/test_package/conanfile.py new file mode 100644 index 00000000000000..725f4c03ea69ad --- /dev/null +++ b/recipes/coin-buildtools/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout +from conan.tools.files import copy + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + win_bash = True + + def layout(self): + cmake_layout(self) + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def test(self): + if can_run(self): + copy(self, "configure.ac", self.source_folder, self.build_folder) + self.run("autoreconf -ifv", cwd=self.build_folder) diff --git a/recipes/coin-buildtools/all/test_package/configure.ac b/recipes/coin-buildtools/all/test_package/configure.ac new file mode 100644 index 00000000000000..0dd087660b9afc --- /dev/null +++ b/recipes/coin-buildtools/all/test_package/configure.ac @@ -0,0 +1,3 @@ +AC_INIT([test_package],[0.0.1],[]) + +AC_COIN_PROJECTDIR_INIT diff --git a/recipes/coin-buildtools/config.yml b/recipes/coin-buildtools/config.yml new file mode 100644 index 00000000000000..ee0a0ca35f7a31 --- /dev/null +++ b/recipes/coin-buildtools/config.yml @@ -0,0 +1,3 @@ +versions: + "0.8.11": + folder: "all"