Only use opusfile+opus+ogg from one source at the same time to prevent linking problems (fixes #793)

This commit is contained in:
def 2017-07-15 16:26:05 +02:00
parent 1e3476e8bd
commit 1144490ff7
4 changed files with 6 additions and 193 deletions

View file

@ -17,8 +17,6 @@ Import("other/sdl/sdl.lua")
Import("other/freetype/freetype.lua") Import("other/freetype/freetype.lua")
Import("other/curl/curl.lua") Import("other/curl/curl.lua")
Import("other/opus/opusfile.lua") Import("other/opus/opusfile.lua")
Import("other/opus/opus.lua")
Import("other/opus/ogg.lua")
Import("other/mysql/mysql.lua") Import("other/mysql/mysql.lua")
--- Setup Config ------- --- Setup Config -------
@ -32,8 +30,6 @@ config:Add(SDL.OptFind("sdl", true))
config:Add(FreeType.OptFind("freetype", true)) config:Add(FreeType.OptFind("freetype", true))
config:Add(Curl.OptFind("curl", true)) config:Add(Curl.OptFind("curl", true))
config:Add(Opusfile.OptFind("opusfile", true)) config:Add(Opusfile.OptFind("opusfile", true))
config:Add(Opus.OptFind("opus", true))
config:Add(Ogg.OptFind("ogg", true))
config:Add(Mysql.OptFind("mysql", false)) config:Add(Mysql.OptFind("mysql", false))
config:Add(OptString("websockets", false)) config:Add(OptString("websockets", false))
config:Finalize("config.lua") config:Finalize("config.lua")
@ -353,8 +349,6 @@ function build(settings)
config.freetype:Apply(client_settings) config.freetype:Apply(client_settings)
config.curl:Apply(client_settings) config.curl:Apply(client_settings)
config.opusfile:Apply(client_settings) config.opusfile:Apply(client_settings)
config.opus:Apply(client_settings)
config.ogg:Apply(client_settings)
if family == "unix" and (platform == "macosx" or platform == "linux") then if family == "unix" and (platform == "macosx" or platform == "linux") then
engine_settings.link.libs:Add("dl") engine_settings.link.libs:Add("dl")

View file

@ -1,93 +0,0 @@
Ogg = {
basepath = PathDir(ModuleFilename()),
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.lib_path = nil
if IsNegativeTerm(ScriptArgs[name .. ".use_pkgconfig"]) then
option.use_pkgconfig = false
elseif IsPositiveTerm(ScriptArgs[name .. ".use_pkgconfig"]) then
option.use_pkgconfig = true
end
if family ~= "windows" and ExecuteSilent("pkg-config ogg") == 0 then
option.value = true
if option.use_pkgconfig == nil then
option.use_pkgconfig = true
end
end
if option.use_pkgconfig == nil then
option.use_pkgconfig = false
end
if platform == "win32" then
option.value = true
elseif platform == "win64" then
option.value = true
elseif platform == "macosx" and string.find(settings.config_name, "32") then
option.value = true
elseif platform == "macosx" and string.find(settings.config_name, "64") then
option.value = true
elseif platform == "linux" and arch == "ia32" then
option.value = true
elseif platform == "linux" and arch == "amd64" then
option.value = true
end
end
local apply = function(option, settings)
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config --cflags ogg`")
settings.link.flags:Add("`pkg-config --libs ogg`")
else
settings.cc.includes:Add(Ogg.basepath .. "/include")
settings.cc.includes:Add(Ogg.basepath .. "/include/ogg")
if family ~= "windows" then
settings.link.libs:Add("ogg")
end
if platform == "win32" then
client_settings.link.libpath:Add("other/opus/windows/lib32")
elseif platform == "win64" then
client_settings.link.libpath:Add("other/opus/windows/lib64")
elseif platform == "macosx" and string.find(settings.config_name, "32") then
client_settings.link.libpath:Add("other/opus/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
client_settings.link.libpath:Add("other/opus/mac/lib64")
elseif platform == "linux" then
client_settings.link.libpath:Add("other/opus/linux/lib64")
client_settings.link.libpath:Add("other/opus/linux/lib32")
end
end
end
local save = function(option, output)
output:option(option, "value")
output:option(option, "use_pkgconfig")
end
local display = function(option)
if option.value == true then
if option.use_pkgconfig == true then return "using pkg-config" end
return "using bundled libs"
else
if option.required then
return "not found (required)"
else
return "not found (optional)"
end
end
end
local o = MakeOption(name, 0, check, save, display)
o.Apply = apply
o.include_path = nil
o.lib_path = nil
o.required = required
return o
end
}

View file

@ -1,93 +0,0 @@
Opus = {
basepath = PathDir(ModuleFilename()),
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.lib_path = nil
if IsNegativeTerm(ScriptArgs[name .. ".use_pkgconfig"]) then
option.use_pkgconfig = false
elseif IsPositiveTerm(ScriptArgs[name .. ".use_pkgconfig"]) then
option.use_pkgconfig = true
end
if family ~= "windows" and ExecuteSilent("pkg-config opus") == 0 then
option.value = true
if option.use_pkgconfig == nil then
option.use_pkgconfig = true
end
end
if option.use_pkgconfig == nil then
option.use_pkgconfig = false
end
if platform == "win32" then
option.value = true
elseif platform == "win64" then
option.value = true
elseif platform == "macosx" and string.find(settings.config_name, "32") then
option.value = true
elseif platform == "macosx" and string.find(settings.config_name, "64") then
option.value = true
elseif platform == "linux" and arch == "ia32" then
option.value = true
elseif platform == "linux" and arch == "amd64" then
option.value = true
end
end
local apply = function(option, settings)
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config --cflags opus`")
settings.link.flags:Add("`pkg-config --libs opus`")
else
settings.cc.includes:Add(Opus.basepath .. "/include")
settings.cc.includes:Add(Opus.basepath .. "/include/opus")
if family ~= "windows" then
settings.link.libs:Add("opus")
end
if platform == "win32" then
client_settings.link.libpath:Add("other/opus/windows/lib32")
elseif platform == "win64" then
client_settings.link.libpath:Add("other/opus/windows/lib64")
elseif platform == "macosx" and string.find(settings.config_name, "32") then
client_settings.link.libpath:Add("other/opus/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
client_settings.link.libpath:Add("other/opus/mac/lib64")
elseif platform == "linux" then
client_settings.link.libpath:Add("other/opus/linux/lib64")
client_settings.link.libpath:Add("other/opus/linux/lib32")
end
end
end
local save = function(option, output)
output:option(option, "value")
output:option(option, "use_pkgconfig")
end
local display = function(option)
if option.value == true then
if option.use_pkgconfig == true then return "using pkg-config" end
return "using bundled libs"
else
if option.required then
return "not found (required)"
else
return "not found (optional)"
end
end
end
local o = MakeOption(name, 0, check, save, display)
o.Apply = apply
o.include_path = nil
o.lib_path = nil
o.required = required
return o
end
}

View file

@ -12,7 +12,7 @@ Opusfile = {
option.use_pkgconfig = true option.use_pkgconfig = true
end end
if family ~= "windows" and ExecuteSilent("pkg-config opusfile") == 0 then if family ~= "windows" and ExecuteSilent("pkg-config opusfile") == 0 and ExecuteSilent("pkg-config opus") == 0 and ExecuteSilent("pkg-config ogg") == 0 then
option.value = true option.value = true
if option.use_pkgconfig == nil then if option.use_pkgconfig == nil then
option.use_pkgconfig = true option.use_pkgconfig = true
@ -41,9 +41,14 @@ Opusfile = {
local apply = function(option, settings) local apply = function(option, settings)
if option.use_pkgconfig == true then if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config --cflags opusfile`") settings.cc.flags:Add("`pkg-config --cflags opusfile`")
settings.cc.flags:Add("`pkg-config --cflags opus`")
settings.cc.flags:Add("`pkg-config --cflags ogg`")
settings.link.flags:Add("`pkg-config --libs opusfile`") settings.link.flags:Add("`pkg-config --libs opusfile`")
settings.link.flags:Add("`pkg-config --libs opus`")
settings.link.flags:Add("`pkg-config --libs ogg`")
else else
settings.cc.includes:Add(Opusfile.basepath .. "/include") settings.cc.includes:Add(Opusfile.basepath .. "/include")
settings.cc.includes:Add(Opusfile.basepath .. "/include/ogg")
settings.cc.includes:Add(Opusfile.basepath .. "/include/opus") settings.cc.includes:Add(Opusfile.basepath .. "/include/opus")
if family ~= "windows" then if family ~= "windows" then