From a5369f8080f7446ca6c7accf04e701ff95e0901d Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 25 Feb 2024 23:03:42 +0900 Subject: [PATCH 01/10] idna: add recipe --- recipes/idna/all/CMakeLists.txt | 25 ++++++ recipes/idna/all/conandata.yml | 4 + recipes/idna/all/conanfile.py | 80 +++++++++++++++++++ recipes/idna/all/test_package/CMakeLists.txt | 8 ++ recipes/idna/all/test_package/conanfile.py | 26 ++++++ .../idna/all/test_package/test_package.cpp | 14 ++++ recipes/idna/config.yml | 3 + 7 files changed, 160 insertions(+) create mode 100644 recipes/idna/all/CMakeLists.txt create mode 100644 recipes/idna/all/conandata.yml create mode 100644 recipes/idna/all/conanfile.py create mode 100644 recipes/idna/all/test_package/CMakeLists.txt create mode 100644 recipes/idna/all/test_package/conanfile.py create mode 100644 recipes/idna/all/test_package/test_package.cpp create mode 100644 recipes/idna/config.yml diff --git a/recipes/idna/all/CMakeLists.txt b/recipes/idna/all/CMakeLists.txt new file mode 100644 index 0000000000000..34cae2760f904 --- /dev/null +++ b/recipes/idna/all/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.15) +project(cmake_wrapper) + +add_subdirectory(${IDNA_SRC_DIR}) + +include(GNUInstallDirs) + +install( + TARGETS ada-idna + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +install( + FILES + ${IDNA_SRC_DIR}/include/idna.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +install( + DIRECTORY + ${IDNA_SRC_DIR}/include/ada + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/idna/all/conandata.yml b/recipes/idna/all/conandata.yml new file mode 100644 index 0000000000000..9c4f88890b77d --- /dev/null +++ b/recipes/idna/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20240115": + url: "https://github.com/ada-url/idna/archive/01c745f27b20e508195cf73e859da35716244f33.tar.gz" + sha256: "177952f68e9f691785c936490dc154c456b953b5609f6c04e2ad4374ebda8d01" diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py new file mode 100644 index 0000000000000..e547e8c9f4967 --- /dev/null +++ b/recipes/idna/all/conanfile.py @@ -0,0 +1,80 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.52.0" + +class IdnaConan(ConanFile): + name = "idna" + description = "C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard." + license = "Apache-2.0", "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ada-url/idna/" + topics = ("unicode", "icu", "topic3") + package_type = "static-library" + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["IDNA_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE-*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["ada-idna"] diff --git a/recipes/idna/all/test_package/CMakeLists.txt b/recipes/idna/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6cf529575de5c --- /dev/null +++ b/recipes/idna/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(idna REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE idna::idna) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/idna/all/test_package/conanfile.py b/recipes/idna/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/idna/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_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/idna/all/test_package/test_package.cpp b/recipes/idna/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cbb7f6eeb2dec --- /dev/null +++ b/recipes/idna/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "idna.h" + +int main(void) { + std::string_view input = reinterpret_cast(u8"meßagefactory.ca"); // non-empty UTF-8 string, must be percent decoded + std::string idna_ascii = ada::idna::to_ascii(input); + if(idna_ascii.empty()) { + // There was an error. + } + std::cout << idna_ascii << std::endl; + // outputs 'xn--meagefactory-m9a.ca' if the input is u8"meßagefactory.ca" +} diff --git a/recipes/idna/config.yml b/recipes/idna/config.yml new file mode 100644 index 0000000000000..4edf0b751a05e --- /dev/null +++ b/recipes/idna/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20240115": + folder: all From 24e0e6cd906aa05d6c2121246ea00f4ddb925612 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 26 Feb 2024 09:20:27 +0900 Subject: [PATCH 02/10] make cmake 3.16 --- recipes/idna/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index e547e8c9f4967..5efb6ca4f8c1d 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -57,6 +57,9 @@ def validate(self): f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) + def build_requirements(self): + self.tool_requires("cmake/[>=3.16 <4]") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 03ed36951859118b7b1f37c8802732ceb67225c3 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 27 Feb 2024 23:28:56 +0900 Subject: [PATCH 03/10] remove sample topics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rubén Rincón Blanco --- recipes/idna/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index 5efb6ca4f8c1d..f0fec7f45503b 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -14,7 +14,7 @@ class IdnaConan(ConanFile): license = "Apache-2.0", "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ada-url/idna/" - topics = ("unicode", "icu", "topic3") + topics = ("unicode", "icu") package_type = "static-library" settings = "os", "arch", "compiler", "build_type" options = { From 1c49cff694eac1caf9959ecb9ba1d9cc745cb2ea Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 27 Feb 2024 23:42:38 +0900 Subject: [PATCH 04/10] fix target name --- recipes/idna/all/conanfile.py | 2 ++ recipes/idna/all/test_package/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index f0fec7f45503b..eb9683a357491 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -81,3 +81,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["ada-idna"] + self.cpp_info.set_property("cmake_file_name", "ada-idna") + self.cpp_info.set_property("cmake_target_name", "ada-idna") diff --git a/recipes/idna/all/test_package/CMakeLists.txt b/recipes/idna/all/test_package/CMakeLists.txt index 6cf529575de5c..889584ca451e0 100644 --- a/recipes/idna/all/test_package/CMakeLists.txt +++ b/recipes/idna/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(idna REQUIRED CONFIG) +find_package(ada-idna REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE idna::idna) +target_link_libraries(${PROJECT_NAME} PRIVATE ada-idna) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) From 552802698dbacf40972cc662bf472ccd3c3917c6 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 28 Feb 2024 14:24:43 +0900 Subject: [PATCH 05/10] fix license Co-authored-by: Martin Valgur --- recipes/idna/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index eb9683a357491..42492fcb1ad65 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -11,7 +11,7 @@ class IdnaConan(ConanFile): name = "idna" description = "C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard." - license = "Apache-2.0", "MIT" + license = "Apache-2.0 OR MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ada-url/idna/" topics = ("unicode", "icu") From fa4b539334cff4004e39454c221c2aec11dc4b40 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 28 Feb 2024 14:25:11 +0900 Subject: [PATCH 06/10] Add VirtualBuildEnv Co-authored-by: Martin Valgur --- recipes/idna/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index 42492fcb1ad65..2547276432077 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -64,6 +64,8 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) tc.variables["BUILD_TESTING"] = False tc.variables["IDNA_SRC_DIR"] = self.source_folder.replace("\\", "/") From 017850f33ae958c86cf9e77d748fda8e23d92cfb Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 28 Feb 2024 10:22:56 +0100 Subject: [PATCH 07/10] Add missing import for VirtualBuildEnv --- recipes/idna/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index 2547276432077..1cbe5f4fd83ea 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os required_conan_version = ">=1.52.0" From ea3121ac24eee844febc103a00b1e15cd43683c7 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 28 Feb 2024 22:26:09 +0900 Subject: [PATCH 08/10] Explicity disable building benchmarks Co-authored-by: Uilian Ries --- recipes/idna/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index 1cbe5f4fd83ea..49cdee4cfcc8b 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -69,6 +69,7 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_TESTING"] = False + tc.variables["ADA_IDNA_BENCHMARKS"] = False tc.variables["IDNA_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.generate() From 8bc296f6fbd0ae3351802a823cf915fabf1caa80 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 28 Feb 2024 22:26:51 +0900 Subject: [PATCH 09/10] Revert license names Co-authored-by: Uilian Ries --- recipes/idna/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index 49cdee4cfcc8b..e791fef6a90de 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -12,7 +12,7 @@ class IdnaConan(ConanFile): name = "idna" description = "C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard." - license = "Apache-2.0 OR MIT" + license = ("Apache-2.0", "MIT") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ada-url/idna/" topics = ("unicode", "icu") From c33982d0a10f4f9a3b757537b36f66021e2ddcd7 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 7 Mar 2024 01:58:34 +0900 Subject: [PATCH 10/10] update cci.20240228, remove cmake wrapper --- recipes/idna/all/CMakeLists.txt | 25 ------------------------- recipes/idna/all/conandata.yml | 6 +++--- recipes/idna/all/conanfile.py | 6 +----- recipes/idna/config.yml | 2 +- 4 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 recipes/idna/all/CMakeLists.txt diff --git a/recipes/idna/all/CMakeLists.txt b/recipes/idna/all/CMakeLists.txt deleted file mode 100644 index 34cae2760f904..0000000000000 --- a/recipes/idna/all/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(cmake_wrapper) - -add_subdirectory(${IDNA_SRC_DIR}) - -include(GNUInstallDirs) - -install( - TARGETS ada-idna - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -) - -install( - FILES - ${IDNA_SRC_DIR}/include/idna.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) - -install( - DIRECTORY - ${IDNA_SRC_DIR}/include/ada - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -) diff --git a/recipes/idna/all/conandata.yml b/recipes/idna/all/conandata.yml index 9c4f88890b77d..9c2dca57fc556 100644 --- a/recipes/idna/all/conandata.yml +++ b/recipes/idna/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "cci.20240115": - url: "https://github.com/ada-url/idna/archive/01c745f27b20e508195cf73e859da35716244f33.tar.gz" - sha256: "177952f68e9f691785c936490dc154c456b953b5609f6c04e2ad4374ebda8d01" + "cci.20240228": + url: "https://github.com/ada-url/idna/archive/fff988508f659ef5c6494572ebea3d5db2466ed0.tar.gz" + sha256: "68cf182f822d8e8599f827767e215a0c4f67f381d729e4ba15509443b52f849b" diff --git a/recipes/idna/all/conanfile.py b/recipes/idna/all/conanfile.py index e791fef6a90de..2e0091c585904 100644 --- a/recipes/idna/all/conanfile.py +++ b/recipes/idna/all/conanfile.py @@ -39,9 +39,6 @@ def _compilers_minimum_version(self): "msvc": "192", } - def export_sources(self): - copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -70,12 +67,11 @@ def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_TESTING"] = False tc.variables["ADA_IDNA_BENCHMARKS"] = False - tc.variables["IDNA_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.generate() def build(self): cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): diff --git a/recipes/idna/config.yml b/recipes/idna/config.yml index 4edf0b751a05e..34cca17a5b748 100644 --- a/recipes/idna/config.yml +++ b/recipes/idna/config.yml @@ -1,3 +1,3 @@ versions: - "cci.20240115": + "cci.20240228": folder: all