Skip to content

Commit

Permalink
libplist: add 2.6.0 version
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing committed Oct 16, 2024
1 parent 88a84bb commit 4f9711b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
20 changes: 20 additions & 0 deletions packages/l/libplist/port/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
option("version", {default = "2.6.0"})

add_rules("mode.debug", "mode.release")

if not is_plat("windows") then
add_defines("HAVE_STRNDUP")
end

if has_config("version") then
add_defines("PACKAGE_VERSION=\"" .. get_config("version") .. "\"")
end

target("plist")
set_kind("$(kind)")
add_files("libcnary/*.c", "src/*.c")
add_includedirs("src", "include", "libcnary/include")
add_headerfiles("include/(plist/*.h)")
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end
53 changes: 38 additions & 15 deletions packages/l/libplist/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,31 +1,54 @@
package("libplist")

set_homepage("https://www.libimobiledevice.org/")
set_description("Library for Apple Binary- and XML-Property Lists")
set_license("LGPL-2.1")

set_urls("https://github.com/libimobiledevice/libplist/archive/$(version).tar.gz",
"https://github.com/libimobiledevice/libplist.git")
add_versions("2.2.0", "7e654bdd5d8b96f03240227ed09057377f06ebad08e1c37d0cfa2abe6ba0cee2")

add_deps("autoconf", "automake", "libtool", "pkg-config")
add_versions("2.6.0", "e6491c2fa3370e556ac41b8705dd7f8f0e772c8f78641c3878cabd45bd84d950")
add_versions("2.2.0", "7e654bdd5d8b96f03240227ed09057377f06ebad08e1c37d0cfa2abe6ba0cee2")

if is_plat("linux") then
if is_plat("linux", "bsd") then
add_syslinks("pthread")
end

on_install("macosx", "linux", "mingw@macosx", "iphoneos", "cross", function (package)
local configs = {"--disable-dependency-tracking",
"--disable-silent-rules",
"--without-cython"}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
local cxflags
if package:is_plat("linux") and package:config("pic") ~= false then
cxflags = "-fPIC"
if on_check then
on_check(function (package)
if package:is_plat("windows") and package:has_tool("cxx", "cl") then
raise("package(libplist) unsupported msvc toolchain, you use clang toolchain")
end
end)
end

on_install(function (package)
local version = package:version()

if is_subhost("windows") or package:is_plat("windows", "android", "wasm") then
local configs = {}
if version then
configs.version = version
end
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package, configs)
else
if version and version:eq("2.2.0") then
io.replace("src/plist.c", "void thread_once", "static void thread_once")
end

local configs = {
"--disable-dependency-tracking",
"--disable-silent-rules",
"--without-cython",
}
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 version then
table.insert(configs, "PACKAGE_VERSION=" .. version)
end
import("package.tools.autoconf").install(package, configs)
end
io.replace("src/plist.c", "void thread_once", "static void thread_once")
import("package.tools.autoconf").install(package, configs, {cxflags = cxflags})
end)

on_test(function (package)
Expand Down

0 comments on commit 4f9711b

Please sign in to comment.