From e92811dd152064150439c9b036bba8d5b751a0d8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 28 Jul 2023 16:27:15 +0300 Subject: [PATCH 01/10] resiprocate: migrate to Conan v2 --- recipes/resiprocate/all/conandata.yml | 4 +- recipes/resiprocate/all/conanfile.py | 122 ++++++++++-------- .../all/test_package/CMakeLists.txt | 9 +- .../resiprocate/all/test_package/conanfile.py | 21 ++- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 112 insertions(+), 69 deletions(-) create mode 100644 recipes/resiprocate/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/resiprocate/all/test_v1_package/conanfile.py diff --git a/recipes/resiprocate/all/conandata.yml b/recipes/resiprocate/all/conandata.yml index 30a690c6f981a..3c5856f5a74a9 100644 --- a/recipes/resiprocate/all/conandata.yml +++ b/recipes/resiprocate/all/conandata.yml @@ -1,4 +1,4 @@ sources: "1.12.0": - url: https://www.resiprocate.org/files/pub/reSIProcate/releases/resiprocate-1.12.0.tar.gz - sha256: 046826503d3c8682ae0e42101b28f903c5f988235f1ff4a98dbfb9066d0d3d49 + url: "https://github.com/resiprocate/resiprocate/archive/refs/tags/resiprocate-1.12.0.tar.gz" + sha256: "aa8906082e4221bffbfab3210df68a6ba1f57ba1532d89ea4572b4fa9877914f" diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 54400194c9ba3..8e8f0d810d449 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -1,94 +1,104 @@ import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.files import copy, get, rm, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.29.1" class ResiprocateConan(ConanFile): name = "resiprocate" - description = "The project is dedicated to maintaining a complete, correct, and commercially usable implementation of SIP and a few related protocols. " - topics = ("sip", "voip", "communication", "signaling") - url = "https://github.com/conan-io/conan-center-index" - homepage = "http://www.resiprocate.org" + description = ( + "The project is dedicated to maintaining a complete, correct, " + "and commercially usable implementation of SIP and a few related protocols." + ) license = "VSL-1.0" - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False], - "with_ssl": [True, False], - "with_postgresql": [True, False], - "with_mysql": [True, False]} - default_options = {"fPIC": True, - "shared": False, - "with_ssl": True, - "with_postgresql": True, - "with_mysql": True} - _autotools = None + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/resiprocate/resiprocate/wiki/" + topics = ("sip", "voip", "communication", "signaling") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": [True, False], + "with_postgresql": [True, False], + "with_mysql": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": True, + "with_postgresql": True, + "with_mysql": True, + } def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.os in ("Windows", "Macos"): + if self.settings.os == "Windows" or is_apple_os(self): # FIXME: Visual Studio project & Mac support seems available in resiprocate - raise ConanInvalidConfiguration("reSIProcate recipe does not currently support {}.".format(self.settings.os)) + raise ConanInvalidConfiguration( + f"reSIProcate recipe does not currently support {self.settings.os}." + ) if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/[>=1.1 <4]") if self.options.with_postgresql: - self.requires("libpq/14.2") + self.requires("libpq/15.3") if self.options.with_mysql: - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.31") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), self._source_subfolder) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))) - ] + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + tc = AutotoolsToolchain(self) # These options do not support yes/no if self.options.with_ssl: - configure_args.append("--with-ssl") + tc.configure_args.append("--with-ssl") if self.options.with_mysql: - configure_args.append("--with-mysql") + tc.configure_args.append("--with-mysql") if self.options.with_postgresql: - configure_args.append("--with-postgresql") - - self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args) - return self._autotools + tc.configure_args.append("--with-postgresql") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - autotools = self._configure_autotools() - autotools.make() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(os.path.join(self.package_folder, "share"))) - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(os.path.join(self.package_folder, "share"))) + rm(self, "*.la", os.path.join(self.package_folder), recursive=True) def package_info(self): self.cpp_info.libs = ["resip", "rutil", "dum", "resipares"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs = ["pthread"] + + # TODO: Legacy, to be removed on Conan 2.0 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/resiprocate/all/test_package/CMakeLists.txt b/recipes/resiprocate/all/test_package/CMakeLists.txt index 33ae887aa6aea..9a3b67fc7fe91 100644 --- a/recipes/resiprocate/all/test_package/CMakeLists.txt +++ b/recipes/resiprocate/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(resiprocate REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE resiprocate::resiprocate) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/resiprocate/all/test_package/conanfile.py b/recipes/resiprocate/all/test_package/conanfile.py index ea57a464900be..ef5d7042163ec 100644 --- a/recipes/resiprocate/all/test_package/conanfile.py +++ b/recipes/resiprocate/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/resiprocate/all/test_v1_package/CMakeLists.txt b/recipes/resiprocate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/resiprocate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +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/resiprocate/all/test_v1_package/conanfile.py b/recipes/resiprocate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..84ee68733e516 --- /dev/null +++ b/recipes/resiprocate/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 649b1b96a2063e9d3e1a06614f723493ccad427c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 18 Aug 2023 00:20:24 +0300 Subject: [PATCH 02/10] resiprocate: OpenSSL v3 is not supported --- recipes/resiprocate/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 8e8f0d810d449..10c9d2616f2b9 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -56,7 +56,7 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/[>=1.1 <4]") + self.requires("openssl/1.1.1v") if self.options.with_postgresql: self.requires("libpq/15.3") if self.options.with_mysql: From b2222e8852ce2b02b3813c7b8eabe84dc3e37e97 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 2 Oct 2023 13:55:58 +0300 Subject: [PATCH 03/10] resiprocate: use version range for OpenSSL --- recipes/resiprocate/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 10c9d2616f2b9..bb7574840f820 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -56,7 +56,7 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1v") + self.requires("openssl/[~1.1]") if self.options.with_postgresql: self.requires("libpq/15.3") if self.options.with_mysql: From f8fc8cd4855ecd92b5d3db1bbbba316c15b39db2 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 2 Nov 2023 06:20:10 +0200 Subject: [PATCH 04/10] resiprocate: use fixed openssl version --- recipes/resiprocate/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index bb7574840f820..1db65eebe96ee 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -56,7 +56,7 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/[~1.1]") + self.requires("openssl/1.1.1w") if self.options.with_postgresql: self.requires("libpq/15.3") if self.options.with_mysql: From 8b9706408e0a10a7432dbd1ab957a180ebfd2950 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 7 Nov 2023 15:05:36 +0200 Subject: [PATCH 05/10] resiprocate: bump deps --- recipes/resiprocate/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 1db65eebe96ee..601e94d6a5736 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -56,11 +56,11 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1w") + self.requires("openssl/[>=1.1 <4]") if self.options.with_postgresql: - self.requires("libpq/15.3") + self.requires("libpq/15.4") if self.options.with_mysql: - self.requires("libmysqlclient/8.0.31") + self.requires("libmysqlclient/8.1.0") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 21e41e43714366941c62e4e6ba7bbaefde6169d9 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 22 Nov 2023 15:55:09 +0200 Subject: [PATCH 06/10] resiprocate: do not print PATH --- recipes/resiprocate/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 601e94d6a5736..29d08db0fd1d5 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -100,5 +100,4 @@ def package_info(self): # TODO: Legacy, to be removed on Conan 2.0 bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.PATH.append(bin_path) From 3ce113f142f0c1d238342bea291936d9f2b4e355 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 23 Nov 2023 10:18:01 +0200 Subject: [PATCH 07/10] resiprocate: downgrade OpenSSL --- recipes/resiprocate/all/conanfile.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 29d08db0fd1d5..efd6fb45414a6 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -45,9 +45,7 @@ def config_options(self): def configure(self): if self.settings.os == "Windows" or is_apple_os(self): # FIXME: Visual Studio project & Mac support seems available in resiprocate - raise ConanInvalidConfiguration( - f"reSIProcate recipe does not currently support {self.settings.os}." - ) + raise ConanInvalidConfiguration(f"reSIProcate recipe does not currently support {self.settings.os}.") if self.options.shared: self.options.rm_safe("fPIC") @@ -56,7 +54,7 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/[>=1.1 <4]") + self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported if self.options.with_postgresql: self.requires("libpq/15.4") if self.options.with_mysql: @@ -86,7 +84,7 @@ def build(self): autotools.make() def package(self): - copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) with chdir(self, self.source_folder): autotools = Autotools(self) autotools.install() From d5637bd974520d9f7c4642edf26ee2f02f9ad163 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 5 Jan 2024 15:46:51 +0200 Subject: [PATCH 08/10] resiprocate: temporarily use openssl/3.x to see if it resolves the missing binary issue --- recipes/resiprocate/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index efd6fb45414a6..4a31a881b7878 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -54,7 +54,8 @@ def layout(self): def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported + # self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported + self.requires("openssl/[>=1.1 <4]") if self.options.with_postgresql: self.requires("libpq/15.4") if self.options.with_mysql: From 8c55d523adbbc1e5d5b46b42cd98d2b3ff4c355d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 19 Jan 2024 23:45:05 +0200 Subject: [PATCH 09/10] resiprocate: revert to OpenSSL v1, disable mysql due to OpenSSL version conflict --- recipes/resiprocate/all/conanfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index 4a31a881b7878..d8ebe0db644a5 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -35,7 +35,7 @@ class ResiprocateConan(ConanFile): "fPIC": True, "with_ssl": True, "with_postgresql": True, - "with_mysql": True, + "with_mysql": False, } def config_options(self): @@ -44,7 +44,7 @@ def config_options(self): def configure(self): if self.settings.os == "Windows" or is_apple_os(self): - # FIXME: Visual Studio project & Mac support seems available in resiprocate + # FIXME: unreleased versions of resiprocate use CMake and should support Windows and macOS raise ConanInvalidConfiguration(f"reSIProcate recipe does not currently support {self.settings.os}.") if self.options.shared: self.options.rm_safe("fPIC") @@ -54,8 +54,7 @@ def layout(self): def requirements(self): if self.options.with_ssl: - # self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported - self.requires("openssl/[>=1.1 <4]") + self.requires("openssl/1.1.1w") # OpenSSL 3.x is not supported if self.options.with_postgresql: self.requires("libpq/15.4") if self.options.with_mysql: From 7962bd488a9393324daba92da356678a3d1ea48c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Jan 2024 15:23:56 +0200 Subject: [PATCH 10/10] resiprocate: add VirtualRunEnv --- recipes/resiprocate/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py index d8ebe0db644a5..65f010b869c78 100644 --- a/recipes/resiprocate/all/conanfile.py +++ b/recipes/resiprocate/all/conanfile.py @@ -3,6 +3,8 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv from conan.tools.files import copy, get, rm, rmdir, chdir from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps from conan.tools.layout import basic_layout @@ -64,6 +66,9 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + if not cross_building(self): + venv = VirtualRunEnv(self) + venv.generate(scope="build") tc = AutotoolsToolchain(self) # These options do not support yes/no if self.options.with_ssl: