Skip to content

Commit

Permalink
libplist: add 2.6.0 version (#5513)
Browse files Browse the repository at this point in the history
* libplist: add 2.6.0 version

* autotools: add package

* autotools: fix install

* fix symbol macro

* remove main files

* improve xmake.lua
  • Loading branch information
star-hengxing authored Oct 16, 2024
1 parent 355ff95 commit e5da705
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 15 deletions.
11 changes: 11 additions & 0 deletions packages/a/autotools/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package("autotools")
set_kind("binary")

if is_subhost("msys") then
add_deps("pacman::autotools")
else
add_deps("autoconf", "automake", "libtool")
end

on_install("@linux", "@macosx", "@bsd", "@msys", function (package)
end)
23 changes: 23 additions & 0 deletions packages/l/libplist/port/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
option("version", {default = "2.6.0"})

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

if not is_plat("windows", "mingw", "msys") then
add_defines("HAVE_STRNDUP")
end

local version = get_config("version")
if version then
set_version(version, {soname = true})
add_defines("PACKAGE_VERSION=\"" .. version .. "\"")
end

target("plist")
set_kind("$(kind)")
add_files("libcnary/*.c|cnary.c", "src/*.c")
add_includedirs("src", "include", "libcnary/include")
add_headerfiles("include/(plist/*.h)")

if is_kind("static") then
add_defines("LIBPLIST_STATIC")
end
67 changes: 52 additions & 15 deletions packages/l/libplist/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,31 +1,68 @@
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",
set_urls("https://github.com/libimobiledevice/libplist/archive/refs/tags/$(version).tar.gz",
"https://github.com/libimobiledevice/libplist.git")

add_versions("2.6.0", "e6491c2fa3370e556ac41b8705dd7f8f0e772c8f78641c3878cabd45bd84d950")
add_versions("2.2.0", "7e654bdd5d8b96f03240227ed09057377f06ebad08e1c37d0cfa2abe6ba0cee2")

add_deps("autoconf", "automake", "libtool", "pkg-config")
if is_plat("wasm") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end

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 now, you can use clang toolchain\nadd_requires(\"libplist\", {configs = {toolchains = \"clang-cl\"}}))")
end
end)
end

on_load(function (package)
if not (is_subhost("windows") or package:is_plat("windows", "android", "wasm")) then
package:add("deps", "autotools")
end

if not package:config("shared") then
package:add("defines", "LIBPLIST_STATIC")
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 e5da705

Please sign in to comment.