diff --git a/packages/b/blosc/xmake.lua b/packages/b/blosc/xmake.lua index 2e900bdee..d952e39e6 100644 --- a/packages/b/blosc/xmake.lua +++ b/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) diff --git a/packages/b/brotli/xmake.lua b/packages/b/brotli/xmake.lua new file mode 100644 index 000000000..c66005d1a --- /dev/null +++ b/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)