liba52: add package (#4784)

* liba52: add package

* improve autotools

* fix autotools run

* fix again

* try again

* fix macosx build

* disable configs for unsupported plat

* try to fix mingw@macosx

* use vc++ config.h

* limit plat
pull/4809/head
star9029 4 months ago committed by GitHub
parent 041296227f
commit 7a8cf25471
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 62
      packages/l/liba52/port/xmake.lua
  2. 55
      packages/l/liba52/xmake.lua

@ -0,0 +1,62 @@
option("tools", {default = false})
add_rules("mode.debug", "mode.release")
add_includedirs("include")
if is_plat("windows", "mingw") or is_host("windows") then
add_includedirs("vc++")
end
if is_plat("windows") and has_config("tools") then
add_requires("strings_h")
end
if is_plat("macosx") or (is_host("macosx") and is_plat("mingw")) then
-- Fixes duplicate symbols
set_languages("gnu89")
end
rule("tools")
on_load(function (target)
if not get_config("tools") then
target:set("enabled", false)
return
end
target:add("kind", "binary")
target:add("files", "src/getopt.c")
target:add("includedirs", "src")
target:add("deps", "a52")
if target:is_plat("windows") then
target:add("packages", "strings_h")
end
end)
target("a52")
set_kind("$(kind)")
add_files("liba52/*.c", "libao/*.c")
add_headerfiles(
"include/a52.h",
"include/attributes.h",
"include/audio_out.h",
"include/mm_accel.h",
"liba52/a52_internal.h", {prefixdir = "a52dec"}
)
if is_plat("windows", "mingw") then
add_syslinks("winmm")
elseif is_plat("linux", "bsd") then
add_syslinks("m")
end
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all")
end
target("a52dec")
add_rules("tools")
add_files("src/a52dec.c", "src/gettimeofday.c")
target("extract_a52")
add_rules("tools")
add_files("src/extract_a52.c")

@ -0,0 +1,55 @@
package("liba52")
set_homepage("https://liba52.sourceforge.io")
set_description("Library for decoding ATSC A/52 (AC-3) audio streams")
set_license("GPL-2.0-or-later")
add_urls("https://git.adelielinux.org/community/a52dec/-/archive/$(version)/a52dec-$(version).tar.bz2",
"https://git.adelielinux.org/community/a52dec.git",
"https://code.videolan.org/videolan/liba52.git",
"https://github.com/Distrotech/a52dec.git")
add_versions("v0.8.0", "d4f26685d32a8c85f86a5cb800554160fb85400298a0a27151c3d1e63a170943")
add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::a52dec")
elseif is_plat("linux") then
add_extsources("pacman::a52dec", "apt::liba52-dev")
elseif is_plat("macosx") then
add_extsources("brew::a52dec")
end
if is_plat("windows", "mingw") then
add_syslinks("winmm")
elseif is_plat("linux", "bsd") then
add_syslinks("m")
end
if not is_host("windows") then
add_deps("autoconf", "automake", "libtool", "m4")
end
on_load("windows", function (package)
if package:config("tools") then
package:add("deps", "strings_h", {private = true})
end
end)
on_install("!iphoneos and (!android or android@!windows)", function (package)
if not is_host("windows")then
-- Generate config.h by autotools
local configs = {}
if package:is_plat("android", "bsd", "wasm") then
table.insert(configs, "--disable-oss")
table.insert(configs, "--disable-djbfft")
end
import("package.tools.autoconf").configure(package, configs)
end
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
import("package.tools.xmake").install(package, {tools = package:config("tools")})
end)
on_test(function (package)
assert(package:has_cfuncs("a52_init", {includes = {"inttypes.h", "a52dec/a52.h"}}))
end)
Loading…
Cancel
Save