From 682ad991756dfcc99bc6fd0957ec89c8ef381525 Mon Sep 17 00:00:00 2001 From: Alexandre Acebedo Date: Thu, 30 Dec 2021 15:01:59 +0100 Subject: [PATCH] add tllist library --- recipes/tllist/all/conandata.yml | 4 ++ recipes/tllist/all/conanfile.py | 56 +++++++++++++++++++ recipes/tllist/all/test_package/conanfile.py | 16 ++++++ recipes/tllist/all/test_package/meson.build | 4 ++ .../tllist/all/test_package/test_package.c | 10 ++++ recipes/tllist/config.yml | 3 + 6 files changed, 93 insertions(+) create mode 100644 recipes/tllist/all/conandata.yml create mode 100644 recipes/tllist/all/conanfile.py create mode 100644 recipes/tllist/all/test_package/conanfile.py create mode 100644 recipes/tllist/all/test_package/meson.build create mode 100644 recipes/tllist/all/test_package/test_package.c create mode 100644 recipes/tllist/config.yml diff --git a/recipes/tllist/all/conandata.yml b/recipes/tllist/all/conandata.yml new file mode 100644 index 00000000000000..57b91d7bbc8b2f --- /dev/null +++ b/recipes/tllist/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.5": + url: "https://codeberg.org/dnkl/tllist/archive/1.0.5.tar.gz" + sha256: b0f32c9b2c2015c8d8dd068fd4e8b586aa91ca1670badc274ec962559ee0aadd diff --git a/recipes/tllist/all/conanfile.py b/recipes/tllist/all/conanfile.py new file mode 100644 index 00000000000000..91922543869ddf --- /dev/null +++ b/recipes/tllist/all/conanfile.py @@ -0,0 +1,56 @@ +import os + +from conans import ConanFile, Meson, tools +from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.33.0" + + +class TllistConan(ConanFile): + name = "tllist" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://codeberg.org/dnkl/tllist" + description = "A C header file only implementation of a typed linked list." + topics = ("list", "utils") + generators = ("pkg_config") + settings = "os", "arch", "build_type" + no_copy_source = True + _meson = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("Only Linux supported") + + def build_requirements(self): + self.build_requires("pkgconf/[>=1.7.4]", "meson/[>=0.60.3]") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_meson(self): + if self._meson: + return self._meson + self._meson = Meson(self) + self._meson.configure(source_folder=self._source_subfolder) + return self._meson + + def build(self): + meson = self._configure_meson() + meson.build() + meson.test() + + def package(self): + self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + meson = self._configure_meson() + meson.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "share")) + + def package_id(self): + self.info.header_only() diff --git a/recipes/tllist/all/test_package/conanfile.py b/recipes/tllist/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f04fd9a815295a --- /dev/null +++ b/recipes/tllist/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, Meson, tools +import os + + +class TestPackageConan(ConanFile): + generators = "pkg_config" + settings = "os", "compiler", "build_type", "arch" + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def test(self): + bin_path = os.path.join(".", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tllist/all/test_package/meson.build b/recipes/tllist/all/test_package/meson.build new file mode 100644 index 00000000000000..ea33c52d8d4246 --- /dev/null +++ b/recipes/tllist/all/test_package/meson.build @@ -0,0 +1,4 @@ +project('test_package', 'c') +tllist = dependency('tllist') + +executable('test_package', 'test_package.c', dependencies : tllist) diff --git a/recipes/tllist/all/test_package/test_package.c b/recipes/tllist/all/test_package/test_package.c new file mode 100644 index 00000000000000..77b3400127915b --- /dev/null +++ b/recipes/tllist/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include +#include + +int main(int argc, const char *const *argv) { + tll(int) l = tll_init(); + + tll_push_back(l, 43); + + return EXIT_SUCCESS; +} diff --git a/recipes/tllist/config.yml b/recipes/tllist/config.yml new file mode 100644 index 00000000000000..9d896aecb9356a --- /dev/null +++ b/recipes/tllist/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.5": + folder: "all"