From 8d44fa5dba5444a4776221331691108886e29962 Mon Sep 17 00:00:00 2001 From: atom Date: Fri, 3 Mar 2023 20:40:15 +0300 Subject: [PATCH 01/10] Init libdnet --- recipes/libdnet/all/conandata.yml | 4 + recipes/libdnet/all/conanfile.py | 112 ++++++++++++++++++ .../libdnet/all/test_package/CMakeLists.txt | 7 ++ recipes/libdnet/all/test_package/conanfile.py | 26 ++++ .../libdnet/all/test_package/test_package.c | 36 ++++++ .../all/test_v1_package/CMakeLists.txt | 8 ++ .../libdnet/all/test_v1_package/conanfile.py | 17 +++ recipes/libdnet/config.yml | 3 + 8 files changed, 213 insertions(+) create mode 100644 recipes/libdnet/all/conandata.yml create mode 100644 recipes/libdnet/all/conanfile.py create mode 100644 recipes/libdnet/all/test_package/CMakeLists.txt create mode 100644 recipes/libdnet/all/test_package/conanfile.py create mode 100644 recipes/libdnet/all/test_package/test_package.c create mode 100644 recipes/libdnet/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libdnet/all/test_v1_package/conanfile.py create mode 100644 recipes/libdnet/config.yml diff --git a/recipes/libdnet/all/conandata.yml b/recipes/libdnet/all/conandata.yml new file mode 100644 index 0000000000000..9777bcb4dc9f2 --- /dev/null +++ b/recipes/libdnet/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.16.3": + url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.16.3.tar.gz" + sha256: "83171a9f6e96d7a5047d6537fce4c376bdf6d867f8d49cf6ba434a0f3f7b45c1" diff --git a/recipes/libdnet/all/conanfile.py b/recipes/libdnet/all/conanfile.py new file mode 100644 index 0000000000000..929996cebbe18 --- /dev/null +++ b/recipes/libdnet/all/conanfile.py @@ -0,0 +1,112 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.microsoft import is_msvc +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.54.0" + + +class LibDNetConan(ConanFile): + name = "libdnet" + description = "Provides a simplified, portable interface to several low-level networking routines." + homepage = "https://github.com/ofalk/libdnet" + topics = ("libdnet", "libdumbnet") + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True + } + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + + def layout(self): + basic_layout(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("libdnet has not supported Visual Studio yet") + # windows build requires winpcap (looks like we can use npcap) + + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def requirements(self): + self.requires("libcheck/0.15.2") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + env = tc.environment() + # if is_msvc(self): + # env.define("CC", "cl -nologo") + # env.define("CXX", "cl -nologo") + # env.define("LD", "link -nologo") + # env.define("AR", "lib -nologo") + # if self._settings_build.os == "Windows": + # # TODO: Something to fix in conan client or pkgconf recipe? + # # This is a weird workaround when build machine is Windows. Here we have to inject regular + # # Windows path to pc files folder instead of unix path flavor injected by AutotoolsToolchain... + # env.define("PKG_CONFIG_PATH", self.generators_folder) + tc.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + + def build(self): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + copy(self,"COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + + copy(self, "config.h", src=os.path.join(self.build_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + + def package_id(self): + del self.info.options.default + + def package_info(self): + self.cpp_info.components["dnet"].libs = ["dnet"] + self.cpp_info.components["dnet"].names["pkg_config"] = "libdnet" diff --git a/recipes/libdnet/all/test_package/CMakeLists.txt b/recipes/libdnet/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4112cf94b7a0b --- /dev/null +++ b/recipes/libdnet/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(libdnet REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdnet::libdnet) diff --git a/recipes/libdnet/all/test_package/conanfile.py b/recipes/libdnet/all/test_package/conanfile.py new file mode 100644 index 0000000000000..dcfce1e159562 --- /dev/null +++ b/recipes/libdnet/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} {}".format(bin_path, "127.0.0.1"), env="conanrun") diff --git a/recipes/libdnet/all/test_package/test_package.c b/recipes/libdnet/all/test_package/test_package.c new file mode 100644 index 0000000000000..d96226017c3d8 --- /dev/null +++ b/recipes/libdnet/all/test_package/test_package.c @@ -0,0 +1,36 @@ +#include + +#include + +#include +#include +#include +#include + +#include + +void addr_usage(void) +{ + fprintf(stderr, "Usage: dnet addr
...\n"); + exit(1); +} + +int main(int argc, char *argv[]) +{ + struct addr addr; + int c, len; + + if (argc == 1 || *(argv[1]) == '-') + addr_usage(); + + for (c = 1; c < argc; c++) { + if (addr_aton(argv[c], &addr) < 0) + addr_usage(); + + len = addr.addr_bits / 8; + + if (write(STDOUT_FILENO, addr.addr_data8, len) != len) + err(1, "write"); + } + return 0; +} diff --git a/recipes/libdnet/all/test_v1_package/CMakeLists.txt b/recipes/libdnet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libdnet/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libdnet/all/test_v1_package/conanfile.py b/recipes/libdnet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c7e2dc9c61059 --- /dev/null +++ b/recipes/libdnet/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run("{} {}".format(bin_path, "127.0.0.1"), run_environment=True) diff --git a/recipes/libdnet/config.yml b/recipes/libdnet/config.yml new file mode 100644 index 0000000000000..3efcfa7623d5a --- /dev/null +++ b/recipes/libdnet/config.yml @@ -0,0 +1,3 @@ +versions: + "1.16.3": + folder: "all" From 9c5dd3310764fe0fa4329e05029d39bedbff12ab Mon Sep 17 00:00:00 2001 From: Jihadist Date: Mon, 8 May 2023 17:55:13 +0300 Subject: [PATCH 02/10] move to cmake --- recipes/libdnet/all/conandata.yml | 6 ++-- recipes/libdnet/all/conanfile.py | 56 ++++++++++++------------------- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/recipes/libdnet/all/conandata.yml b/recipes/libdnet/all/conandata.yml index 9777bcb4dc9f2..1e79773c87ff0 100644 --- a/recipes/libdnet/all/conandata.yml +++ b/recipes/libdnet/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.16.3": - url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.16.3.tar.gz" - sha256: "83171a9f6e96d7a5047d6537fce4c376bdf6d867f8d49cf6ba434a0f3f7b45c1" + "1.16.4": + url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.16.4.tar.gz" + sha256: "7df1f0a3db9cf03b48cf50ab273fd6a20c1be99eb9344b9663fe3fd9ed9dab65" diff --git a/recipes/libdnet/all/conanfile.py b/recipes/libdnet/all/conanfile.py index 929996cebbe18..19b13b26aaa98 100644 --- a/recipes/libdnet/all/conanfile.py +++ b/recipes/libdnet/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name from conan.tools.files import copy, get, rm, rmdir @@ -35,15 +36,14 @@ def _settings_build(self): def layout(self): - basic_layout(self) + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") del self.settings.compiler.libcxx del self.settings.compiler.cppstd @@ -56,43 +56,31 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - def requirements(self): - self.requires("libcheck/0.15.2") + # def requirements(self): + # self.requires("libcheck/0.15.2") - def build_requirements(self): - if not self.conf.get("tools.gnu:pkg_config", check_type=str): - self.tool_requires("pkgconf/1.9.3") - self.tool_requires("libtool/2.4.7") - if self._settings_build.os == "Windows": - self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", check_type=str): - self.tool_requires("msys2/cci.latest") + # def build_requirements(self): + # if not self.conf.get("tools.gnu:pkg_config", check_type=str): + # self.tool_requires("pkgconf/1.9.3") + # self.tool_requires("libtool/2.4.7") + # if self._settings_build.os == "Windows": + # self.win_bash = True + # if not self.conf.get("tools.microsoft.bash:path", check_type=str): + # self.tool_requires("msys2/cci.latest") def generate(self): - env = VirtualBuildEnv(self) - env.generate() - tc = AutotoolsToolchain(self) - env = tc.environment() - # if is_msvc(self): - # env.define("CC", "cl -nologo") - # env.define("CXX", "cl -nologo") - # env.define("LD", "link -nologo") - # env.define("AR", "lib -nologo") - # if self._settings_build.os == "Windows": - # # TODO: Something to fix in conan client or pkgconf recipe? - # # This is a weird workaround when build machine is Windows. Here we have to inject regular - # # Windows path to pc files folder instead of unix path flavor injected by AutotoolsToolchain... - # env.define("PKG_CONFIG_PATH", self.generators_folder) + tc = CMakeToolchain(self) + tc.generate() - pkg = PkgConfigDeps(self) - pkg.generate() - def build(self): - autotools = Autotools(self) - autotools.autoreconf() - autotools.configure() - autotools.make() + deps = CMakeDeps(self) + deps.generate() + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + def package(self): copy(self,"COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) From 046cd85f370a8a9e6b53662ac3614b3473649373 Mon Sep 17 00:00:00 2001 From: Jihadist Date: Tue, 9 May 2023 00:53:22 +0300 Subject: [PATCH 03/10] prepare for cmake --- recipes/libdnet/all/conandata.yml | 4 +- recipes/libdnet/all/conanfile.py | 62 +++++-------------- .../libdnet/all/test_package/CMakeLists.txt | 4 +- .../libdnet/all/test_package/test_package.c | 11 ++-- 4 files changed, 24 insertions(+), 57 deletions(-) diff --git a/recipes/libdnet/all/conandata.yml b/recipes/libdnet/all/conandata.yml index 1e79773c87ff0..89f4ec79b47d2 100644 --- a/recipes/libdnet/all/conandata.yml +++ b/recipes/libdnet/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.16.4": - url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.16.4.tar.gz" - sha256: "7df1f0a3db9cf03b48cf50ab273fd6a20c1be99eb9344b9663fe3fd9ed9dab65" + url: "https://github.com/Jihadist/libdnet/archive/19c7040bc92ddf04139a6b566d811d8cd9c3d736.tar.gz" + sha256: "f3dd8f65dfb6ac4249e4160cf46063e422ff7e83638188832b5313c73301fda3" diff --git a/recipes/libdnet/all/conanfile.py b/recipes/libdnet/all/conanfile.py index 19b13b26aaa98..3a64c156c046e 100644 --- a/recipes/libdnet/all/conanfile.py +++ b/recipes/libdnet/all/conanfile.py @@ -1,23 +1,17 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.errors import ConanInvalidConfiguration -from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.files import copy, get, rm, rmdir -from conan.tools.env import VirtualBuildEnv -from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps -from conan.tools.microsoft import is_msvc -from conan.tools.layout import basic_layout +from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.54.0" +required_conan_version = ">=1.56.0" -class LibDNetConan(ConanFile): - name = "libdnet" +class dnetConan(ConanFile): + name = "dnet" description = "Provides a simplified, portable interface to several low-level networking routines." homepage = "https://github.com/ofalk/libdnet" - topics = ("libdnet", "libdumbnet") + topics = ("dnet", "libdnet", "libdumbnet") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" options = { @@ -30,10 +24,6 @@ class LibDNetConan(ConanFile): } settings = "os", "arch", "compiler", "build_type" - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def layout(self): cmake_layout(self, src_folder="src") @@ -47,27 +37,9 @@ def configure(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd - def validate(self): - if is_msvc(self): - raise ConanInvalidConfiguration("libdnet has not supported Visual Studio yet") - # windows build requires winpcap (looks like we can use npcap) - - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - # def requirements(self): - # self.requires("libcheck/0.15.2") - - # def build_requirements(self): - # if not self.conf.get("tools.gnu:pkg_config", check_type=str): - # self.tool_requires("pkgconf/1.9.3") - # self.tool_requires("libtool/2.4.7") - # if self._settings_build.os == "Windows": - # self.win_bash = True - # if not self.conf.get("tools.microsoft.bash:path", check_type=str): - # self.tool_requires("msys2/cci.latest") - def generate(self): tc = CMakeToolchain(self) @@ -83,18 +55,16 @@ def build(self): def package(self): copy(self,"COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - autotools = Autotools(self) - autotools.install() - - copy(self, "config.h", src=os.path.join(self.build_folder, "include"), dst=os.path.join(self.package_folder, "include")) - - rm(self, "*.la", os.path.join(self.package_folder, "lib")) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - fix_apple_shared_install_name(self) - - def package_id(self): - del self.info.options.default + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.components["dnet"].libs = ["dnet"] - self.cpp_info.components["dnet"].names["pkg_config"] = "libdnet" + self.cpp_info.libs.append("dnet") + self.cpp_info.includedirs = ["include"] + + self.cpp_info.includedirs.extend(["include/dnet"]) + + if self.settings.os == 'Windows': + self.cpp_info.system_libs = ['Iphlpapi', 'wsock32'] diff --git a/recipes/libdnet/all/test_package/CMakeLists.txt b/recipes/libdnet/all/test_package/CMakeLists.txt index 4112cf94b7a0b..d2b66a2eb9cdf 100644 --- a/recipes/libdnet/all/test_package/CMakeLists.txt +++ b/recipes/libdnet/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -find_package(libdnet REQUIRED CONFIG) +find_package(dnet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libdnet::libdnet) +target_link_libraries(${PROJECT_NAME} PRIVATE dnet::dnet) diff --git a/recipes/libdnet/all/test_package/test_package.c b/recipes/libdnet/all/test_package/test_package.c index d96226017c3d8..f714ee213bea9 100644 --- a/recipes/libdnet/all/test_package/test_package.c +++ b/recipes/libdnet/all/test_package/test_package.c @@ -1,13 +1,10 @@ -#include +#include +#include +#include #include - -#include #include #include -#include - -#include void addr_usage(void) { @@ -29,7 +26,7 @@ int main(int argc, char *argv[]) len = addr.addr_bits / 8; - if (write(STDOUT_FILENO, addr.addr_data8, len) != len) + if (write(1, addr.addr_data8, len) != len) err(1, "write"); } return 0; From 518e7f13dd5ac60e566b266e29b1ccb53c37ea0e Mon Sep 17 00:00:00 2001 From: Jihadist Date: Tue, 9 May 2023 01:20:49 +0300 Subject: [PATCH 04/10] rename package --- recipes/{libdnet => dnet}/all/conandata.yml | 0 recipes/{libdnet => dnet}/all/conanfile.py | 0 recipes/{libdnet => dnet}/all/test_package/CMakeLists.txt | 0 recipes/{libdnet => dnet}/all/test_package/conanfile.py | 0 recipes/{libdnet => dnet}/all/test_package/test_package.c | 0 recipes/{libdnet => dnet}/all/test_v1_package/CMakeLists.txt | 0 recipes/{libdnet => dnet}/all/test_v1_package/conanfile.py | 0 recipes/{libdnet => dnet}/config.yml | 2 +- 8 files changed, 1 insertion(+), 1 deletion(-) rename recipes/{libdnet => dnet}/all/conandata.yml (100%) rename recipes/{libdnet => dnet}/all/conanfile.py (100%) rename recipes/{libdnet => dnet}/all/test_package/CMakeLists.txt (100%) rename recipes/{libdnet => dnet}/all/test_package/conanfile.py (100%) rename recipes/{libdnet => dnet}/all/test_package/test_package.c (100%) rename recipes/{libdnet => dnet}/all/test_v1_package/CMakeLists.txt (100%) rename recipes/{libdnet => dnet}/all/test_v1_package/conanfile.py (100%) rename recipes/{libdnet => dnet}/config.yml (70%) diff --git a/recipes/libdnet/all/conandata.yml b/recipes/dnet/all/conandata.yml similarity index 100% rename from recipes/libdnet/all/conandata.yml rename to recipes/dnet/all/conandata.yml diff --git a/recipes/libdnet/all/conanfile.py b/recipes/dnet/all/conanfile.py similarity index 100% rename from recipes/libdnet/all/conanfile.py rename to recipes/dnet/all/conanfile.py diff --git a/recipes/libdnet/all/test_package/CMakeLists.txt b/recipes/dnet/all/test_package/CMakeLists.txt similarity index 100% rename from recipes/libdnet/all/test_package/CMakeLists.txt rename to recipes/dnet/all/test_package/CMakeLists.txt diff --git a/recipes/libdnet/all/test_package/conanfile.py b/recipes/dnet/all/test_package/conanfile.py similarity index 100% rename from recipes/libdnet/all/test_package/conanfile.py rename to recipes/dnet/all/test_package/conanfile.py diff --git a/recipes/libdnet/all/test_package/test_package.c b/recipes/dnet/all/test_package/test_package.c similarity index 100% rename from recipes/libdnet/all/test_package/test_package.c rename to recipes/dnet/all/test_package/test_package.c diff --git a/recipes/libdnet/all/test_v1_package/CMakeLists.txt b/recipes/dnet/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/libdnet/all/test_v1_package/CMakeLists.txt rename to recipes/dnet/all/test_v1_package/CMakeLists.txt diff --git a/recipes/libdnet/all/test_v1_package/conanfile.py b/recipes/dnet/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libdnet/all/test_v1_package/conanfile.py rename to recipes/dnet/all/test_v1_package/conanfile.py diff --git a/recipes/libdnet/config.yml b/recipes/dnet/config.yml similarity index 70% rename from recipes/libdnet/config.yml rename to recipes/dnet/config.yml index 3efcfa7623d5a..898b13aebea73 100644 --- a/recipes/libdnet/config.yml +++ b/recipes/dnet/config.yml @@ -1,3 +1,3 @@ versions: - "1.16.3": + "1.16.4": folder: "all" From a51cabcbd15240e937eb4ce40e41619513b8f037 Mon Sep 17 00:00:00 2001 From: Jihadist Date: Tue, 9 May 2023 01:44:31 +0300 Subject: [PATCH 05/10] fix license --- recipes/dnet/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/dnet/all/conanfile.py b/recipes/dnet/all/conanfile.py index 3a64c156c046e..5ca982682d3ad 100644 --- a/recipes/dnet/all/conanfile.py +++ b/recipes/dnet/all/conanfile.py @@ -54,7 +54,7 @@ def build(self): cmake.build() def package(self): - 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")) cmake = CMake(self) cmake.configure() cmake.install() From 40858c455525dbcbb8a6fa39f2aedad4b97ea555 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 9 May 2023 10:14:58 +0000 Subject: [PATCH 06/10] fix write header --- recipes/dnet/all/test_package/test_package.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/dnet/all/test_package/test_package.c b/recipes/dnet/all/test_package/test_package.c index f714ee213bea9..6102a898664e5 100644 --- a/recipes/dnet/all/test_package/test_package.c +++ b/recipes/dnet/all/test_package/test_package.c @@ -6,6 +6,12 @@ #include #include +#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) +#include +#elif defined(_WIN32) +#include +#endif + void addr_usage(void) { fprintf(stderr, "Usage: dnet addr
...\n"); From bc00fbf851a3f650404aee93169a5a059f2cb685 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 9 May 2023 13:19:30 +0000 Subject: [PATCH 07/10] fix libcxx and cppstd --- recipes/dnet/all/conanfile.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes/dnet/all/conanfile.py b/recipes/dnet/all/conanfile.py index 5ca982682d3ad..4daaf1ca042cb 100644 --- a/recipes/dnet/all/conanfile.py +++ b/recipes/dnet/all/conanfile.py @@ -34,8 +34,14 @@ def config_options(self): def configure(self): self.options.rm_safe("fPIC") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 0af3495d72c4839ab0db8a3918557d480c87b3a1 Mon Sep 17 00:00:00 2001 From: Jihadist Date: Thu, 12 Oct 2023 21:40:53 +0300 Subject: [PATCH 08/10] bump to upstream --- recipes/dnet/all/conandata.yml | 6 +++--- recipes/dnet/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/dnet/all/conandata.yml b/recipes/dnet/all/conandata.yml index 89f4ec79b47d2..6e95e35e1a154 100644 --- a/recipes/dnet/all/conandata.yml +++ b/recipes/dnet/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.16.4": - url: "https://github.com/Jihadist/libdnet/archive/19c7040bc92ddf04139a6b566d811d8cd9c3d736.tar.gz" - sha256: "f3dd8f65dfb6ac4249e4160cf46063e422ff7e83638188832b5313c73301fda3" + "1.17.0": + url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.17.0.tar.gz" + sha256: "6be1ed0763151ede4c9665a403f1c9d974b2ffab2eacdb26b22078e461aae1dc" diff --git a/recipes/dnet/config.yml b/recipes/dnet/config.yml index 898b13aebea73..aad66aeff535b 100644 --- a/recipes/dnet/config.yml +++ b/recipes/dnet/config.yml @@ -1,3 +1,3 @@ versions: - "1.16.4": + "1.17.0": folder: "all" From 8003c5880f1edd1d161e86c08884ae6880a89eac Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 3 Jan 2024 18:51:13 +0300 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Martin Valgur --- recipes/dnet/all/conanfile.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/recipes/dnet/all/conanfile.py b/recipes/dnet/all/conanfile.py index 4daaf1ca042cb..6996407d640f0 100644 --- a/recipes/dnet/all/conanfile.py +++ b/recipes/dnet/all/conanfile.py @@ -14,6 +14,7 @@ class dnetConan(ConanFile): topics = ("dnet", "libdnet", "libdumbnet") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" options = { "shared": [True, False], "fPIC": [True, False], @@ -34,14 +35,8 @@ def config_options(self): def configure(self): self.options.rm_safe("fPIC") - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -68,9 +63,7 @@ def package(self): def package_info(self): self.cpp_info.libs.append("dnet") - self.cpp_info.includedirs = ["include"] - - self.cpp_info.includedirs.extend(["include/dnet"]) + self.cpp_info.includedirs.append(os.path.join("include", "dnet")) if self.settings.os == 'Windows': self.cpp_info.system_libs = ['Iphlpapi', 'wsock32'] From cf67efea2f0a7c679eb1b109df471f2c66b8300f Mon Sep 17 00:00:00 2001 From: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:59:59 +0000 Subject: [PATCH 10/10] Remove test_v1_package, fix configure method --- recipes/dnet/all/conanfile.py | 7 ++++--- recipes/dnet/all/test_v1_package/CMakeLists.txt | 8 -------- recipes/dnet/all/test_v1_package/conanfile.py | 17 ----------------- 3 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 recipes/dnet/all/test_v1_package/CMakeLists.txt delete mode 100644 recipes/dnet/all/test_v1_package/conanfile.py diff --git a/recipes/dnet/all/conanfile.py b/recipes/dnet/all/conanfile.py index 6996407d640f0..c8d803e208864 100644 --- a/recipes/dnet/all/conanfile.py +++ b/recipes/dnet/all/conanfile.py @@ -34,16 +34,17 @@ def config_options(self): del self.options.fPIC def configure(self): - self.options.rm_safe("fPIC") - self.settings.rm_safe("compiler.libcxx") + if self.options.shared: + self.options.rm_safe("fPIC") + # This is a pure C project self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.generate() deps = CMakeDeps(self) diff --git a/recipes/dnet/all/test_v1_package/CMakeLists.txt b/recipes/dnet/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0d20897301b68..0000000000000 --- a/recipes/dnet/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package - ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/dnet/all/test_v1_package/conanfile.py b/recipes/dnet/all/test_v1_package/conanfile.py deleted file mode 100644 index c7e2dc9c61059..0000000000000 --- a/recipes/dnet/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, "127.0.0.1"), run_environment=True)