From d2d5e1e1a7f02ddf85b9a083201695c99174b335 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 10 Apr 2021 20:56:27 +0800 Subject: [PATCH] add libmagic --- packages/l/libmagic/xmake.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/l/libmagic/xmake.lua diff --git a/packages/l/libmagic/xmake.lua b/packages/l/libmagic/xmake.lua new file mode 100644 index 000000000..cbbe362e2 --- /dev/null +++ b/packages/l/libmagic/xmake.lua @@ -0,0 +1,31 @@ +package("libmagic") + + set_homepage("https://www.darwinsys.com/file/") + set_description("Implementation of the file(1) command") + + add_urls("https://astron.com/pub/file/file-$(version).tar.gz") + add_versions("5.40", "167321f43c148a553f68a0ea7f579821ef3b11c27b8cbe158e4df897e4a5dd57") + + if is_plat("linux", "bsd") then + add_deps("zlib") + end + + on_install("macosx", "linux", "bsd", function (package) + local configs = {"--disable-dependency-tracking", + "--disable-silent-rules", + "--disable-xzlib", + "--disable-bzlib"} + table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) + table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) + if package:debug() then + table.insert(configs, "--enable-debug") + end + if package:config("pic") ~= false then + table.insert(configs, "--with-pic") + end + import("package.tools.autoconf").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("magic_open", {includes = "magic.h"})) + end)