From df6cad5cf5701de3705c7afce54d732e1f5b14b9 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 19 Aug 2021 17:41:44 +0800 Subject: [PATCH] add and improve acl, attr and rsync (#577) * update pkgconf * add attr * add acl * resolve conflict between lz4 and zstd * add rsync * update linux-headers * allow xxhash to be build on all platforms * improve acl and attr Co-authored-by: xq114 <1140735506@qq.com> --- packages/a/acl/xmake.lua | 40 ++++++++++++++++++++++++++++++ packages/a/attr/xmake.lua | 23 +++++++++++++++++ packages/l/linux-headers/xmake.lua | 3 +++ packages/l/lz4/xmake.lua | 6 ++++- packages/p/pkgconf/xmake.lua | 9 ++----- packages/r/rsync/xmake.lua | 35 ++++++++++++++++++++++++++ packages/x/xxhash/xmake.lua | 4 +-- packages/z/zstd/xmake.lua | 7 +++++- 8 files changed, 116 insertions(+), 11 deletions(-) create mode 100644 packages/a/acl/xmake.lua create mode 100644 packages/a/attr/xmake.lua create mode 100644 packages/r/rsync/xmake.lua diff --git a/packages/a/acl/xmake.lua b/packages/a/acl/xmake.lua new file mode 100644 index 000000000..0a76a8c9d --- /dev/null +++ b/packages/a/acl/xmake.lua @@ -0,0 +1,40 @@ +package("acl") + + set_homepage("http://savannah.nongnu.org/projects/acl/") + set_description("Commands for Manipulating POSIX Access Control Lists") + set_license("GPL-2.0") + + add_urls("http://download.savannah.nongnu.org/releases/acl/acl-$(version).tar.gz") + add_versions("2.3.1", "760c61c68901b37fdd5eefeeaf4c0c7a26bdfdd8ac747a1edff1ce0e243c11af") + + add_deps("pkgconf", "attr") + + on_install("linux", function (package) + local configs = {} + 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:config("pic") ~= false then + table.insert(configs, "--with-pic") + end + local cflags = {} + local ldflags = {} + for _, dep in ipairs(package:orderdeps()) do + local fetchinfo = dep:fetch() + if fetchinfo then + for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do + table.insert(cflags, "-I" .. includedir) + end + for _, linkdir in ipairs(fetchinfo.linkdirs) do + table.insert(ldflags, "-L" .. linkdir) + end + for _, link in ipairs(fetchinfo.links) do + table.insert(ldflags, "-l" .. link) + end + end + end + import("package.tools.autoconf").install(package, configs, {cflags = cflags, ldflags = ldflags}) + end) + + on_test(function (package) + assert(package:has_cfuncs("acl_check", {includes = "acl/libacl.h"})) + end) diff --git a/packages/a/attr/xmake.lua b/packages/a/attr/xmake.lua new file mode 100644 index 000000000..4bfb159ff --- /dev/null +++ b/packages/a/attr/xmake.lua @@ -0,0 +1,23 @@ +package("attr") + + set_homepage("https://savannah.nongnu.org/projects/attr") + set_description("Commands for Manipulating Filesystem Extended Attributes") + set_license("GPL-2.0") + + add_urls("http://download.savannah.nongnu.org/releases/attr/attr-$(version).tar.gz") + add_versions("2.5.1", "bae1c6949b258a0d68001367ce0c741cebdacdd3b62965d17e5eb23cd78adaf8") + + on_install("linux", function (package) + local configs = {} + 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:config("pic") ~= false then + table.insert(configs, "--with-pic") + end + import("package.tools.autoconf").install(package) + print(os.files(package:installdir("**"))) + end) + + on_test(function (package) + assert(package:has_cfuncs("attr_copy_file", {includes = "attr/libattr.h"})) + end) diff --git a/packages/l/linux-headers/xmake.lua b/packages/l/linux-headers/xmake.lua index 27589412a..47cb9d737 100644 --- a/packages/l/linux-headers/xmake.lua +++ b/packages/l/linux-headers/xmake.lua @@ -12,6 +12,9 @@ package("linux-headers") add_versions("4.20.9", "b5de28fd594a01edacd06e53491ad0890293e5fbf98329346426cf6030ef1ea6") add_versions("5.0.8", "11908044e8cce1e093141f8da594708d45d05d0381676ae9aa3d8aeaf7c85435") add_versions("5.9.16", "b0d7abae88e5f91893627c645e680a95c818defd1b4fcaf3e2afb4b2b6b4ab86") + add_versions("5.10.46", "569122a39c6b325befb9ac1c07da0c53e6363b3baacd82081d131b06c1dc1415") + + add_deps("rsync") on_install("@linux", function (package) os.vrunv("make", {"headers_install", "INSTALL_HDR_PATH=" .. package:installdir()}) diff --git a/packages/l/lz4/xmake.lua b/packages/l/lz4/xmake.lua index 957cd2a0c..db0aaf83b 100644 --- a/packages/l/lz4/xmake.lua +++ b/packages/l/lz4/xmake.lua @@ -7,6 +7,8 @@ package("lz4") "https://github.com/lz4/lz4.git") add_versions("v1.9.3", "030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1") + add_deps("xxhash") + on_load("windows", function (package) if package:config("shared") then package:add("defines", "LZ4_DLL_IMPORT") @@ -16,10 +18,12 @@ package("lz4") on_install(function (package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") + add_requires("xxhash") target("lz4") set_kind("$(kind)") - add_files("lib/*.c") + add_files("lib/*.c|xxhash.c") add_headerfiles("lib/lz4.h", "lib/lz4hc.h", "lib/lz4frame.h") + add_packages("xxhash") if is_kind("shared") and is_plat("windows") then add_defines("LZ4_DLL_EXPORT") end diff --git a/packages/p/pkgconf/xmake.lua b/packages/p/pkgconf/xmake.lua index 2d4ff6a71..322d57181 100644 --- a/packages/p/pkgconf/xmake.lua +++ b/packages/p/pkgconf/xmake.lua @@ -5,19 +5,14 @@ package("pkgconf") add_urls("https://distfiles.dereferenced.org/pkgconf/pkgconf-$(version).tar.xz") add_versions("1.7.4", "d73f32c248a4591139a6b17777c80d4deab6b414ec2b3d21d0a24be348c476ab") + add_versions("1.8.0", "ef9c7e61822b7cb8356e6e9e1dca58d9556f3200d78acab35e4347e9d4c2bbaf") if is_plat("windows") then add_deps("meson", "ninja") end on_install("linux", "bsd", function(package) - local configs = {} - 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:config("pic") ~= false then - table.insert(configs, "--with-pic") - end - import("package.tools.autoconf").install(package, configs) + import("package.tools.autoconf").install(package) end) on_install("windows", function(package) diff --git a/packages/r/rsync/xmake.lua b/packages/r/rsync/xmake.lua new file mode 100644 index 000000000..8001c74e9 --- /dev/null +++ b/packages/r/rsync/xmake.lua @@ -0,0 +1,35 @@ +package("rsync") + + set_kind("binary") + set_homepage("https://rsync.samba.org/") + set_description("rsync is an open source utility that provides fast incremental file transfer.") + set_license("GPL-3.0") + + add_urls("https://download.samba.org/pub/rsync/src/rsync-$(version).tar.gz") + add_versions("3.2.3", "becc3c504ceea499f4167a260040ccf4d9f2ef9499ad5683c179a697146ce50e") + + add_deps("openssl", "xxhash", "lz4", "acl", "zstd", {host = true}) + + on_install("linux", function (package) + local cxflags = {} + local ldflags = {} + for _, dep in ipairs(package:orderdeps()) do + local fetchinfo = dep:fetch() + if fetchinfo then + for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do + table.insert(cxflags, "-I" .. includedir) + end + for _, linkdir in ipairs(fetchinfo.linkdirs) do + table.insert(ldflags, "-L" .. linkdir) + end + for _, link in ipairs(fetchinfo.links) do + table.insert(ldflags, "-l" .. link) + end + end + end + import("package.tools.autoconf").install(package, configs, {cxflags = cxflags, ldflags = ldflags}) + end) + + on_test(function (package) + os.vrun("rsync --version") + end) diff --git a/packages/x/xxhash/xmake.lua b/packages/x/xxhash/xmake.lua index 5cd0f3510..896408826 100644 --- a/packages/x/xxhash/xmake.lua +++ b/packages/x/xxhash/xmake.lua @@ -4,13 +4,13 @@ package("xxhash") set_description("xxHash is an extremely fast non-cryptographic hash algorithm, working at RAM speed limit.") set_license("BSD-2-Clause") - add_urls("https://github.com/Cyan4973/xxHash/archive/refs/tags/v0.8.0.tar.gz", + add_urls("https://github.com/Cyan4973/xxHash/archive/refs/tags/$(version).tar.gz", "https://github.com/Cyan4973/xxHash.git") add_versions("v0.8.0", "7054c3ebd169c97b64a92d7b994ab63c70dd53a06974f1f630ab782c28db0f4f") add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) - on_install("windows", "macosx", "linux", function (package) + on_install(function (package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") target("xxhash") diff --git a/packages/z/zstd/xmake.lua b/packages/z/zstd/xmake.lua index 719c4791c..949997d4b 100644 --- a/packages/z/zstd/xmake.lua +++ b/packages/z/zstd/xmake.lua @@ -6,15 +6,20 @@ package("zstd") set_urls("https://github.com/facebook/zstd/archive/$(version).tar.gz", "https://github.com/facebook/zstd.git") add_versions("v1.4.5", "734d1f565c42f691f8420c8d06783ad818060fc390dee43ae0a89f86d0a4f8c2") + add_versions("v1.5.0", "0d9ade222c64e912d6957b11c923e214e2e010a18f39bec102f572e693ba2867") + + add_deps("xxhash") on_install(function (package) io.writefile("xmake.lua", [[ add_rules("mode.debug", "mode.release") + add_requires("xxhash") target("zstd") set_kind("$(kind)") - add_files("lib/common/*.c") + add_files("lib/common/*.c|xxhash.c") add_files("lib/compress/*.c") add_files("lib/decompress/*.c") + add_packages("xxhash") add_headerfiles("lib/zstd.h") if is_kind("shared") and is_plat("windows") then add_defines("ZSTD_DLL_EXPORT")