Skip to content

Commit

Permalink
openh264: Add macos compilation support (#5455)
Browse files Browse the repository at this point in the history
* openh264: Add macos compilation support

* Enable all platform

* limit plat

---------

Co-authored-by: star9029 <[email protected]>
  • Loading branch information
KnightJun and star-hengxing authored Oct 9, 2024
1 parent 2e67f39 commit 1a9d484
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/o/openh264/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ package("openh264")
add_versions("v2.4.1", "8ffbe944e74043d0d3fb53d4a2a14c94de71f58dbea6a06d0dc92369542958ea")
add_versions("v2.1.1", "af173e90fce65f80722fa894e1af0d6b07572292e76de7b65273df4c0a8be678")

if is_plat("linux") then
if is_plat("linux", "bsd") then
add_syslinks("pthread", "rt")
end

add_deps("meson", "ninja", "nasm")

on_load("windows", function (package)
if package:is_plat("windows") and package:is_arch("arm.*") and (not package:is_precompiled()) then
if package:is_arch("arm.*") and (not package:is_precompiled()) then
package:add("deps", "strawberry-perl")
end
end)

on_install("windows", "linux", function (package)
if package:version():ge("2.4.1") then
on_install("!android and !bsd and !wasm", function (package)
if package:gitref() or package:version():ge("2.4.1") then
import("package.tools.meson")

local opt = {}
Expand All @@ -32,11 +32,6 @@ package("openh264")
opt.envs.PATH = path.join(os.programdir(), "scripts") .. path.envsep() .. opt.envs.PATH
end

if package:is_plat("linux") and package:has_tool("cc", "clang", "clangxx") then
opt.ldflags = "-lstdc++"
opt.shflags = "-lstdc++"
end

local configs = {"-Dtests=disabled"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
meson.install(package, configs, opt)
Expand All @@ -47,6 +42,7 @@ package("openh264")
os.tryrm(path.join(package:installdir("lib"), "libopenh264.a"))
else
os.tryrm(path.join(package:installdir("lib"), "libopenh264.so*"))
os.tryrm(path.join(package:installdir("lib"), "libopenh264.dylib"))
os.tryrm(path.join(package:installdir("lib"), "openh264.lib"))
os.tryrm(path.join(package:installdir("bin"), "openh264-*.dll"))
end
Expand Down

0 comments on commit 1a9d484

Please sign in to comment.