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 9 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
53 changes: 53 additions & 0 deletions packages/l/libcanberra/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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", {configs = {kind_libtool = library}})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
add_deps("autoconf", "automake", "m4")
add_deps("libogg", "alsa-lib")

add_deps("libvorbis", {configs = {shared=true}})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved

if is_plat("linux") then
add_syslinks("dl", "ltdl")
end

add_links("canberra", "canberra-null", "canberra-alsa", "canberra-oss", "canberra-pulse", "canberra-multi", "ltdl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ltdl 也是这个包的库么?系统库得用 add_syslinks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ltdl 来自 libtool,加了 add_deps 就会自动放在最右面保证 link order,所以这里可以也删了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个好像是 libtool 的库,不应该在 libtool 里面自动导出了么


add_linkdirs("lib", "lib/libcanberra-0.30")

add_includedirs("include")

on_install("linux", function (package)
local fetchinfo = package:dep("libtool"):fetch()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

漏删了


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")
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
table.insert(configs, "CPPFLAGS=-I" .. fetchinfo.artifacts.installdir .. "/include/")
table.insert(configs, "LIBLTDL=" .. "-llibltdl")

local pos = string.find(fetchinfo.artifacts.installdir, "libtool")
local after_libtool = string.sub(fetchinfo.artifacts.installdir, pos + 7)
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
local libtool_dir = "../../../libtool" .. after_libtool
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
print(libtool_libdir)
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
package:add("linkdirs", libtool_dir .. "/lib/")
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
package:add("includedirs", libtool_dir .. "/include/")
import("package.tools.autoconf").install(package, configs, {packagedeps= {"libvorbis"}})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
end)

on_test(function (package)
assert(package:has_cfuncs("ca_context_create", {includes = "canberra.h"}))
end)
11 changes: 10 additions & 1 deletion packages/l/libtool/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package("libtool")
set_kind("binary")
set_homepage("https://www.gnu.org/software/libtool/")
set_description("A generic library support script.")

Expand All @@ -11,6 +10,16 @@ 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
package:set("kind", "library")
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
else
package:set("kind", "binary")
end
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
end)

if is_host("linux") then
add_extsources("apt::libtool", "pacman::libtool")
elseif is_host("macosx") then
Expand Down
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