|
@@ -5,31 +5,32 @@ package("bzip2")
|
|
|
|
|
|
add_urls("https://sourceware.org/pub/bzip2/bzip2-$(version).tar.gz")
|
|
|
add_versions("1.0.8", "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269")
|
|
|
+ add_patches("1.0.8", path.join(os.scriptdir(), "patches", "dllexport.patch"), "f72679b2ad55262bbc9da49f352f6cf128db85047aaa04ca42126c839b709461")
|
|
|
|
|
|
- on_load("windows", function (package)
|
|
|
- package:add("links", "libbz2")
|
|
|
- end)
|
|
|
-
|
|
|
- on_install("windows", function (package)
|
|
|
+ on_load(function (package)
|
|
|
package:addenv("PATH", "bin")
|
|
|
- io.gsub("makefile.msc", "%-MD", "-" .. package:config("vs_runtime"))
|
|
|
- import("package.tools.nmake").build(package, {"-f", "makefile.msc", "bzip2"})
|
|
|
- os.cp("libbz2.lib", package:installdir("lib"))
|
|
|
- os.cp("*.h", package:installdir("include"))
|
|
|
- os.cp("*.exe", package:installdir("bin"))
|
|
|
+
|
|
|
+ if not package:config("shared") then
|
|
|
+ package:add("defines", "BZ_STATIC")
|
|
|
+ end
|
|
|
end)
|
|
|
|
|
|
- on_install("macosx", "linux", function (package)
|
|
|
- package:addenv("PATH", "bin")
|
|
|
+ on_install(function (package)
|
|
|
local configs = {}
|
|
|
- if package:config("pic") ~= false then
|
|
|
- table.insert(configs, "CFLAGS=-fPIC")
|
|
|
- end
|
|
|
- io.gsub("Makefile", "PREFIX=.-\n", "PREFIX=" .. package:installdir() .. "\n")
|
|
|
- import("package.tools.make").install(package, configs)
|
|
|
+ configs.kind = package:config("shared") and "shared" or "static"
|
|
|
+ configs.mode = package:debug() and "debug" or "release"
|
|
|
+ configs.build_bin = not package:is_plat("cross", "iphoneos", "android")
|
|
|
+
|
|
|
+ os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
|
|
|
+ import("package.tools.xmake").install(package, configs)
|
|
|
end)
|
|
|
|
|
|
on_test(function (package)
|
|
|
- os.vrun("bzip2 --help")
|
|
|
+ if not package:is_plat("cross", "iphoneos", "android") then
|
|
|
+ os.vrun("bunzip2 --help")
|
|
|
+ os.vrun("bzcat --help")
|
|
|
+ os.vrun("bzip2 --help")
|
|
|
+ end
|
|
|
+
|
|
|
assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
|
|
|
end)
|