Explorar el Código

add package brotli

xq114 hace 4 años
padre
commit
24325cd45f
Se han modificado 3 ficheros con 43 adiciones y 4 borrados
  1. 3 3
      packages/b/blosc/xmake.lua
  2. 39 0
      packages/b/brotli/xmake.lua
  3. 1 1
      packages/l/libuuid/xmake.lua

+ 3 - 3
packages/b/blosc/xmake.lua

@@ -28,11 +28,11 @@ package("blosc")
         if package:is_plat("windows", "mingw") then
             -- special concern for legacy versions which keep producing the shared library
             local version = package:version()
-            if version:le("1.10") and not package:config("shared") then
-                os.rm(path.join(package:installdir("lib"), "blosc.lib"))
-            elseif package:config("shared") then
+            if package:config("shared") then
                 os.cp("build/install/bin", package:installdir())
                 package:addenv("PATH", "bin")
+            elseif version:le("1.10") then
+                os.rm(path.join(package:installdir("lib"), "blosc.lib"))
             end
         end
     end)

+ 39 - 0
packages/b/brotli/xmake.lua

@@ -0,0 +1,39 @@
+package("brotli")
+
+    set_homepage("https://github.com/google/brotli")
+    set_description("Brotli compression format.")
+
+    set_urls("https://github.com/google/brotli/archive/v$(version).tar.gz",
+             "https://github.com/google/brotli.git")
+
+    add_versions("1.0.9", "f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46")
+
+    add_deps("cmake")
+
+    on_install("linux", "macosx", "windows", function(package)
+        local configs = {"-DBUILD_TESTING=OFF"}
+        -- NOTE: BUILD_SHARED_LIBS not supported now, may be added in future.
+        -- table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        import("package.tools.cmake").install(package, configs, {buildir = "builddir"})
+        os.cp("builddir/install/bin", package:installdir())
+        if package:config("shared") then
+            os.rm(path.join(package:installdir("lib"), "*-static.*"))
+        else
+            for _, name in ipairs({"brotlicommon", "brotlienc", "brotlidec"}) do
+                os.rm(path.join(package:installdir("lib"), "*" .. name .. ".*"))
+                os.rm(path.join(package:installdir("bin"), name .. ".dll"))
+            end
+        end
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function(package)
+        os.vrun("brotli --version")
+        assert(package:check_csnippets([[
+            void test() {
+                BrotliEncoderState* s = BrotliEncoderCreateInstance(NULL, NULL, NULL);
+                BrotliEncoderDestroyInstance(s);
+            }
+        ]], {includes = "brotli/encode.h"}))
+    end)

+ 1 - 1
packages/l/libuuid/xmake.lua

@@ -1,4 +1,4 @@
-package("jsoncpp")
+package("libuuid")
 
     set_homepage("https://sourceforge.net/projects/libuuid")
     set_description("Portable uuid C library")