CatFeeder/live555.lua

80 lines
2.5 KiB
Lua

package("live555")
set_kind("library")
set_homepage("http://www.live555.com")
set_urls("http://www.live555.com/liveMedia/public/live.$(version).tar.gz")
add_versions("2024.11.28", "a9af16f46d2f4c7ccdbfc4b617480503d27cccb46fa5abb7dfd8a25951b44cc3")
add_configs("no_openssl", { description = "Set 1 if no OpenSSL", default = "1", values = { "0", "1" } })
add_configs("no_std_lib", { description = "Set 1 if no C++20 STD LIB", default = "1", values = { "0", "1" } })
add_includedirs(
"include/BasicUsageEnvironment",
"include/groupsock",
"include/liveMedia",
"include/UsageEnvironment"
)
local compile_opts =
"COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 "
local make_scipt = [[
C = c
C_COMPILER = cc
C_FLAGS = $(COMPILE_OPTS) $(CPPFLAGS) $(CFLAGS)
CPP = cpp
CPLUSPLUS_COMPILER = c++
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 $(CPPFLAGS) $(CXXFLAGS)
OBJ = o
LINK = c++ -o
LINK_OPTS = -L. $(LDFLAGS)
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LIBRARY_LINK = ar cr
LIBRARY_LINK_OPTS =
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
EXE =
]]
on_load(function(package)
local no_openssl = package:config("no_openssl") or "1"
local no_std_lib = package:config("no_std_lib") or "1"
package:add("defines", "NO_OPENSSL=" .. no_openssl)
package:add("defines", "NO_STD_LIB=" .. no_std_lib)
end)
on_install(function(package)
-- Create plat make script
local no_openssl = package:config("no_openssl") or "1"
local no_std_lib = package:config("no_std_lib") or "1"
local script = io.open("config.cross", "w")
if script then
script:write(compile_opts)
script:print("-DNO_OPENSSL=%s -DNO_STD_LIB=%s", no_openssl, no_std_lib)
script:write(make_scipt)
script:print("PREFIX = %s", package:installdir())
script:close()
end
if no_openssl == "0" then
os.vrun("sed -i 's/LIBS_FOR_CONSOLE_APPLICATION =/& -lssl -lcrypto/g' config.cross")
end
--! Don't forget to append space at the end of line "LIBRARY_LINK"
os.vrun("sed -i 's/ar cr/ar cr /g' config.cross")
os.vrun("echo ----- Compile Opts -----")
os.vrun("cat config.cross")
-- Generate makefile
os.vrun("chmod +rw genMakefiles")
os.vrun("sed -i 's/\\/bin\\/rm/rm/g' genMakefiles")
os.vrun("./genMakefiles cross")
-- Install
os.vrun("make clean")
import("package.tools.make").install(package)
end)
on_test(function(package)
assert(package:has_cxxtypes("RTSPServer", { includes = "liveMedia.hh" }))
end)