|
| 1 | +package("freexl") |
| 2 | + set_homepage("https://www.gaia-gis.it/fossil/freexl/index") |
| 3 | + set_description("FreeXL is an open source library to extract valid data from within an Excel (.xls) spreadsheet.") |
| 4 | + set_license("MPL-1.0") |
| 5 | + |
| 6 | + add_urls("https://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-$(version).tar.gz") |
| 7 | + |
| 8 | + add_versions("2.0.0", "176705f1de58ab7c1eebbf5c6de46ab76fcd8b856508dbd28f5648f7c6e1a7f0") |
| 9 | + |
| 10 | + add_deps("libiconv", "expat", "minizip") |
| 11 | + |
| 12 | + if is_plat("linux", "bsd") then |
| 13 | + add_syslinks("m") |
| 14 | + end |
| 15 | + |
| 16 | + if on_check then |
| 17 | + on_check("android", function (package) |
| 18 | + local ndk = package:toolchain("ndk") |
| 19 | + local ndk_sdkver = ndk:config("ndk_sdkver") |
| 20 | + assert(ndk_sdkver and tonumber(ndk_sdkver) >= 23, "package(freexl) dep(minizip) require ndk api level >= 23") |
| 21 | + end) |
| 22 | + end |
| 23 | + |
| 24 | + on_install(function (package) |
| 25 | + if package:is_plat("windows") and package:config("shared") then |
| 26 | + io.replace("headers/freexl.h", "#define FREEXL_DECLARE extern", "#define FREEXL_DECLARE __declspec(dllimport)", {plain = true}) |
| 27 | + end |
| 28 | + if not package:is_plat("windows") then |
| 29 | + os.touch("src/config.h") |
| 30 | + end |
| 31 | + io.writefile("xmake.lua", string.format([[ |
| 32 | + option("ver", {default = "%s"}) |
| 33 | + add_rules("mode.debug", "mode.release") |
| 34 | + add_requires("libiconv", "expat", "minizip") |
| 35 | + target("freexl") |
| 36 | + set_kind("$(kind)") |
| 37 | + add_files("src/*.c") |
| 38 | + add_includedirs(".", "headers") |
| 39 | + add_headerfiles("headers/freexl.h") |
| 40 | + if is_kind("shared") and is_plat("windows") then |
| 41 | + add_defines("DLL_EXPORT") |
| 42 | + end |
| 43 | + if is_plat("linux", "bsd") then |
| 44 | + add_syslinks("m") |
| 45 | + end |
| 46 | + add_packages("libiconv", "expat", "minizip") |
| 47 | + if has_config("ver") then |
| 48 | + add_defines("VERSION=\"" .. get_config("ver") .. "\"") |
| 49 | + set_version(get_config("ver"), {soname = true}) |
| 50 | + end |
| 51 | + ]], package:version_str())) |
| 52 | + import("package.tools.xmake").install(package) |
| 53 | + end) |
| 54 | + |
| 55 | + on_test(function (package) |
| 56 | + assert(package:has_cfuncs("freexl_open", {includes = "freexl.h"})) |
| 57 | + end) |
0 commit comments