Selaa lähdekoodia

add ceval and prvhash (#708)

* add ceval

* add prvhash

* update drogon
Hoildkv 3 vuotta sitten
vanhempi
commit
c9fbda5e15

+ 26 - 0
packages/c/ceval/xmake.lua

@@ -0,0 +1,26 @@
+package("ceval")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/erstan/ceval")
+    set_description("A C/C++ library for parsing and evaluation of arithmetic expressions.")
+    set_license("MIT")
+
+    add_urls("https://github.com/erstan/ceval/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/erstan/ceval.git")
+    add_versions("1.0.0", "3bb8cca8f0f7bf6f5ee6e7198d1174eab4d493318b6d97cc739343017090573e")
+
+    on_install(function (package)
+        io.replace("core/parser.h", "malloc.h", "stdlib.h", {plain = true})
+        os.mkdir(path.join(package:installdir("include"), "ceval"))
+        os.cp("ceval.h", path.join(package:installdir("include"), "ceval", "ceval.h"))
+        os.cp("core", path.join(package:installdir("include"), "ceval"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_csnippets({test = [[
+            void test() {
+                ceval_tree("1+1");
+                ceval_result("1+1");
+            }
+        ]]}, {includes = "ceval/ceval.h"}))
+    end)

+ 14 - 0
packages/d/drogon/patches/1.7.3/resolv.patch

@@ -0,0 +1,14 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -79,7 +79,10 @@
+ else (BUILD_DROGON_SHARED)
+     add_library(${PROJECT_NAME} STATIC)
+ endif (BUILD_DROGON_SHARED)
+ 
++if (APPLE)
++    target_link_libraries(${PROJECT_NAME} PUBLIC resolv)
++endif (APPLE)
+ if (NOT ${CMAKE_PLATFORM_NAME} STREQUAL "Windows" AND CMAKE_CXX_COMPILER_ID MATCHES GNU)
+     target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror)
+ endif ()

+ 15 - 0
packages/d/drogon/patches/1.7.3/trantor.patch

@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -120,9 +120,9 @@
+         PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/mman-win32>)
+ endif (WIN32)
+ 
+-add_subdirectory(trantor)
++find_package(Trantor CONFIG REQUIRED)
+ 
+-target_link_libraries(${PROJECT_NAME} PUBLIC trantor)
++target_link_libraries(${PROJECT_NAME} PUBLIC Trantor::Trantor)
+ 
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
+     target_link_libraries(${PROJECT_NAME} PRIVATE network)

+ 3 - 0
packages/d/drogon/xmake.lua

@@ -9,6 +9,7 @@ package("drogon")
     add_versions("v1.4.1", "ad794d7744b600240178348c15e216c919fe7a2bc196cf1239f129aee2af19c7")
     add_versions("v1.6.0", "9f8802b579aac29e9eddfb156e432276727a3d3c49fffdf453a2ddcd1cb69093")
     add_versions("v1.7.1", "a0bce1f32b6e1321486bb25c55ca7bd7a577cbd53f1e7be47367d0f9733730f1")
+    add_versions("v1.7.3", "36dc5a3acad3b8a32bb1364764b26cf01c687a4f62358de9632e055b156313a6")
 
     add_patches("1.4.1", path.join(os.scriptdir(), "patches", "1.4.1", "trantor.patch"), "7f9034a27bb63de8dedb80dd9f246ea7aa7724c87f2c0d0054f4b6097ea2a862")
     add_patches("1.4.1", path.join(os.scriptdir(), "patches", "1.4.1", "resolv.patch"), "a1054822bf91f5f06de8bca9b1bd8859233228159a8ff8014ce6329d6c000f26")
@@ -16,6 +17,8 @@ package("drogon")
     add_patches("1.6.0", path.join(os.scriptdir(), "patches", "1.6.0", "resolv.patch"), "dc144ff1cdcfee413efbcdc568fed587318289e8fa1bb0da9d2ea94a15588b25")
     add_patches("1.7.1", path.join(os.scriptdir(), "patches", "1.7.1", "trantor.patch"), "3f93a1e78ba45c8f1e85c28d4fdbbd3e7961078da8cf417a97d8797a91fa2167")
     add_patches("1.7.1", path.join(os.scriptdir(), "patches", "1.7.1", "resolv.patch"), "75d3618374d15a5ec12681c8659e183f3e620acc43c77ae66e7bea21a25ca546")
+    add_patches("1.7.3", path.join(os.scriptdir(), "patches", "1.7.3", "trantor.patch"), "27e479dd0e3f8adc75c9c21fe895937f727c3102e5bfb21ac3289d6ad2795b7a")
+    add_patches("1.7.3", path.join(os.scriptdir(), "patches", "1.7.3", "resolv.patch"), "49694f090e169a5c0e524726e8b85ad0bac76c05ed633c60e986849c2e5adb85")
 
     add_configs("c_ares", {description = "Enable async DNS query support.", default = false, type = "boolean"})
     add_configs("mysql", {description = "Enable mysql support.", default = false, type = "boolean"})

+ 23 - 0
packages/p/prvhash/xmake.lua

@@ -0,0 +1,23 @@
+package("prvhash")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/avaneev/prvhash")
+    set_description("PRVHASH - Pseudo-Random-Value Hash")
+    set_license("MIT")
+
+    add_urls("https://github.com/avaneev/prvhash/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/avaneev/prvhash.git")
+    add_versions("4.0", "b4d8ce80ee73e504faccd235d4071398c95b06421095eeb2502ef46a810f8375")
+    
+    on_install(function (package)
+        os.cp("*.h", package:installdir("include"))
+    end)
+
+    on_test(function (package)
+        assert(package:check_csnippets({test = [[
+            void test() {
+                uint64_t Seed = 0, lcg = 0, Hash = 0;
+                uint64_t v = prvhash_core64(&Seed, &lcg, &Hash);
+            }
+        ]]}, {includes = "prvhash_core.h"}))
+    end)

+ 1 - 0
packages/t/trantor/xmake.lua

@@ -9,6 +9,7 @@ package("trantor")
     add_versions("v1.3.0", "524589dc9258e1ace3b2f887b835cfbeccab3c5efc4ba94963c59f3528248d9b")
     add_versions("v1.4.1", "aa3f4dddfd3fd1a6e04f79744e69f23bb6472c314724eaa3051872a2a03bbda9")
     add_versions("v1.5.0", "8704df75b783089d7e5361174054e0e46a09cc315b851dbc2ab6736e631b090b")
+    add_versions("v1.5.2", "6ccd781b3a2703b94689d7da579a38a78bc5c89616cce18ec27fcb6bc0b1620f")
 
     add_deps("cmake")
     add_deps("openssl", "c-ares", {optional = true})