Skip to content

Commit fca4c11

Browse files
committed
Better support for cross-compiling by using pkg-config (instead of sdl-config and freetype-config) and trying both static linux libs
1 parent f20a6a4 commit fca4c11

8 files changed

Lines changed: 27 additions & 35 deletions

File tree

bam.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ function build(settings)
179179
--settings.objdir = Path("objs")
180180
settings.cc.Output = Intermediate_Output
181181

182-
--settings.cc.flags:Add("-m32")
183-
--settings.link.flags:Add("-m32")
184-
185182
cflags = os.getenv("CFLAGS")
186183
if cflags then
187184
settings.cc.flags:Add(cflags)

other/curl/curl.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ Curl = {
5959
settings.link.libpath:Add("other/curl/mac/lib32")
6060
elseif platform == "macosx" and string.find(settings.config_name, "64") then
6161
settings.link.libpath:Add("other/curl/mac/lib64")
62-
elseif platform == "linux" and arch == "ia32" then
63-
settings.link.libpath:Add("other/curl/linux/lib32")
64-
elseif platform == "linux" and arch == "amd64" then
62+
elseif platform == "linux" then
6563
settings.link.libpath:Add("other/curl/linux/lib64")
64+
settings.link.libpath:Add("other/curl/linux/lib32")
6665
end
6766
end
6867
end

other/freetype/freetype.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ FreeType = {
44
OptFind = function (name, required)
55
local check = function(option, settings)
66
option.value = false
7-
option.use_ftconfig = false
7+
option.use_pkgconfig = false
88
option.use_winlib = 0
99
option.lib_path = nil
1010

11-
if ExecuteSilent("freetype-config") > 0 and ExecuteSilent("freetype-config --cflags") == 0 then
11+
if ExecuteSilent("pkg-config freetype2") == 0 then
1212
option.value = true
13-
option.use_ftconfig = true
13+
option.use_pkgconfig = true
1414
end
1515

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

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

3333
elseif option.use_winlib > 0 then
3434
if option.use_winlib == 32 then
@@ -42,13 +42,13 @@ FreeType = {
4242

4343
local save = function(option, output)
4444
output:option(option, "value")
45-
output:option(option, "use_ftconfig")
45+
output:option(option, "use_pkgconfig")
4646
output:option(option, "use_winlib")
4747
end
4848

4949
local display = function(option)
5050
if option.value == true then
51-
if option.use_ftconfig == true then return "using freetype-config" end
51+
if option.use_pkgconfig == true then return "using pkg-config" end
5252
if option.use_winlib == 32 then return "using supplied win32 libraries" end
5353
if option.use_winlib == 64 then return "using supplied win64 libraries" end
5454
return "using unknown method"

other/mysql/mysql.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ Mysql = {
5757
settings.link.libpath:Add("other/mysql/mac/lib32")
5858
elseif platform == "macosx" and string.find(settings.config_name, "64") then
5959
settings.link.libpath:Add("other/mysql/mac/lib64")
60-
elseif platform == "linux" and arch == "ia32" then
61-
settings.link.libpath:Add("other/mysql/linux/lib32")
62-
elseif platform == "linux" and arch == "amd64" then
60+
elseif platform == "linux" then
6361
settings.link.libpath:Add("other/mysql/linux/lib64")
62+
settings.link.libpath:Add("other/mysql/linux/lib32")
6463
end
6564
end
6665
end

other/opus/ogg.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Ogg = {
5858
client_settings.link.libpath:Add("other/opus/mac/lib32")
5959
elseif platform == "macosx" and string.find(settings.config_name, "64") then
6060
client_settings.link.libpath:Add("other/opus/mac/lib64")
61-
elseif platform == "linux" and arch == "ia32" then
62-
client_settings.link.libpath:Add("other/opus/linux/lib32")
63-
elseif platform == "linux" and arch == "amd64" then
61+
elseif platform == "linux" then
6462
client_settings.link.libpath:Add("other/opus/linux/lib64")
63+
client_settings.link.libpath:Add("other/opus/linux/lib32")
6564
end
6665
end
6766
end

other/opus/opus.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Opus = {
5858
client_settings.link.libpath:Add("other/opus/mac/lib32")
5959
elseif platform == "macosx" and string.find(settings.config_name, "64") then
6060
client_settings.link.libpath:Add("other/opus/mac/lib64")
61-
elseif platform == "linux" and arch == "ia32" then
62-
client_settings.link.libpath:Add("other/opus/linux/lib32")
63-
elseif platform == "linux" and arch == "amd64" then
61+
elseif platform == "linux" then
6462
client_settings.link.libpath:Add("other/opus/linux/lib64")
63+
client_settings.link.libpath:Add("other/opus/linux/lib32")
6564
end
6665
end
6766
end

other/opus/opusfile.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Opusfile = {
5858
client_settings.link.libpath:Add("other/opus/mac/lib32")
5959
elseif platform == "macosx" and string.find(settings.config_name, "64") then
6060
client_settings.link.libpath:Add("other/opus/mac/lib64")
61-
elseif platform == "linux" and arch == "ia32" then
62-
client_settings.link.libpath:Add("other/opus/linux/lib32")
63-
elseif platform == "linux" and arch == "amd64" then
61+
elseif platform == "linux" then
6462
client_settings.link.libpath:Add("other/opus/linux/lib64")
63+
client_settings.link.libpath:Add("other/opus/linux/lib32")
6564
end
6665
end
6766
end

other/sdl/sdl.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ SDL = {
44
OptFind = function (name, required)
55
local check = function(option, settings)
66
option.value = false
7-
option.use_sdlconfig = false
7+
option.use_pkgconfig = false
88
option.use_winlib = 0
99
option.use_osxframework = false
1010
option.lib_path = nil
1111

12-
if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then
12+
if ExecuteSilent("pkg-config sdl") == 0 then
1313
option.value = true
14-
option.use_sdlconfig = true
14+
option.use_pkgconfig = true
1515
end
1616

1717
if platform == "win32" then
@@ -25,14 +25,14 @@ SDL = {
2525
if platform == "macosx" then
2626
option.value = true
2727
option.use_osxframework = true
28-
option.use_sdlconfig = false
28+
option.use_pkgconfig = false
2929
end
3030
end
3131

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

3838
if option.use_osxframework == true then
@@ -54,14 +54,14 @@ SDL = {
5454

5555
local save = function(option, output)
5656
output:option(option, "value")
57-
output:option(option, "use_sdlconfig")
57+
output:option(option, "use_pkgconfig")
5858
output:option(option, "use_winlib")
5959
output:option(option, "use_osxframework")
6060
end
6161

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

0 commit comments

Comments
 (0)