From 387aa726a0924545dcab4e96458be2175ae4e8e1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 3 Nov 2023 19:52:12 +0200 Subject: [PATCH] net-snmp: merge changes from #19001 --- recipes/net-snmp/all/conanfile.py | 48 +++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/recipes/net-snmp/all/conanfile.py b/recipes/net-snmp/all/conanfile.py index 468e6449cb6a03..c192b440cd68d6 100644 --- a/recipes/net-snmp/all/conanfile.py +++ b/recipes/net-snmp/all/conanfile.py @@ -4,7 +4,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, chdir -from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, msvc_runtime_flag, NMakeToolchain @@ -53,11 +53,12 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/[>=1.1 <2]") + self.requires("openssl/1.1.1w") + self.requires("pcre/8.45") def validate(self): if self.settings.os == "Windows" and not is_msvc(self): - raise ConanInvalidConfiguration("net-snmp is setup to build only with MSVC on Windows") + raise ConanInvalidConfiguration("net-snmp is set up to build only with MSVC on Windows") def build_requirements(self): if is_msvc(self): @@ -76,7 +77,15 @@ def generate(self): tc.generate() else: tc = AutotoolsToolchain(self) + debug_flag = "enable" if self._is_debug else "disable" + ipv6_flag = "enable" if self.options.with_ipv6 else "disable" + openssl_path = self.dependencies["openssl"].package_folder + zlib_path = self.dependencies["zlib"].package_folder tc.configure_args += [ + f"--with-openssl={openssl_path}", + f"--with-zlib={zlib_path}", + f"--{debug_flag}-debugging", + f"--{ipv6_flag}-ipv6", "--with-defaults", "--without-rpm", "--without-pcre", @@ -86,15 +95,30 @@ def generate(self): "--disable-scripts", "--disable-mibs", "--disable-embedded-perl", - "--disable-{}".format("static" if self.options.shared else "shared"), - "--{}-debugging".format("enable" if self._is_debug else "disable"), - "--{}-ipv6".format("enable" if self.options.with_ipv6 else "disable"), - "--with-openssl={}".format(self.dependencies["openssl"].package_folder), ] + if self.settings.os == "Neutrino": + tc.configure_args.append("--with-endianness=little") + if self.settings.os.version == "7.0": + tc.configure_args.append("ac_cv_func_asprintf=no") + + if self.settings.os in ["Linux"]: + tc.extra_ldflags.append("-ldl") + tc.extra_ldflags.append("-lpthread") + + if self.settings.os in ["Neutrino"]: + tc.extra_ldflags.append("-ldl") + tc.extra_ldflags.append("-lsocket") + + if self.settings.os.version == "7.1": + tc.extra_ldflags.append("-lregex") tc.generate() + deps = AutotoolsDeps(self) deps.generate() + deps = PkgConfigDeps(self) + deps.generate() + def _patch_msvc(self): ssl_info = self.dependencies["openssl"] openssl_root = ssl_info.package_folder.replace("\\", "/") @@ -173,7 +197,9 @@ def package(self): src=os.path.join(self.source_folder, "win32")) else: autotools = Autotools(self) - autotools.install(args=["NOAUTODEPS=1"]) + #only install with -j1 as parallel install will break dependencies. Probably a bug in the dependencies + #install specific targets instead of just everything as it will try to do perl stuff on you host machine + autotools.install(args=["-j1"], target="installsubdirs installlibs installprogs installheaders") rm(self, "README", self.package_folder, recursive=True) rmdir(self, os.path.join(self.package_folder, "bin")) rm(self, "*.la", self.package_folder, recursive=True) @@ -186,3 +212,9 @@ def package(self): def package_info(self): self.cpp_info.libs = ["netsnmp"] + + if self.settings.os == "Neutrino": + self.cpp_info.system_libs.append("socket") + + if self.settings.os == "Neutrino" and self.settings.os.version == "7.1": + self.cpp_info.system_libs.append("regex")