diff --git a/recipes/autoconf/all/test_package/Makefile.in b/recipes/autoconf/all/test_package/Makefile.in deleted file mode 100644 index 193ade8719dfc..0000000000000 --- a/recipes/autoconf/all/test_package/Makefile.in +++ /dev/null @@ -1,14 +0,0 @@ -# @configure_input@ - -SRCS = test_package_c.c test_package_cpp.cpp - -OBJS := $(patsubst %.c,%.@OBJEXT@,$(patsubst %.cpp,%.@OBJEXT@,$(SRCS))) - -test_package@EXEEXT@: $(OBJS) - @CXX@ @CXXFLAGS@ @LDFLAGS@ $^ -o $@ - -%.@OBJEXT@: %.cpp - @CXX@ @CXXFLAGS@ @CPPFLAGS@ -c $< @CC_MINUS_O@ $@ - -%.@OBJEXT@: %.c - @CC@ @CFLAGS@ @CPPFLAGS@ -c $< @CC_MINUS_O@ $@ diff --git a/recipes/autoconf/all/test_package/conanfile.py b/recipes/autoconf/all/test_package/conanfile.py index bde84bf328288..bcf9703cc2585 100644 --- a/recipes/autoconf/all/test_package/conanfile.py +++ b/recipes/autoconf/all/test_package/conanfile.py @@ -1,47 +1,29 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conan.tools.microsoft import is_msvc -import contextlib -import os -import shutil +from os import environ -required_conan_version = ">=1.45.0" +from conan import ConanFile +from conan.tools.build import can_run + +required_conan_version = ">=1.50.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "config.h.in", "Makefile.in", "test_package_c.c", "test_package_cpp.cpp", + generators = "VirtualBuildEnv" test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextlib.contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not environ.get("CONAN_BASH_PATH"): + self.tool_requires("msys2/cci.latest") def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) - self.run("{} --verbose".format(os.environ["AUTOCONF"]), - win_bash=tools.os_info.is_windows, run_environment=True) - self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), - win_bash=tools.os_info.is_windows, run_environment=True) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools.configure() - autotools.make() + pass def test(self): - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + if can_run(self): + self.run("autoconf --version", run_environment=True, env="conanbuild", win_bash=self.settings.os == "Windows") diff --git a/recipes/autoconf/all/test_package/config.h.in b/recipes/autoconf/all/test_package/config.h.in deleted file mode 100644 index 93f81d1535769..0000000000000 --- a/recipes/autoconf/all/test_package/config.h.in +++ /dev/null @@ -1,23 +0,0 @@ -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Version number of package */ -#undef VERSION diff --git a/recipes/autoconf/all/test_package/configure.ac b/recipes/autoconf/all/test_package/configure.ac deleted file mode 100644 index ae0a54a83b39b..0000000000000 --- a/recipes/autoconf/all/test_package/configure.ac +++ /dev/null @@ -1,25 +0,0 @@ -# Must init the autoconf setup -# The first parameter is project name -# second is version number -# third is bug report address -AC_INIT([test_package], [1.0]) - -# Safety checks in case user overwritten --srcdir -AC_CONFIG_SRCDIR([test_package_c.c]) - -# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) -# in this dir (build-aux) - -AC_CONFIG_FILES(Makefile) -AC_CONFIG_HEADER([config.h]) - -AC_PROG_CC -AC_PROG_CXX - -AC_PROG_CC_C_O - -AC_MSG_NOTICE("ac_cv_prog_cc_${ac_cc} is $ac_cv_prog_cc_${ac_cc}") -AS_IF([eval test \$ac_cv_prog_cc_${ac_cc}_c_o = "yes"], - [AC_SUBST([CC_MINUS_O], ["-o"])],[AC_SUBST([CC_MINUS_O], [""])]) - -AC_OUTPUT diff --git a/recipes/autoconf/all/test_package/test_package_c.c b/recipes/autoconf/all/test_package/test_package_c.c deleted file mode 100644 index cd3baf25057d7..0000000000000 --- a/recipes/autoconf/all/test_package/test_package_c.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "config.h" - -#include - -int hello_from_c(void) { - printf("Hello world (" PACKAGE_NAME ") from c!\n"); - return 0; -} diff --git a/recipes/autoconf/all/test_package/test_package_cpp.cpp b/recipes/autoconf/all/test_package/test_package_cpp.cpp deleted file mode 100644 index e31a5ee3cfefa..0000000000000 --- a/recipes/autoconf/all/test_package/test_package_cpp.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "config.h" - -#include - -extern "C" { - int hello_from_c(void); -} - -void hello_from_cxx() { - std::cout << "Hello world (" PACKAGE_NAME ") from c++!\n"; -} - -int main(int argc, char** argv) { - hello_from_cxx(); - hello_from_c(); - return 0; -}