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

liburing: Update recipe for version 2.3 #19739

Closed
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions recipes/liburing/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.3":
url: "https://github.com/axboe/liburing/archive/liburing-2.3.tar.gz"
sha256: "60b367dbdc6f2b0418a6e0cd203ee0049d9d629a36706fcf91dfb9428bae23c8"
"2.2":
url: "https://github.com/axboe/liburing/archive/liburing-2.2.tar.gz"
sha256: "e092624af6aa244ade2d52181cc07751ac5caba2f3d63e9240790db9ed130bbc"
Expand Down
89 changes: 44 additions & 45 deletions recipes/liburing/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from conans import AutoToolsBuildEnvironment
from conan import ConanFile
from conan.tools.files import get, patch, chdir, rmdir, copy
from conan.tools.files import get, rmdir, copy, apply_conandata_patches, chdir
from conan.tools.scm import Version
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.layout import basic_layout
from conan.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.33.0"
required_conan_version = ">=1.54.0"


class LiburingConan(ConanFile):
class Liburing(ConanFile):
name = "liburing"
license = "GPL-2.0-or-later"
homepage = "https://github.com/axboe/liburing"
Expand All @@ -33,9 +34,9 @@ class LiburingConan(ConanFile):

_autotools = None

@property
def _source_subfolder(self):
return "source_subfolder"
def requirements(self):
if Version(self.version) < "2.3":
self.requires("linux-headers-generic/5.13.9")

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -45,13 +46,9 @@ def config_options(self):

def configure(self):
if self.options.shared:
del self.options.fPIC

del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def requirements(self):
self.requires("linux-headers-generic/5.13.9")
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def validate(self):
# FIXME: use kernel version of build/host machine.
Expand All @@ -60,42 +57,44 @@ def validate(self):
raise ConanInvalidConfiguration(
"liburing is supported only on linux")

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

def _configure_autotools(self):
if self._autotools:
return self._autotools
def layout(self):
basic_layout(self, src_folder='src')

self._autotools = AutoToolsBuildEnvironment(self)
args = []
if self.options.get_safe("with_libc") == False:
args.append("--nolibc")
self._autotools.configure(args=args)
self._autotools.flags.append("-std=gnu99")
return self._autotools

def _patch_sources(self):
for data in self.conan_data.get("patches", {}).get(self.version, []):
patch(self, **data)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = AutotoolsToolchain(self)
def whether(condition):
return "" if condition else None
tc.update_configure_args({
"--nolibc": whether(not self.options.get_safe("with_libc")),
"--enable-shared": None,
"--disable-shared": None,
"--enable-static": None,
"--disable-static": None,
"--bindir": None,
"--sbindir": None,
"--oldincludedir": None,
})
tc.generate()

def build(self):
self._patch_sources()
with chdir(self, self._source_subfolder):
autotools = self._configure_autotools()
autotools.make()
apply_conandata_patches(self)
with chdir(self, self.source_folder):
at = Autotools(self)
at.configure()
at.make()

def package(self):
copy(self, "COPYING*", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "LICENSE", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses"))

with chdir(self, self._source_subfolder):
autotools = self._configure_autotools()
install_args = [
"ENABLE_SHARED={}".format(1 if self.options.shared else 0)
]
autotools.install(args=install_args)
copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))

with chdir(self, self.source_folder):
at = Autotools(self)
at.install(
args=[f"ENABLE_SHARED={1 if self.options.shared else 0}"]
)

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "man"))
Expand Down
2 changes: 2 additions & 0 deletions recipes/liburing/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"2.3":
folder: all
"2.2":
folder: all
"2.1":
Expand Down