From 51dc33b14bc2cefd73dc9f6ab0bb41c06f9cb122 Mon Sep 17 00:00:00 2001 From: benny066567 <1292983376@qq.com> Date: Mon, 28 Oct 2024 18:19:47 +0800 Subject: [PATCH] add libcanberra repo (#5586) * add libcanberra repo * Add magic enum module support (#5587) * [magic_enum] add C++ module support * [magic_enum] fix v0.9.6 sha256 * add vorbis and ogg to packagedeps * add libvorbis shared deps * add ltdl includedir * change includedir * add libtool kind * change libtool configs * change kind * change kind * delete the part of adding path manually * fix grammar pproblem * add libtool to packagedeps * fix grammar probllem * change libtool kind setting * fix libtool test --------- Co-authored-by: Arthur Laurent --- packages/a/alsa-lib/xmake.lua | 2 +- packages/l/libcanberra/xmake.lua | 43 ++++++++++++++++++++++++++++++++ packages/l/libtool/xmake.lua | 24 +++++++++++++++--- 3 files changed, 64 insertions(+), 5 deletions(-) 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 b879a4359..8837abef5 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 000000000..94f0f20a7 --- /dev/null +++ b/packages/l/libcanberra/xmake.lua @@ -0,0 +1,43 @@ +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("libtool", {kind = "library"}) + add_deps("autoconf", "automake", "m4") + add_deps("libogg", "alsa-lib") + + if is_plat("linux") then + add_syslinks("dl") + end + + add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi") + + add_linkdirs("lib", "lib/libcanberra-0.30") + + add_includedirs("include") + + 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")) + table.insert(configs, "--with-systemdsystemunitdir=" .. package:installdir("system_servise")) + table.insert(configs, "LIBS=" .. "-lltdl -ldl") + import("package.tools.autoconf").install(package, configs, {packagedeps= {"libtool", "libvorbis"}}) + end) + + on_test(function (package) + assert(package:has_cfuncs("ca_context_create", {includes = "canberra.h"})) + end) diff --git a/packages/l/libtool/xmake.lua b/packages/l/libtool/xmake.lua index c6009b614..2bc0b8ef4 100644 --- a/packages/l/libtool/xmake.lua +++ b/packages/l/libtool/xmake.lua @@ -1,8 +1,7 @@ package("libtool") - set_kind("binary") 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,6 +10,16 @@ package("libtool") add_versions("2.4.5", "509cb49c7de14ce7eaf88993cf09fd4071882699dfd874c2e95b31ab107d6987") add_versions("2.4.7", "04e96c2404ea70c590c546eba4202a4e12722c640016c12b9b2f1ce3d481e9a8") + on_load(function (package) + if package:is_library() then + package:addenv("PATH", "bin") + end + end) + + if is_plat("linux") then + add_syslinks("dl") + end + if is_host("linux") then add_extsources("apt::libtool", "pacman::libtool") elseif is_host("macosx") then @@ -20,7 +29,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")) @@ -28,5 +40,9 @@ package("libtool") end) on_test(function (package) - os.vrun("libtool --version") + if not package:is_binary() then + assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"})) + else + os.vrun("libtool --version") + end end)