Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsafec: fix MinGW + resolve build requires conflicts #5599

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions recipes/libsafec/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import glob
import os

from conans import AutoToolsBuildEnvironment, ConanFile, tools
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.29.1"
required_conan_version = ">=1.33.0"


class LibSafeCConan(ConanFile):
Expand All @@ -20,11 +18,12 @@ class LibSafeCConan(ConanFile):
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

build_requires = "autoconf/2.69", "libtool/2.4.6"
exports_sources = "patches/*"
_autotools = None

__autotools = None
_source_subfolder = "source_subfolder"
@property
def _source_subfolder(self):
return "source_subfolder"

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -50,40 +49,42 @@ def configure(self):
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = glob.glob("safeclib-*")[0]
os.rename(extracted_dir, self._source_subfolder)
def build_requirements(self):
self.build_requires("libtool/2.4.6")
if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH"):
self.build_requires("msys2/cci.latest")

@property
def _autotools(self):
if self.__autotools is None:
self.__autotools = AutoToolsBuildEnvironment(self)
return self.__autotools
def source(self):
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def _autotools_configure(self):
def _configure_autotools(self):
if self._autotools:
return self._autotools
self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
if self.options.shared:
args = ["--enable-shared", "--disable-static"]
else:
args = ["--disable-shared", "--enable-static"]
args.extend(["--disable-doc", "--disable-Werror"])
if self.settings.build_type in ("Debug", "RelWithDebInfo"):
args.append("--enable-debug")
self._autotools.configure(args=args)
self._autotools.configure(configure_dir=self._source_subfolder, args=args)
return self._autotools

def build(self):
with tools.chdir(self._source_subfolder):
self.run("autoreconf -fiv", run_environment=True)
self._autotools_configure()
self._autotools.make()
self.run("{} -fiv".format(tools.get_env("AUTORECONF")),
win_bash=tools.os_info.is_windows, run_environment=True)
autotools = self._configure_autotools()
autotools.make()

def package(self):
with tools.chdir(self._source_subfolder):
self._autotools.install()
self.copy("COPYING", src=self._source_subfolder, dst="licenses")
with tools.chdir(os.path.join(self.package_folder, "lib")):
tools.rmdir("pkgconfig")
tools.remove_files_by_mask(".", "*.la")
autotools = self._configure_autotools()
autotools.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la")

def package_info(self):
self.cpp_info.includedirs.append(os.path.join("include", "libsafec"))
Expand Down