Bladeren bron

idna: add package (#3425)

star9029 1 jaar geleden
bovenliggende
commit
fc00ea9c61
2 gewijzigde bestanden met toevoegingen van 30 en 3 verwijderingen
  1. 2 3
      packages/a/ada/xmake.lua
  2. 28 0
      packages/i/idna/xmake.lua

+ 2 - 3
packages/a/ada/xmake.lua

@@ -1,5 +1,4 @@
 package("ada")
-
     set_homepage("https://www.ada-url.com")
     set_description("WHATWG-compliant and fast URL parser written in modern C++")
     set_license("Apache-2.0")
@@ -22,8 +21,8 @@ package("ada")
         local configs = {"-DBUILD_TESTING=OFF"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        io.replace("CMakeLists.txt", "  add_subdirectory(singleheader)", "", {plain = true})
-        io.replace("CMakeLists.txt", "  add_subdirectory(tools)", "", {plain = true})
+        io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
+        io.replace("CMakeLists.txt", "add_subdirectory(tools)", "", {plain = true})
         import("package.tools.cmake").install(package, configs)
     end)
 

+ 28 - 0
packages/i/idna/xmake.lua

@@ -0,0 +1,28 @@
+package("idna")
+    set_homepage("https://github.com/ada-url/idna")
+    set_description("C++ library implementing the to_ascii and to_unicode functions from the Unicode Technical Standard.")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/ada-url/idna.git")
+    add_versions("2024.02.28", "fff988508f659ef5c6494572ebea3d5db2466ed0")
+
+    add_deps("cmake")
+
+    on_install(function (package)
+        io.replace("CMakeLists.txt", "add_subdirectory(singleheader)", "", {plain = true})
+
+        local configs = {"-DBUILD_TESTING=OFF", "-DADA_IDNA_BENCHMARKS=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <ada/idna/to_ascii.h>
+            void test() {
+                std::string_view input = u8"meßagefactory.ca";
+                std::string idna_ascii = ada::idna::to_ascii(input);
+            }
+        ]]}, {configs = {languages = "c++17"}}))
+    end)