Kaynağa Gözat

Auto-update jansson to 2.14.1 (#7149)

* Update jansson to 2.14.1

* fix linux shared

* fix r27

---------

Co-authored-by: star9029 <[email protected]>
ruki 3 ay önce
ebeveyn
işleme
6b920e50d9
1 değiştirilmiş dosya ile 31 ekleme ve 10 silme
  1. 31 10
      packages/j/jansson/xmake.lua

+ 31 - 10
packages/j/jansson/xmake.lua

@@ -1,21 +1,42 @@
 package("jansson")
-
     set_homepage("https://github.com/akheron/jansson")
     set_description("C library for encoding, decoding and manipulating JSON data")
     set_license("MIT")
 
-    add_urls("https://github.com/akheron/jansson/releases/download/v$(version)/jansson-$(version).tar.gz")
+    add_urls("https://github.com/akheron/jansson/releases/download/v$(version)/jansson-$(version).tar.gz",
+             "https://github.com/akheron/jansson.git")
+
+    add_versions("2.14.1", "2521cd51a9641d7a4e457f7215a4cd5bb176f690bc11715ddeec483e85d9e2b3")
     add_versions("2.14", "5798d010e41cf8d76b66236cfb2f2543c8d082181d16bc3085ab49538d4b9929")
 
-    add_deps("cmake")
-    on_install("windows", "macosx", "linux", "mingw", function (package)
-        local configs = {"-DJANSSON_EXAMPLES=OFF", "-DJANSSON_BUILD_DOCS=OFF", "-DJANSSON_WITHOUT_TESTS=ON"}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
-        table.insert(configs, "-DJANSSON_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        if package:is_plat("windows") then
-            table.insert(configs, "-DJANSSON_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+    on_load(function (package)
+        if package:is_plat("linux") and package:config("shared") then
+            package:add("deps", "autotools")
+        else
+            package:add("deps", "cmake")
+        end
+    end)
+
+    on_install(function (package)
+        if package:is_plat("linux") and package:config("shared") then
+            local configs = {}
+            table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+            table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+            import("package.tools.autoconf").install(package, configs)
+        else
+            local configs = {
+                "-DJANSSON_EXAMPLES=OFF",
+                "-DJANSSON_BUILD_DOCS=OFF",
+                "-DJANSSON_WITHOUT_TESTS=ON",
+                "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
+            }
+            table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+            table.insert(configs, "-DJANSSON_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+            if package:is_plat("windows") then
+                table.insert(configs, "-DJANSSON_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+            end
+            import("package.tools.cmake").install(package, configs)
         end
-        import("package.tools.cmake").install(package, configs)
     end)
 
     on_test(function (package)