* add zip

* port zip

* improve check

* improve check

* fix zip for windows
pull/4239/head
ruki 6 months ago committed by GitHub
parent 96eeba9726
commit e3022640e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/u/unzip/xmake.lua
  2. 46
      packages/z/zip/xmake.lua

@ -12,7 +12,7 @@ package("unzip")
io.replace("win32/nt.c", "#include \"../unzip.h\"", "#include \"../unzip.h\"\n#ifdef CR\n#undef CR\n#endif", {plain = true})
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
includes("check_cfuncs.lua")
includes("@builtin/check")
check_cfuncs("HAVE_LCHMOD", "lchmod", {includes = "sys/stat.h"})
target("unzip")
set_kind("binary")

@ -0,0 +1,46 @@
package("zip")
set_kind("binary")
set_homepage("http://www.info-zip.org/Zip.html")
set_description("Info-ZIP zip utility")
add_urls("https://github.com/LuaDist/zip.git")
add_versions("3.0", "f6cfe48f6bc5bf2d505a0e0eb265ce4cb238db89")
add_deps("cmake")
on_install("@windows", "@macosx", "@linux", function (package)
io.replace("zip.h", "#define __zip_h 1", [[#define __zip_h 1
#if defined(WIN32) || defined(WINDLL)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
]], {plain = true})
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
includes("@builtin/check")
check_cfuncs("HAVE_LCHMOD", "lchmod", {includes = "sys/stat.h"})
target("zip")
set_kind("binary")
if not has_config("__HAVE_LCHMOD") then
add_defines("NO_LCHMOD")
end
add_files("crc32.c", "crypt.c", "deflate.c",
"fileio.c", "globals.c", "trees.c", "ttyio.c", "util.c",
"zip.c", "zipfile.c", "zipup.c")
if is_plat("windows") then
add_files("win32/*.c")
add_syslinks("user32", "advapi32")
add_defines("WIN32", "NO_ASM")
else
add_files("unix/unix.c")
add_defines("UNIX", "NO_OFF_T")
end
add_includedirs(".")
]])
import("package.tools.xmake").install(package)
end)
on_test(function (package)
os.vrun("zip --help")
end)
Loading…
Cancel
Save