Skip to content

Commit

Permalink
Better support for cross-compiling by using pkg-config (instead of sd…
Browse files Browse the repository at this point in the history
…l-config and freetype-config) and trying both static linux libs
  • Loading branch information
def- committed Sep 3, 2015
1 parent f20a6a4 commit fca4c11
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 35 deletions.
3 changes: 0 additions & 3 deletions bam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ function build(settings)
--settings.objdir = Path("objs")
settings.cc.Output = Intermediate_Output

--settings.cc.flags:Add("-m32")
--settings.link.flags:Add("-m32")

cflags = os.getenv("CFLAGS")
if cflags then
settings.cc.flags:Add(cflags)
Expand Down
5 changes: 2 additions & 3 deletions other/curl/curl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ Curl = {
settings.link.libpath:Add("other/curl/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
settings.link.libpath:Add("other/curl/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
settings.link.libpath:Add("other/curl/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
settings.link.libpath:Add("other/curl/linux/lib64")
settings.link.libpath:Add("other/curl/linux/lib32")
end
end
end
Expand Down
16 changes: 8 additions & 8 deletions other/freetype/freetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ FreeType = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.use_ftconfig = false
option.use_pkgconfig = false
option.use_winlib = 0
option.lib_path = nil

if ExecuteSilent("freetype-config") > 0 and ExecuteSilent("freetype-config --cflags") == 0 then
if ExecuteSilent("pkg-config freetype2") == 0 then
option.value = true
option.use_ftconfig = true
option.use_pkgconfig = true
end

if platform == "win32" then
Expand All @@ -26,9 +26,9 @@ FreeType = {
-- include path
settings.cc.includes:Add(FreeType.basepath .. "/include")

if option.use_ftconfig == true then
settings.cc.flags:Add("`freetype-config --cflags`")
settings.link.flags:Add("`freetype-config --libs`")
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config freetype2 --cflags`")
settings.link.flags:Add("`pkg-config freetype2 --libs`")

elseif option.use_winlib > 0 then
if option.use_winlib == 32 then
Expand All @@ -42,13 +42,13 @@ FreeType = {

local save = function(option, output)
output:option(option, "value")
output:option(option, "use_ftconfig")
output:option(option, "use_pkgconfig")
output:option(option, "use_winlib")
end

local display = function(option)
if option.value == true then
if option.use_ftconfig == true then return "using freetype-config" end
if option.use_pkgconfig == true then return "using pkg-config" end
if option.use_winlib == 32 then return "using supplied win32 libraries" end
if option.use_winlib == 64 then return "using supplied win64 libraries" end
return "using unknown method"
Expand Down
5 changes: 2 additions & 3 deletions other/mysql/mysql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ Mysql = {
settings.link.libpath:Add("other/mysql/mac/lib32")
elseif platform == "macosx" and string.find(settings.config_name, "64") then
settings.link.libpath:Add("other/mysql/mac/lib64")
elseif platform == "linux" and arch == "ia32" then
settings.link.libpath:Add("other/mysql/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
elseif platform == "linux" then
settings.link.libpath:Add("other/mysql/linux/lib64")
settings.link.libpath:Add("other/mysql/linux/lib32")
end
end
end
Expand Down
5 changes: 2 additions & 3 deletions other/opus/ogg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ Ogg = {
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" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
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
Expand Down
5 changes: 2 additions & 3 deletions other/opus/opus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ Opus = {
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" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
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
Expand Down
5 changes: 2 additions & 3 deletions other/opus/opusfile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ Opusfile = {
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" and arch == "ia32" then
client_settings.link.libpath:Add("other/opus/linux/lib32")
elseif platform == "linux" and arch == "amd64" then
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
Expand Down
18 changes: 9 additions & 9 deletions other/sdl/sdl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ SDL = {
OptFind = function (name, required)
local check = function(option, settings)
option.value = false
option.use_sdlconfig = false
option.use_pkgconfig = false
option.use_winlib = 0
option.use_osxframework = false
option.lib_path = nil

if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then
if ExecuteSilent("pkg-config sdl") == 0 then
option.value = true
option.use_sdlconfig = true
option.use_pkgconfig = true
end

if platform == "win32" then
Expand All @@ -25,14 +25,14 @@ SDL = {
if platform == "macosx" then
option.value = true
option.use_osxframework = true
option.use_sdlconfig = false
option.use_pkgconfig = false
end
end

local apply = function(option, settings)
if option.use_sdlconfig == true then
settings.cc.flags:Add("`sdl-config --cflags`")
settings.link.flags:Add("`sdl-config --libs`")
if option.use_pkgconfig == true then
settings.cc.flags:Add("`pkg-config sdl --cflags`")
settings.link.flags:Add("`pkg-config sdl --libs`")
end

if option.use_osxframework == true then
Expand All @@ -54,14 +54,14 @@ SDL = {

local save = function(option, output)
output:option(option, "value")
output:option(option, "use_sdlconfig")
output:option(option, "use_pkgconfig")
output:option(option, "use_winlib")
output:option(option, "use_osxframework")
end

local display = function(option)
if option.value == true then
if option.use_sdlconfig == true then return "using sdl-config" end
if option.use_pkgconfig == true then return "using pkg-config" end
if option.use_winlib == 32 then return "using supplied win32 libraries" end
if option.use_winlib == 64 then return "using supplied win64 libraries" end
if option.use_osxframework == true then return "using osx framework" end
Expand Down

0 comments on commit fca4c11

Please sign in to comment.