Skip to content

Commit

Permalink
gnulib: use build-aux/ar-lib, use tool_requires
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Jul 18, 2023
1 parent 607c7c0 commit 2a65205
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
9 changes: 1 addition & 8 deletions recipes/gnulib/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

from conan import ConanFile, conan_version
from conan.errors import ConanInvalidConfiguration
from conan import ConanFile
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout

Expand All @@ -27,12 +26,6 @@ def layout(self):
def package_id(self):
self.info.clear()

def validate(self):
if conan_version.major >= 2 and self.settings.os == "Windows":
# Currently fails with 'configure: error: could not determine .../automake-1.16/ar-lib "lib -nologo" interface'.
# https://github.com/conan-io/conan-center-index/pull/18602#issuecomment-1639763920
raise ConanInvalidConfiguration("Windows is currently not supported by the gnulib recipe. Contributions are welcome.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True, filename="gnulib.tar.gz")

Expand Down
14 changes: 6 additions & 8 deletions recipes/gnulib/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.env import Environment, VirtualBuildEnv
from conan.tools.files import copy, save, chdir
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
Expand All @@ -17,10 +17,8 @@ class TestPackageConan(ConanFile):
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def requirements(self):
self.requires(self.tested_reference_str)

def build_requirements(self):
self.tool_requires(self.tested_reference_str)
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
Expand All @@ -33,8 +31,6 @@ def layout(self):
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
env = VirtualRunEnv(self)
env.generate(scope="build")
tc = AutotoolsToolchain(self)
tc.generate()

Expand All @@ -46,7 +42,9 @@ def generate(self):
env.define("CC", f"{compile_wrapper} cl -nologo")
env.define("CXX", f"{compile_wrapper} cl -nologo")
env.define("LD", "link -nologo")
env.define("AR", f'{ar_wrapper} "lib -nologo"')
# FIXME: otherwise fails with 'configure: error: could not determine .../automake-1.16/ar-lib "lib -nologo" interface'.
# env.define("AR", f'{ar_wrapper} "lib -nologo"')
env.define("AR", unix_path(self, os.path.join(self.build_folder, "build-aux", "ar-lib")))
env.define("NM", "dumpbin -symbols")
env.define("OBJDUMP", ":")
env.define("RANLIB", ":")
Expand All @@ -61,7 +59,7 @@ def build(self):
# self.run("gnulib-tool --list")
self.run("gnulib-tool --import getopt-posix")
autotools = Autotools(self)
# Can simply do autotools.autoreconf(self.build_folder) in Conan v2 instead
# Can simply do autotools.autoreconf(self.build_folder) in Conan v2
with chdir(self, self.build_folder):
self.run("autoreconf -fiv")
autotools.configure(self.build_folder)
Expand Down

0 comments on commit 2a65205

Please sign in to comment.