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

libunwind: robust build if all shared + cleanup + use self.info in validate() #14141

Merged
merged 3 commits into from
Nov 11, 2022
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
23 changes: 8 additions & 15 deletions recipes/libunwind/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.env import VirtualRunEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir
from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps
from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps
from conan.tools.layout import basic_layout

import os
Expand Down Expand Up @@ -36,14 +38,6 @@ class LiunwindConan(ConanFile):
"zlibdebuginfo": True,
}

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

@property
def _user_info_build(self):
return getattr(self, "user_info_build", self.deps_user_info)

def export_sources(self):
export_conandata_patches(self)

Expand All @@ -63,18 +57,20 @@ def requirements(self):
self.requires("zlib/1.2.13")

def validate(self):
if self.settings.os not in ["Linux", "FreeBSD"]:
if self.info.settings.os not in ["Linux", "FreeBSD"]:
raise ConanInvalidConfiguration("libunwind is only supported on Linux and FreeBSD")

def source(self):
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True)

def generate(self):
if not cross_building(self):
env = VirtualRunEnv(self)
env.generate(scope="build")

tc = AutotoolsToolchain(self)
yes_no = lambda v: "yes" if v else "no"
tc.configure_args.extend([
f"--enable-shared={yes_no(self.options.shared)}",
f"--enable-static={yes_no(not self.options.shared)}",
f"--enable-coredump={yes_no(self.options.coredump)}",
f"--enable-ptrace={yes_no(self.options.ptrace)}",
f"--enable-setjmp={yes_no(self.options.setjmp)}",
Expand All @@ -85,9 +81,6 @@ def generate(self):
])
tc.generate()

tc = PkgConfigDeps(self)
tc.generate()

tc = AutotoolsDeps(self)
tc.generate()

Expand Down