Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add libcanberra repo #5586

Merged
merged 17 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/a/alsa-lib/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
43 changes: 43 additions & 0 deletions packages/l/libcanberra/xmake.lua
Original file line number Diff line number Diff line change
@@ -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}})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
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)
24 changes: 20 additions & 4 deletions packages/l/libtool/xmake.lua
Original file line number Diff line number Diff line change
@@ -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")
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
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")
Expand All @@ -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
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -20,13 +29,20 @@ 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"))
end
end)

on_test(function (package)
os.vrun("libtool --version")
if package:is_binary() then
assert(package:has_cfuncs("lt_dlopen", {includes = "ltdl.h"}))
else
os.vrun("libtool --version")
end
end)
66 changes: 51 additions & 15 deletions packages/m/magic_enum/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading