Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib-ng is non-compat by default #4859

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/l/libbigwig/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ package("libbigwig")
if package:config("curl") then
package:add("deps", "libcurl")
end
package:add("deps", (package:config("zlib_ng") and "zlib-ng" or "zlib"))
if package:config("zlib_ng") then
package:add("deps", "zlib-ng", {configs = {zlib_compat = true}})
else
package:add("deps", "zlib")
end
end)

on_install("linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package)
Expand Down
26 changes: 15 additions & 11 deletions packages/z/zlib-ng/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ package("zlib-ng")
add_versions("2.0.6", "8258b75a72303b661a238047cb348203d88d9dddf85d480ed885f375916fcab6")
add_versions("2.0.5", "eca3fe72aea7036c31d00ca120493923c4d5b99fe02e6d3322f7c88dbdcd0085")

add_configs("zlib_compat", {description = "Compile with zlib compatible API", default = false, type = "boolean"})

add_deps("cmake")

if on_check then
Expand All @@ -27,23 +29,20 @@ package("zlib-ng")
end
end

if package:version():eq("2.1.6") and package:is_arch("i386") and package:is_cross() then
assert(false, "package(zlib-ng/i386): Unsupported cross compilation")
if package:version():ge("2.1.6") and package:is_arch("i386") and package:is_cross() then
assert(false, "package(zlib-ng/i386 >= 2.1.6): Unsupported cross compilation")
end
end)
end

on_load(function (package)
if package:version():eq("2.1.5") then
if package:is_plat("android") or package:is_arch("arm.*") then
raise("zlib-ng 2.1.5 not support android and arm.")
on_check("android", function (package)
if package:version():ge("2.1.5") and package:is_arch("arm.*") then
assert(false, "package(zlib-ng/android >= 2.1.5): Unsupported android and arm")
end
end
end)
end)
end

on_install("windows", "macosx", "linux", "android", "mingw", function (package)
local configs = {
"-DZLIB_COMPAT=ON",
"-DZLIB_ENABLE_TESTS=OFF",
"-DZLIBNG_ENABLE_TESTS=OFF",
"-DWITH_GTEST=OFF",
Expand All @@ -52,9 +51,14 @@ package("zlib-ng")
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DINC_INSTALL_DIR=" .. package:installdir("include"))
table.insert(configs, "-DLIB_INSTALL_DIR=" .. package:installdir("lib"))
table.insert(configs, "-DZLIB_COMPAT=" .. (package:config("zlib_compat") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)

on_test(function (package)
assert(package:has_cfuncs("inflate", {includes = "zlib.h"}))
if package:config("zlib_compat") then
assert(package:has_cfuncs("inflate", {includes = "zlib.h"}))
else
assert(package:has_cfuncs("zng_inflate", {includes = "zlib-ng.h"}))
end
end)
Loading