|
| 1 | +package("unzip") |
| 2 | + |
| 3 | + set_kind("binary") |
| 4 | + set_homepage("http://infozip.sourceforge.net/UnZip.html") |
| 5 | + set_description("UnZip is an extraction utility for archives compressed in .zip format.") |
| 6 | + |
| 7 | + add_urls("https://github.com/LuaDist/unzip/archive/refs/tags/$(version).zip") |
| 8 | + add_versions("6.0", "44d392d0087f658e4955389c42cac41c02facfac134b9c64d3ac82fb20ea92a7") |
| 9 | + |
| 10 | + on_install("@windows", "@macosx", "@linux", function (package) |
| 11 | + io.replace("win32/win32.c", "#include \"../unzip.h\"", "#include \"../unzip.h\"\n#ifdef CR\n#undef CR\n#endif", {plain = true}) |
| 12 | + io.replace("win32/nt.c", "#include \"../unzip.h\"", "#include \"../unzip.h\"\n#ifdef CR\n#undef CR\n#endif", {plain = true}) |
| 13 | + io.writefile("xmake.lua", [[ |
| 14 | + add_rules("mode.debug", "mode.release") |
| 15 | + includes("check_cfuncs.lua") |
| 16 | + check_cfuncs("HAVE_LCHMOD", "lchmod", {includes = "sys/stat.h"}) |
| 17 | + target("unzip") |
| 18 | + set_kind("binary") |
| 19 | + if not has_config("__HAVE_LCHMOD") then |
| 20 | + add_defines("NO_LCHMOD") |
| 21 | + end |
| 22 | + add_files("crc32.c", "crypt.c", "envargs.c", "explode.c", "extract.c") |
| 23 | + add_files("fileio.c", "globals.c", "inflate.c", "list.c", "match.c", "process.c") |
| 24 | + add_files("ttyio.c", "ubz2err.c", "unreduce.c", "unshrink.c", "unzip.c", "zipinfo.c") |
| 25 | + if is_plat("windows") then |
| 26 | + add_files("win32/*.c", "win32/winapp.rc") |
| 27 | + add_syslinks("user32", "advapi32") |
| 28 | + else |
| 29 | + add_files("unix/unix.c") |
| 30 | + add_defines("UNIX") |
| 31 | + end |
| 32 | + add_includedirs(".") |
| 33 | + ]]) |
| 34 | + import("package.tools.xmake").install(package) |
| 35 | + end) |
| 36 | + |
| 37 | + on_test(function (package) |
| 38 | + os.vrun("unzip --help") |
| 39 | + end) |
0 commit comments