From fca4c112d49138a56a8146da9512655b9cf9cf25 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 3 Sep 2015 06:28:11 +0200 Subject: [PATCH] Better support for cross-compiling by using pkg-config (instead of sdl-config and freetype-config) and trying both static linux libs --- bam.lua | 3 --- other/curl/curl.lua | 5 ++--- other/freetype/freetype.lua | 16 ++++++++-------- other/mysql/mysql.lua | 5 ++--- other/opus/ogg.lua | 5 ++--- other/opus/opus.lua | 5 ++--- other/opus/opusfile.lua | 5 ++--- other/sdl/sdl.lua | 18 +++++++++--------- 8 files changed, 27 insertions(+), 35 deletions(-) diff --git a/bam.lua b/bam.lua index 8457b7529..d55efaebe 100644 --- a/bam.lua +++ b/bam.lua @@ -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) diff --git a/other/curl/curl.lua b/other/curl/curl.lua index 52454e02c..8c751f29f 100644 --- a/other/curl/curl.lua +++ b/other/curl/curl.lua @@ -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 diff --git a/other/freetype/freetype.lua b/other/freetype/freetype.lua index aa5af22dd..334f553c5 100644 --- a/other/freetype/freetype.lua +++ b/other/freetype/freetype.lua @@ -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 @@ -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 @@ -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" diff --git a/other/mysql/mysql.lua b/other/mysql/mysql.lua index 5c4adbcc2..dfd6ff8a2 100644 --- a/other/mysql/mysql.lua +++ b/other/mysql/mysql.lua @@ -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 diff --git a/other/opus/ogg.lua b/other/opus/ogg.lua index cc6fb1f81..9c48ea0a4 100644 --- a/other/opus/ogg.lua +++ b/other/opus/ogg.lua @@ -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 diff --git a/other/opus/opus.lua b/other/opus/opus.lua index f6767650a..b86fb5d95 100644 --- a/other/opus/opus.lua +++ b/other/opus/opus.lua @@ -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 diff --git a/other/opus/opusfile.lua b/other/opus/opusfile.lua index 980895624..a4b9648a0 100644 --- a/other/opus/opusfile.lua +++ b/other/opus/opusfile.lua @@ -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 diff --git a/other/sdl/sdl.lua b/other/sdl/sdl.lua index 141832056..a12aa7af0 100644 --- a/other/sdl/sdl.lua +++ b/other/sdl/sdl.lua @@ -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 @@ -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 @@ -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