diff --git a/recipes/xtr/all/conandata.yml b/recipes/xtr/all/conandata.yml index 899338bd4d..73147ae073 100644 --- a/recipes/xtr/all/conandata.yml +++ b/recipes/xtr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.1": + url: "https://github.com/choll/xtr/archive/refs/tags/2.0.1.tar.gz" + sha256: "92327264541900a2c9d43aaa3070d143d5e91879737fcea8cbf56065330af059" "2.0.0": url: "https://github.com/choll/xtr/archive/refs/tags/2.0.0.tar.gz" sha256: "1d0113d3551e0d5f5b97228ba245d711c6b66a62a69d62bdf1b206fdf45edd41" diff --git a/recipes/xtr/all/conanfile.py b/recipes/xtr/all/conanfile.py index 30ef7b102f..494c8ad3c6 100644 --- a/recipes/xtr/all/conanfile.py +++ b/recipes/xtr/all/conanfile.py @@ -17,19 +17,33 @@ class XtrConan(ConanFile): "fPIC": [True, False], "enable_exceptions": [True, False], "enable_lto": [True, False], + "enable_io_uring": ["auto", True, False], + "enable_io_uring_sqpoll": [True, False], + "sink_capacity_kb": "ANY" } default_options = { "fPIC": True, "enable_exceptions": True, "enable_lto": False, + "enable_io_uring": "auto", + "enable_io_uring_sqpoll": False, + "sink_capacity_kb": None } + generators = "make" + def config_options(self): + if tools.Version(self.version) < "1.0.1": + del self.options.sink_capacity_kb + if tools.Version(self.version) < "2.0.0": + del self.options.enable_io_uring + del self.options.enable_io_uring_sqpoll + def requirements(self): self.requires("fmt/7.1.3") # Require liburing on any Linux system as a run-time check will be # done to detect if the host kernel supports io_uring. - if self.settings.os == "Linux": + if tools.Version(self.version) >= "2.0.0" and self.settings.os == "Linux" and self.options.get_safe("enable_io_uring"): self.requires("liburing/2.1") def validate(self): @@ -39,6 +53,12 @@ class XtrConan(ConanFile): raise ConanInvalidConfiguration(f"Unsupported compiler={self.settings.compiler}") if self.settings.arch not in ("x86_64", ): raise ConanInvalidConfiguration(f"Unsupported arch={self.settings.arch}") + if tools.Version(self.version) < "2.0.0" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration(f"Use at least version 2.0.0 for libc++ compatibility") + if self.options.get_safe("enable_io_uring_sqpoll") and not self.options.get_safe("enable_io_uring"): + raise ConanInvalidConfiguration(f"io_uring must be enabled if io_uring_sqpoll is enabled") + if self.options.get_safe("sink_capacity_kb") and not str(self.options.get_safe("sink_capacity_kb")).isdigit(): + raise ConanInvalidConfiguration(f"The option 'sink_capacity_kb' must be an integer") minimal_cpp_standard = 20 if self.settings.compiler.cppstd: @@ -55,6 +75,18 @@ class XtrConan(ConanFile): def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True) + def get_defines(self): + defines = [] + enable_io_uring = self.options.get_safe("enable_io_uring") + if enable_io_uring in (True, False): + defines += ["XTR_USE_IO_URING={}".format(int(bool(enable_io_uring)))] + if self.options.get_safe("enable_io_uring_sqpoll"): + defines += ["XTR_IO_URING_POLL=1"] + capacity = self.options.get_safe("sink_capacity_kb") + if capacity: + defines += ["XTR_SINK_CAPACITY={}".format(int(capacity) * 1024)] + return defines + def build(self): # FIXME: should be done in validate (but version is not yet available there) if tools.Version(self.deps_cpp_info["fmt"].version) < 6: @@ -72,6 +104,7 @@ class XtrConan(ConanFile): env_build_vars["EXCEPTIONS"] = \ str(int(bool(self.options.enable_exceptions))) env_build_vars["LTO"] = str(int(bool(self.options.enable_lto))) + env_build_vars["CXXFLAGS"] += "".join([" -D{}".format(d) for d in self.get_defines()]) autotools.make(vars=env_build_vars) autotools.make(vars=env_build_vars, target="xtrctl") @@ -86,6 +119,7 @@ class XtrConan(ConanFile): def package_info(self): self.cpp_info.libs = ["xtr"] self.cpp_info.system_libs = ["pthread"] + self.cpp_info.defines = self.get_defines() bin_path = os.path.join(self.package_folder, "bin") self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/xtr/config.yml b/recipes/xtr/config.yml index 4365124d6a..066b0d5ac7 100644 --- a/recipes/xtr/config.yml +++ b/recipes/xtr/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.1": + folder: all "2.0.0": folder: all "1.0.1":