Преглед изворни кода

add double-conversion and libevent (#419)

* add double-conversion

* add libevent

* improve libevent

* improve config format
Hoildkv пре 4 година
родитељ
комит
a529f9154d
2 измењених фајлова са 56 додато и 0 уклоњено
  1. 21 0
      packages/d/double-conversion/xmake.lua
  2. 35 0
      packages/l/libevent/xmake.lua

+ 21 - 0
packages/d/double-conversion/xmake.lua

@@ -0,0 +1,21 @@
+package("double-conversion")
+
+    set_homepage("https://github.com/google/double-conversion")
+    set_description("Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/google/double-conversion/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/google/double-conversion.git")
+    add_versions("v3.1.5", "a63ecb93182134ba4293fd5f22d6e08ca417caafa244afaa751cbfddf6415b13")
+
+    add_deps("cmake")
+    on_install("windows", "linux", "macosx", function (package)
+        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"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxtypes("double_conversion::Double", {includes = "double-conversion/ieee.h"}))
+    end)

+ 35 - 0
packages/l/libevent/xmake.lua

@@ -0,0 +1,35 @@
+package("libevent")
+
+    set_homepage("https://libevent.org/")
+    set_description("libevent – an event notification library")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/libevent/libevent/releases/download/release-$(version)-stable/libevent-$(version)-stable.tar.gz")
+    add_urls("https://github.com/libevent/libevent.git")
+    add_versions("2.1.12", "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb")
+
+    add_configs("openssl", {description = "Build with OpenSSL library.", default = false, type = "boolean"})
+    add_configs("mbedtls", {description = "Build with mbedtls library.", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    on_load(function (package)
+        if package:config("openssl") then
+            package:add("deps", "openssl")
+        end
+        if package:config("mbedtls") then
+            package:add("deps", "mbedtls")
+        end
+    end)
+
+    on_install("windows", "linux", "macosx", function (package)
+        local configs = {"-DEVENT__DISABLE_TESTS=ON", "-DEVENT__DISABLE_REGRESS=ON", "-DEVENT__DISABLE_SAMPLES=ON"}
+        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"))
+        table.insert(configs, "-DEVENT__DISABLE_OPENSSL=" .. (package:config("openssl") and "OFF" or "ON"))
+        table.insert(configs, "-DEVENT__DISABLE_MBEDTLS=" .. (package:config("mbedtls") and "OFF" or "ON"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("event_base_new", {includes = "event2/event.h"}))
+    end)