소스 검색

add nghttp3 (#995)

ruki 3 년 전
부모
커밋
340ce7a8b7
1개의 변경된 파일30개의 추가작업 그리고 0개의 파일을 삭제
  1. 30 0
      packages/n/nghttp3/xmake.lua

+ 30 - 0
packages/n/nghttp3/xmake.lua

@@ -0,0 +1,30 @@
+package("nghttp3")
+    set_homepage("https://github.com/ngtcp2/nghttp3")
+    set_description("HTTP/3 library written in C")
+    set_license("MIT")
+
+    add_urls("https://github.com/ngtcp2/nghttp3.git")
+    add_versions("2022.02.08", "98402fb68fffc0ab1b211a5f07c1425dfd42d217")
+
+    add_deps("cmake")
+
+    on_load("windows", function (package)
+        if not package:config("shared") then
+            package:add("defines", "NGHTTP3_STATICLIB")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DENABLE_LIB_ONLY=ON"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DENABLE_SHARED_LIB=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DENABLE_STATIC_LIB=" .. (package:config("shared") and "OFF" or "ON"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DENABLE_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("nghttp3_version", {includes = "nghttp3/nghttp3.h"}))
+    end)