From 76d2eb059c1dfb40ae56c5d063a3dc7f7a98cf56 Mon Sep 17 00:00:00 2001 From: hahahahbenny <1292983376@qq.com> Date: Sun, 27 Oct 2024 01:08:17 +0800 Subject: [PATCH 01/16] add libcanberra repo --- packages/a/alsa-lib/xmake.lua | 2 +- packages/l/libcanberra/xmake.lua | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 packages/l/libcanberra/xmake.lua diff --git a/packages/a/alsa-lib/xmake.lua b/packages/a/alsa-lib/xmake.lua index b879a43591d..8837abef531 100644 --- a/packages/a/alsa-lib/xmake.lua +++ b/packages/a/alsa-lib/xmake.lua @@ -11,7 +11,7 @@ package("alsa-lib") add_configs("versioned", {description = "pass flag --without-versioned", default = true, type = "boolean"}) if is_plat("linux") then - add_syslinks("pthread") + add_syslinks("pthread", "dl") add_extsources("pacman::alsa-lib", "apt::libasound2-dev") end diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua new file mode 100644 index 00000000000..b268890abcf --- /dev/null +++ b/packages/l/libcanberra/xmake.lua @@ -0,0 +1,40 @@ +package("libcanberra") + + set_homepage("https://0pointer.de/lennart/projects/libcanberra/") + set_description("libcanberra is an implementation of the XDG Sound Theme and Name Specifications") + set_license("LGPL-2.1") + + add_urls("http://0pointer.de/lennart/projects/libcanberra/libcanberra-$(version).tar.xz") + add_versions("0.30", "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72") + + add_deps("autoconf", "automake", "libtool", "m4") + add_deps("libvorbis", "libogg", "alsa-lib") + + if is_plat("linux") then + add_syslinks("dl", "ltdl") + end + + add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi") + + add_linkdirs("lib", "lib/libcanberra-0.30") + + on_install("linux", function (package) + local fetchinfo = package:dep("libtool"):fetch() + local configs = {"--disable-dependency-tracking", "--disable-lynx"} + table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) + table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) + table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) + table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib/") + table.insert(configs, "LIBLTDL=" .. "-llibltdl") + + local pos = string.find(fetchinfo.artifacts.installdir, "libtool") + local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7) + local libtool_libdir = "../../../l/libtool" .. after_libtool .. "/lib" + print(libtool_libdir) + package:add("linkdirs", libtool_libdir) + import("package.tools.autoconf").install(package, configs, {packdeps = {"libtool"}}) + end) + + on_test(function (package) + assert(package:has_cfuncs("ca_context_create", {includes = "canberra.h"})) + end) From 4723e3ec5358d548149fbf03480373dfc2fae750 Mon Sep 17 00:00:00 2001 From: Arthur Laurent Date: Sun, 27 Oct 2024 02:40:19 +0100 Subject: [PATCH 02/16] Add magic enum module support (#5587) * [magic_enum] add C++ module support * [magic_enum] fix v0.9.6 sha256 --- packages/m/magic_enum/xmake.lua | 66 +++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/packages/m/magic_enum/xmake.lua b/packages/m/magic_enum/xmake.lua index 72e76dd8e57..5c8b415c86a 100644 --- a/packages/m/magic_enum/xmake.lua +++ b/packages/m/magic_enum/xmake.lua @@ -13,26 +13,62 @@ package("magic_enum") add_versions("v0.8.2", "62bd7034bbbfc3d7806001767d5775ab42f3ff33bb38366e1ceb21102f0dff9a") add_versions("v0.9.0", "2fb2f602b4660f8af539ee00958132a397e138bda19aa1ceae546de3a143386b") add_versions("v0.9.5", "44ad80db5a72f5047e01d90e18315751d9ac90c0ab42cbea7a6f9ec66a4cd679") - add_versions("v0.9.6", "814791ff32218dc869845af7eb89f898ebbcfa18e8d81aa4d682d18961e13731") + add_versions("v0.9.6", "fcda8295256a2084f1f98a63b3d2c66b3d7140eea008e1ef94ea015b2f6d3034") + + add_configs("modules", {description = "Build with C++20 modules support.", default = false, type = "boolean"}) add_deps("cmake") on_install(function (package) - local configs = { - "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF", - "-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF", - "-DMAGIC_ENUM_OPT_INSTALL=ON" - } - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) - import("package.tools.cmake").install(package, configs) + if package:version():lt("v0.9.6") or not package:config("modules") then + local configs = { + "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF", + "-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF", + "-DMAGIC_ENUM_OPT_INSTALL=ON" + } + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + import("package.tools.cmake").install(package, configs) + else + if package:version():eq("v0.9.6") then + io.writefile("xmake.lua", [[ + target("magic_enum") + set_kind("moduleonly") + set_languages("c++20") + add_headerfiles("include/magic_enum/**.hpp") + add_includedirs("include/magic_enum") + add_files("module/**.cppm", {public = true}) + ]]) + else + -- after v0.9.6 include files need to be prepended with magic_enum directory + io.writefile("xmake.lua", [[ + target("magic_enum") + set_kind("moduleonly") + set_languages("c++20") + add_headerfiles("include/(magic_enum/**.hpp)") + add_includedirs("include") + add_files("module/**.cppm", {public = true}) + ]]) + end + import("package.tools.xmake").install(package) + end end) on_test(function (package) - assert(package:check_cxxsnippets({test = [[ - enum class Color { RED = 2, BLUE = 4, GREEN = 8 }; - void test() { - Color color = Color::RED; - auto color_name = magic_enum::enum_name(color); - } - ]]}, {configs = {languages = "c++17"}, includes = "magic_enum.hpp"})) + if package:version():le("v0.9.6") then + assert(package:check_cxxsnippets({test = [[ + enum class Color { RED = 2, BLUE = 4, GREEN = 8 }; + void test() { + Color color = Color::RED; + auto color_name = magic_enum::enum_name(color); + } + ]]}, {configs = {languages = "c++17"}, includes = "magic_enum.hpp"})) + else + assert(package:check_cxxsnippets({test = [[ + enum class Color { RED = 2, BLUE = 4, GREEN = 8 }; + void test() { + Color color = Color::RED; + auto color_name = magic_enum::enum_name(color); + } + ]]}, {configs = {languages = "c++17"}, includes = "magic_enum/magic_enum.hpp"})) + end end) From 08512ac4b8b09a6f1f9a685c308445ab54158e0e Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 16:15:10 +0800 Subject: [PATCH 03/16] add vorbis and ogg to packagedeps --- packages/l/libcanberra/xmake.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index b268890abcf..c99df8dfbb8 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -25,6 +25,7 @@ package("libcanberra") table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib/") + table.insert(configs, "CPPFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include/") table.insert(configs, "LIBLTDL=" .. "-llibltdl") local pos = string.find(fetchinfo.artifacts.installdir, "libtool") @@ -32,7 +33,7 @@ package("libcanberra") local libtool_libdir = "../../../l/libtool" .. after_libtool .. "/lib" print(libtool_libdir) package:add("linkdirs", libtool_libdir) - import("package.tools.autoconf").install(package, configs, {packdeps = {"libtool"}}) + import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis", "libogg"}}) end) on_test(function (package) From 49681823bc54333ff206e067f460a99071eecd6e Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 17:06:05 +0800 Subject: [PATCH 04/16] add libvorbis shared deps --- packages/l/libcanberra/xmake.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index c99df8dfbb8..0d6fd066844 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -8,7 +8,10 @@ package("libcanberra") add_versions("0.30", "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72") add_deps("autoconf", "automake", "libtool", "m4") - add_deps("libvorbis", "libogg", "alsa-lib") + add_deps("libogg", "alsa-lib") + + + add_deps("libvorbis", {configs = {shared=true}}) if is_plat("linux") then add_syslinks("dl", "ltdl") @@ -20,11 +23,17 @@ package("libcanberra") on_install("linux", function (package) local fetchinfo = package:dep("libtool"):fetch() + + if package:config("shared") then + package:add("deps", "libvorbis", {configs = {shared=true}}) + else + package:add("deps", "libvorbis") + end local configs = {"--disable-dependency-tracking", "--disable-lynx"} table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) - table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib/") + table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib") table.insert(configs, "CPPFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include/") table.insert(configs, "LIBLTDL=" .. "-llibltdl") @@ -33,7 +42,7 @@ package("libcanberra") local libtool_libdir = "../../../l/libtool" .. after_libtool .. "/lib" print(libtool_libdir) package:add("linkdirs", libtool_libdir) - import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis", "libogg"}}) + import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) end) on_test(function (package) From fc7c9c17044b3e2a6eef4b0b1b571a9f023bf1e4 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 20:17:15 +0800 Subject: [PATCH 05/16] add ltdl includedir --- packages/l/libcanberra/xmake.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 0d6fd066844..469a82e1db9 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -42,6 +42,7 @@ package("libcanberra") local libtool_libdir = "../../../l/libtool" .. after_libtool .. "/lib" print(libtool_libdir) package:add("linkdirs", libtool_libdir) + package:add("includedirs", fetchinfo.artifacts.installdir .. "/include/") import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) end) From 52ad99a1eda9f1a857272a405a89abe003ee4fa9 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 20:52:30 +0800 Subject: [PATCH 06/16] change includedir --- packages/l/libcanberra/xmake.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 469a82e1db9..ba8c9a6341b 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -21,6 +21,8 @@ package("libcanberra") add_linkdirs("lib", "lib/libcanberra-0.30") + add_includedirs("include") + on_install("linux", function (package) local fetchinfo = package:dep("libtool"):fetch() @@ -39,10 +41,10 @@ package("libcanberra") local pos = string.find(fetchinfo.artifacts.installdir, "libtool") local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7) - local libtool_libdir = "../../../l/libtool" .. after_libtool .. "/lib" + local libtool_dir = "../../../libtool" .. after_libtool print(libtool_libdir) - package:add("linkdirs", libtool_libdir) - package:add("includedirs", fetchinfo.artifacts.installdir .. "/include/") + package:add("linkdirs", libtool_dir .. "lib/") + package:add("includedirs", libtool_dir .. "include/") import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) end) From bc82b02d5c684fe31aaf6c77a8c8f0fb705b9406 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 21:56:31 +0800 Subject: [PATCH 07/16] add libtool kind --- packages/l/libcanberra/xmake.lua | 10 +++++----- packages/l/libtool/xmake.lua | 9 ++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index ba8c9a6341b..89ccae2a151 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -7,17 +7,17 @@ package("libcanberra") add_urls("http://0pointer.de/lennart/projects/libcanberra/libcanberra-$(version).tar.xz") add_versions("0.30", "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72") - add_deps("autoconf", "automake", "libtool", "m4") + add_deps("libtool", {configs = {kind = library}}) + add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") - add_deps("libvorbis", {configs = {shared=true}}) if is_plat("linux") then add_syslinks("dl", "ltdl") end - add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi") + add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi", "ltdl") add_linkdirs("lib", "lib/libcanberra-0.30") @@ -43,8 +43,8 @@ package("libcanberra") local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7) local libtool_dir = "../../../libtool" .. after_libtool print(libtool_libdir) - package:add("linkdirs", libtool_dir .. "lib/") - package:add("includedirs", libtool_dir .. "include/") + package:add("linkdirs", libtool_dir .. "/lib/") + package:add("includedirs", libtool_dir .. "/include/") import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) end) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index c6009b61453..310f0fadc6f 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -1,5 +1,4 @@ package("libtool") - set_kind("binary") set_homepage("https://www.gnu.org/software/libtool/") set_description("A generic library support script.") @@ -11,6 +10,14 @@ package("libtool") add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") + on_load(function (package) + if package:configs("kind") == "library" then + package:set("kind", "library") + else + package:set("kind", "binary") + end + end) + if is_host("linux") then add_extsources("apt::libtool", "pacman::libtool") elseif is_host("macosx") then From c2f0cdca02b9fadaba2b42fca29d9a088bd37c25 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 22:20:20 +0800 Subject: [PATCH 08/16] change libtool configs --- packages/l/libcanberra/xmake.lua | 2 +- packages/l/libtool/xmake.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 89ccae2a151..04d89c6197f 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -7,7 +7,7 @@ package("libcanberra") add_urls("http://0pointer.de/lennart/projects/libcanberra/libcanberra-$(version).tar.xz") add_versions("0.30", "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72") - add_deps("libtool", {configs = {kind = library}}) + add_deps("libtool", {configs = {kind_libtool = library}}) add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index 310f0fadc6f..20c41daed28 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -10,8 +10,10 @@ package("libtool") add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") + add_configs("kind_libtool", {description = "choose a kind to build libtool", default = "binary", type = "string", values = {"binary", "library"}}) + on_load(function (package) - if package:configs("kind") == "library" then + if package:configs("kind_libtool") == "library" then package:set("kind", "library") else package:set("kind", "binary") From a396e3a17ef1a6798050513f9cba90f1f61eb5ec Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Sun, 27 Oct 2024 22:49:02 +0800 Subject: [PATCH 09/16] change kind --- packages/l/libcanberra/xmake.lua | 2 +- packages/l/libtool/xmake.lua | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 04d89c6197f..431cfd72cea 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -7,7 +7,7 @@ package("libcanberra") add_urls("http://0pointer.de/lennart/projects/libcanberra/libcanberra-$(version).tar.xz") add_versions("0.30", "c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72") - add_deps("libtool", {configs = {kind_libtool = library}}) + add_deps("libtool", {kind = "library"}) add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index 20c41daed28..3212aef7a56 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -10,10 +10,8 @@ package("libtool") add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") - add_configs("kind_libtool", {description = "choose a kind to build libtool", default = "binary", type = "string", values = {"binary", "library"}}) - on_load(function (package) - if package:configs("kind_libtool") == "library" then + if package:configs("kind") == "library" then package:set("kind", "library") else package:set("kind", "binary") @@ -38,4 +36,7 @@ package("libtool") on_test(function (package) os.vrun("libtool --version") + if package:kind() ~= "binary" then + assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"})) + end end) From 00c6c01132f59a095b9fd222c9d02d3e40202715 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Mon, 28 Oct 2024 00:43:44 +0800 Subject: [PATCH 10/16] change kind --- packages/l/libcanberra/xmake.lua | 6 +++--- packages/l/libtool/xmake.lua | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 431cfd72cea..370b4d06ec0 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -14,7 +14,7 @@ package("libcanberra") add_deps("libvorbis", {configs = {shared=true}}) if is_plat("linux") then - add_syslinks("dl", "ltdl") + add_syslinks("dl") end add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi", "ltdl") @@ -36,8 +36,8 @@ package("libcanberra") table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib") - table.insert(configs, "CPPFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include/") - table.insert(configs, "LIBLTDL=" .. "-llibltdl") + table.insert(configs, "CFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include") + table.insert(configs, "LIBS=" .. "-lltdl -ldl") local pos = string.find(fetchinfo.artifacts.installdir, "libtool") local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index 3212aef7a56..b10251d14a9 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -20,6 +20,7 @@ package("libtool") if is_host("linux") then add_extsources("apt::libtool", "pacman::libtool") + add_syslinks("dl") elseif is_host("macosx") then add_extsources("brew::libtool") end @@ -27,7 +28,10 @@ package("libtool") add_deps("autoconf") on_install("@macosx", "@linux", "@bsd", function (package) - import("package.tools.autoconf").install(package, {"--disable-dependency-tracking", "--enable-ltdl-install"}) + local configs = {"--disable-dependency-tracking", "--enable-ltdl-install"} + table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) + table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) + import("package.tools.autoconf").install(package, configs) if package:is_plat("macosx") then local bindir = package:installdir("bin") os.ln(path.join(bindir, "libtoolize"), path.join(bindir, "glibtoolize")) @@ -35,8 +39,9 @@ package("libtool") end) on_test(function (package) - os.vrun("libtool --version") if package:kind() ~= "binary" then assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"})) + else + os.vrun("libtool --version") end end) From aa41aaebaac931d1ddb68bba561b236ae08565a0 Mon Sep 17 00:00:00 2001 From: hahahahbenny <1292983376@qq.com> Date: Mon, 28 Oct 2024 10:33:29 +0800 Subject: [PATCH 11/16] delete the part of adding path manually --- packages/l/libcanberra/xmake.lua | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 370b4d06ec0..907e8236519 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -10,7 +10,6 @@ package("libcanberra") add_deps("libtool", {kind = "library"}) add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") - add_deps("libvorbis", {configs = {shared=true}}) if is_plat("linux") then @@ -24,8 +23,6 @@ package("libcanberra") add_includedirs("include") on_install("linux", function (package) - local fetchinfo = package:dep("libtool"):fetch() - if package:config("shared") then package:add("deps", "libvorbis", {configs = {shared=true}}) else @@ -35,17 +32,9 @@ package("libcanberra") table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) - table.insert(configs, "LDFLAGS=-L" .. fetchinfo.artifacts.installdir .. "/lib") - table.insert(configs, "CFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include") table.insert(configs, "LIBS=" .. "-lltdl -ldl") - local pos = string.find(fetchinfo.artifacts.installdir, "libtool") - local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7) - local libtool_dir = "../../../libtool" .. after_libtool - print(libtool_libdir) - package:add("linkdirs", libtool_dir .. "/lib/") - package:add("includedirs", libtool_dir .. "/include/") - import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) + import("package.tools.autoconf").install(package, configs, {packagedeps = {"libvorbis"}}) end) on_test(function (package) From c7217b389f5789a48457ab5f8253718908040111 Mon Sep 17 00:00:00 2001 From: hahahahbenny <1292983376@qq.com> Date: Mon, 28 Oct 2024 11:41:00 +0800 Subject: [PATCH 12/16] fix grammar pproblem --- packages/l/libcanberra/xmake.lua | 18 ++++++++++++++---- packages/l/libtool/xmake.lua | 4 +--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 907e8236519..c270b860da1 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -10,7 +10,7 @@ package("libcanberra") add_deps("libtool", {kind = "library"}) add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") - add_deps("libvorbis", {configs = {shared=true}}) + add_deps("libvorbis", {configs = {shared = true}}) if is_plat("linux") then add_syslinks("dl") @@ -23,8 +23,9 @@ package("libcanberra") add_includedirs("include") on_install("linux", function (package) + local fetchinfo = package:dep("libtool"):fetch() if package:config("shared") then - package:add("deps", "libvorbis", {configs = {shared=true}}) + package:add("deps", "libvorbis", {configs = {shared = true}}) else package:add("deps", "libvorbis") end @@ -32,9 +33,18 @@ package("libcanberra") table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) + if fetchinfo then + local includedirs = fetchinfo.includedirs or fetchinfo.sysincludedirs + if includedirs and #includedirs > 0 then + table.insert(configs, "CFLAGS=-I" .. includedir) + end + local linkdirs = fetchinfo.linkdirs + if linkdirs and #linkdirs > 0 then + table.insert(configs, "LDFLAGS=-L" .. linkdirs) + end + end table.insert(configs, "LIBS=" .. "-lltdl -ldl") - - import("package.tools.autoconf").install(package, configs, {packagedeps = {"libvorbis"}}) + import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) end) on_test(function (package) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index b10251d14a9..1dab81622a4 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -11,9 +11,7 @@ package("libtool") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") on_load(function (package) - if package:configs("kind") == "library" then - package:set("kind", "library") - else + if package:kind() ~= "library" then package:set("kind", "binary") end end) From c7d7b4e86cf37a1693a59a8159ab8c1240ebfbc3 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Mon, 28 Oct 2024 12:57:52 +0800 Subject: [PATCH 13/16] add libtool to packagedeps --- packages/l/libcanberra/xmake.lua | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index c270b860da1..a3d142fd582 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -33,18 +33,8 @@ package("libcanberra") table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) - if fetchinfo then - local includedirs = fetchinfo.includedirs or fetchinfo.sysincludedirs - if includedirs and #includedirs > 0 then - table.insert(configs, "CFLAGS=-I" .. includedir) - end - local linkdirs = fetchinfo.linkdirs - if linkdirs and #linkdirs > 0 then - table.insert(configs, "LDFLAGS=-L" .. linkdirs) - end - end table.insert(configs, "LIBS=" .. "-lltdl -ldl") - import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}}) + import("package.tools.autoconf").install(package, configs, {packagedeps= {"libtool", "libvorbis"}}) end) on_test(function (package) From 07701d98aa2d2bef399394aef3123cb302607bb2 Mon Sep 17 00:00:00 2001 From: bennyWU <1292983376@qq.com> Date: Mon, 28 Oct 2024 14:51:19 +0800 Subject: [PATCH 14/16] fix grammar probllem --- packages/l/libcanberra/xmake.lua | 7 ++++--- packages/l/libtool/xmake.lua | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index a3d142fd582..3386054e983 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -10,7 +10,6 @@ package("libcanberra") add_deps("libtool", {kind = "library"}) add_deps("autoconf", "automake", "m4") add_deps("libogg", "alsa-lib") - add_deps("libvorbis", {configs = {shared = true}}) if is_plat("linux") then add_syslinks("dl") @@ -22,13 +21,15 @@ package("libcanberra") add_includedirs("include") - on_install("linux", function (package) - local fetchinfo = package:dep("libtool"):fetch() + on_load(function (package) if package:config("shared") then package:add("deps", "libvorbis", {configs = {shared = true}}) else package:add("deps", "libvorbis") end + end) + + on_install("linux", function (package) local configs = {"--disable-dependency-tracking", "--disable-lynx"} table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index 1dab81622a4..a986aada579 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -16,9 +16,12 @@ package("libtool") end end) + if is_plat("linux") then + add_syslinks("dl") + end + if is_host("linux") then add_extsources("apt::libtool", "pacman::libtool") - add_syslinks("dl") elseif is_host("macosx") then add_extsources("brew::libtool") end From 9d6d6d2b7e1290bd47f5a95b9a456ac37d38f3ec Mon Sep 17 00:00:00 2001 From: hahahahbenny <1292983376@qq.com> Date: Mon, 28 Oct 2024 17:07:42 +0800 Subject: [PATCH 15/16] change libtool kind setting --- packages/l/libcanberra/xmake.lua | 2 +- packages/l/libtool/xmake.lua | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/l/libcanberra/xmake.lua b/packages/l/libcanberra/xmake.lua index 3386054e983..94f0f20a797 100644 --- a/packages/l/libcanberra/xmake.lua +++ b/packages/l/libcanberra/xmake.lua @@ -15,7 +15,7 @@ package("libcanberra") add_syslinks("dl") end - add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi", "ltdl") + add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi") add_linkdirs("lib", "lib/libcanberra-0.30") diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index a986aada579..624fdf83d45 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -1,7 +1,7 @@ package("libtool") set_homepage("https://www.gnu.org/software/libtool/") set_description("A generic library support script.") - + set_kind("binary") add_urls("http://ftpmirror.gnu.org/libtool/libtool-$(version).tar.gz", "https://mirrors.ustc.edu.cn/gnu/libtool/libtool-$(version).tar.gz", "git://git.savannah.gnu.org/libtool.git") @@ -11,8 +11,8 @@ package("libtool") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") on_load(function (package) - if package:kind() ~= "library" then - package:set("kind", "binary") + if package:is_library() then + package:addenv("PATH", "bin") end end) @@ -40,7 +40,7 @@ package("libtool") end) on_test(function (package) - if package:kind() ~= "binary" then + if package:is_binary() then assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"})) else os.vrun("libtool --version") From ea68e52e90e62ab5fd7f5edeb5ad435565dcbcca Mon Sep 17 00:00:00 2001 From: hahahahbenny <1292983376@qq.com> Date: Mon, 28 Oct 2024 17:22:33 +0800 Subject: [PATCH 16/16] fix libtool test --- packages/l/libtool/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index 624fdf83d45..2bc0b8ef475 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -40,7 +40,7 @@ package("libtool") end) on_test(function (package) - if package:is_binary() then + if not package:is_binary() then assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"})) else os.vrun("libtool --version")