Take pkg-config path from env if defined

This commit is contained in:
Bernhard Frauendienst 2016-07-09 21:31:01 +02:00
parent 72a499b54a
commit cb5495f738
3 changed files with 18 additions and 8 deletions

View File

@ -35,6 +35,14 @@ function addoptionsfromstring(str)
end end
end end
function pkgconfigcmd()
local pkgconfig = os.getenv("PKG_CONFIG")
if pkgconfig == nil then
return "pkg-config"
end
return pkgconfig
end
function osdmodulesbuild() function osdmodulesbuild()
removeflags { removeflags {
@ -343,7 +351,7 @@ function qtdebuggerbuild()
} }
else else
buildoptions { buildoptions {
backtick("pkg-config --cflags Qt5Widgets"), backtick(pkgconfigcmd() .. " --cflags Qt5Widgets"),
} }
end end
end end
@ -378,7 +386,7 @@ function osdmodulestargetconf()
if _OPTIONS["NO_USE_MIDI"]~="1" then if _OPTIONS["NO_USE_MIDI"]~="1" then
if _OPTIONS["targetos"]=="linux" then if _OPTIONS["targetos"]=="linux" then
local str = backtick("pkg-config --libs alsa") local str = backtick(pkgconfigcmd() .. " --libs alsa")
addlibfromstring(str) addlibfromstring(str)
addoptionsfromstring(str) addoptionsfromstring(str)
elseif _OPTIONS["targetos"]=="macosx" then elseif _OPTIONS["targetos"]=="macosx" then
@ -419,7 +427,7 @@ function osdmodulestargetconf()
"Qt5Widgets", "Qt5Widgets",
} }
else else
local str = backtick("pkg-config --libs Qt5Widgets") local str = backtick(pkgconfigcmd() .. " --libs Qt5Widgets")
addlibfromstring(str) addlibfromstring(str)
addoptionsfromstring(str) addoptionsfromstring(str)
end end

View File

@ -42,7 +42,7 @@ function maintargetosdoptions(_target,_subtarget)
links { links {
"SDL2_ttf", "SDL2_ttf",
} }
local str = backtick("pkg-config --libs fontconfig") local str = backtick(pkgconfigcmd() .. " --libs fontconfig")
addlibfromstring(str) addlibfromstring(str)
addoptionsfromstring(str) addoptionsfromstring(str)
end end
@ -132,7 +132,7 @@ function sdlconfigcmd()
if _OPTIONS["targetos"]=="asmjs" then if _OPTIONS["targetos"]=="asmjs" then
return "sdl2-config" return "sdl2-config"
elseif not _OPTIONS["SDL_INSTALL_ROOT"] then elseif not _OPTIONS["SDL_INSTALL_ROOT"] then
return _OPTIONS['TOOLCHAIN'] .. "pkg-config sdl2" return pkgconfigcmd() .. " sdl2"
else else
return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin","sdl2") .. "-config" return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin","sdl2") .. "-config"
end end

View File

@ -1,6 +1,8 @@
-- license:BSD-3-Clause -- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team -- copyright-holders:MAMEdev Team
dofile('modules.lua')
forcedincludes { forcedincludes {
MAME_DIR .. "src/osd/sdl/sdlprefix.h" MAME_DIR .. "src/osd/sdl/sdlprefix.h"
} }
@ -52,7 +54,7 @@ end
if _OPTIONS["NO_USE_MIDI"]~="1" and _OPTIONS["targetos"]=="linux" then if _OPTIONS["NO_USE_MIDI"]~="1" and _OPTIONS["targetos"]=="linux" then
buildoptions { buildoptions {
backtick("pkg-config --cflags alsa"), backtick(pkgconfigcmd() .. " --cflags alsa"),
} }
end end
@ -94,7 +96,7 @@ if BASE_TARGETOS=="unix" then
} }
if _OPTIONS["targetos"]~="asmjs" then if _OPTIONS["targetos"]~="asmjs" then
buildoptions { buildoptions {
backtick("pkg-config --cflags fontconfig"), backtick(pkgconfigcmd() .. " --cflags fontconfig"),
} }
end end
end end
@ -121,7 +123,7 @@ elseif _OPTIONS["targetos"]=="linux" then
} }
else else
buildoptions { buildoptions {
backtick("pkg-config --cflags Qt5Widgets"), backtick(pkgconfigcmd() .. " --cflags Qt5Widgets"),
} }
end end
elseif _OPTIONS["targetos"]=="macosx" then elseif _OPTIONS["targetos"]=="macosx" then