Index: build/premake/extern_libs5.lua =================================================================== --- build/premake/extern_libs5.lua +++ build/premake/extern_libs5.lua @@ -39,6 +39,9 @@ pkgconfig = require "pkgconfig" +if os.istarget("osx") then + pkgconfig.alternative_module_path = libraries_dir +end local function add_delayload(name, suffix, def) @@ -230,16 +233,20 @@ compile_settings = function() if os.istarget("windows") or os.istarget("macosx") then add_default_include_paths("enet") + else + pkgconfig.add_includes("libenet") end end, link_settings = function() if os.istarget("windows") or os.istarget("macosx") then add_default_lib_paths("enet") + add_default_links({ + win_names = { "enet" }, + osx_names = { "enet" }, + }) + else + pkgconfig.add_links("libenet") end - add_default_links({ - win_names = { "enet" }, - unix_names = { "enet" }, - }) end, }, fcollada = { @@ -313,9 +320,7 @@ if os.istarget("windows") then add_default_include_paths("gloox") else - -- Support GLOOX_CONFIG for overriding the default (pkg-config --cflags gloox) - -- i.e. on OSX where it gets set in update-workspaces.sh - pkgconfig.add_includes("gloox", os.getenv("GLOOX_CONFIG")) + pkgconfig.add_includes("gloox") end end, link_settings = function() @@ -326,7 +331,7 @@ no_delayload = 1, }) else - pkgconfig.add_links("gloox", os.getenv("GLOOX_CONFIG")) + pkgconfig.add_links("gloox") if os.istarget("macosx") then -- Manually add gnutls dependencies, those are not present in gloox's pkg-config @@ -373,9 +378,7 @@ if os.istarget("windows") then add_default_include_paths("icu") else - -- Support ICU_CONFIG for overriding the default (pkg-config --cflags icu-i18n) - -- i.e. on OSX where it gets set in update-workspaces.sh - pkgconfig.add_includes("icu-i18n", os.getenv("ICU_CONFIG"), "--cppflags") + pkgconfig.add_includes("icu-i18n") end end, link_settings = function() @@ -387,26 +390,27 @@ no_delayload = 1, }) else - pkgconfig.add_links("icu-i18n", os.getenv("ICU_CONFIG"), "--ldflags-searchpath --ldflags-libsonly --ldflags-system") + pkgconfig.add_links("icu-i18n") end end, }, libcurl = { compile_settings = function() - if os.istarget("windows") or os.istarget("macosx") then + if os.istarget("windows") then add_default_include_paths("libcurl") + else + pkgconfig.add_includes("libcurl") end end, link_settings = function() - if os.istarget("windows") or os.istarget("macosx") then + if os.istarget("windows") then add_default_lib_paths("libcurl") + add_default_links({ + win_names = { "libcurl" }, + }) + else + pkgconfig.add_links("libcurl") end - add_default_links({ - win_names = { "libcurl" }, - unix_names = { "curl" }, - osx_names = { "curl", "z" }, - osx_frameworks = { "Security" } - }) end, }, libpng = { @@ -414,9 +418,7 @@ if os.istarget("windows") then add_default_include_paths("libpng") else - -- Support LIBPNG_CONFIG for overriding the default (pkg-config --cflags libpng) - -- i.e. on OSX where it gets set in update-workspaces.sh - pkgconfig.add_includes("libpng", os.getenv("LIBPNG_CONFIG")) + pkgconfig.add_includes("libpng") end end, link_settings = function() @@ -426,24 +428,27 @@ win_names = { "libpng16" }, }) else - pkgconfig.add_links("libpng", os.getenv("LIBPNG_CONFIG"), "--ldflags") + pkgconfig.add_links("libpng") end end, }, libsodium = { compile_settings = function() - if os.istarget("windows") or os.istarget("macosx") then + if os.istarget("windows") then add_default_include_paths("libsodium") + else + pkgconfig.add_includes("libsodium") end end, link_settings = function() - if os.istarget("windows") or os.istarget("macosx") then + if os.istarget("windows") then add_default_lib_paths("libsodium") + add_default_links({ + win_names = { "libsodium" }, + }) + else + pkgconfig.add_links("libsodium") end - add_default_links({ - win_names = { "libsodium" }, - unix_names = { "sodium" }, - }) end, }, libxml2 = { @@ -451,9 +456,7 @@ if os.istarget("windows") then add_default_include_paths("libxml2") else - -- Support XML2_CONFIG for overriding the default (pkg-config --cflags libxml-2.0) - -- i.e. on OSX where it gets set in update-workspaces.sh - pkgconfig.add_includes("libxml-2.0", os.getenv("XML2_CONFIG")) + pkgconfig.add_includes("libxml-2.0") end if os.istarget("macosx") then -- libxml2 needs _REENTRANT or __MT__ for thread support; @@ -470,7 +473,7 @@ links { "libxml2" } filter { } else - pkgconfig.add_links("libxml-2.0", os.getenv("XML2_CONFIG")) + pkgconfig.add_links("libxml-2.0") end end, }, @@ -513,44 +516,45 @@ compile_settings = function() if os.istarget("windows") then add_default_include_paths("openal") + else + pkgconfig.add_includes("openal") end end, link_settings = function() if os.istarget("windows") then add_default_lib_paths("openal") + add_default_links({ + win_names = { "openal32" }, + dbg_suffix = "", + no_delayload = 1, -- delayload seems to cause errors on startup + }) + else + pkgconfig.add_links("openal") end - add_default_links({ - win_names = { "openal32" }, - unix_names = { "openal" }, - osx_frameworks = { "OpenAL" }, - dbg_suffix = "", - no_delayload = 1, -- delayload seems to cause errors on startup - }) end, }, opengl = { compile_settings = function() if os.istarget("windows") then add_default_include_paths("opengl") + elseif _OPTIONS["gles"] then + pkgconfig.add_includes("glesv2") + else + pkgconfig.add_includes("gl") end end, link_settings = function() if os.istarget("windows") then add_default_lib_paths("opengl") - end - if _OPTIONS["gles"] then - add_default_links({ - unix_names = { "GLESv2" }, - dbg_suffix = "", - }) - else add_default_links({ win_names = { "opengl32", "gdi32" }, - unix_names = { "GL" }, - osx_frameworks = { "OpenGL" }, dbg_suffix = "", no_delayload = 1, -- delayload seems to cause errors on startup }) + elseif _OPTIONS["gles"] then + pkgconfig.add_links("glesv2") + else + pkgconfig.add_links("gl") end end, }, @@ -559,16 +563,14 @@ if os.istarget("windows") then includedirs { libraries_dir .. "sdl2/include/SDL" } elseif not _OPTIONS["android"] then - -- Support SDL2_CONFIG for overriding the default (pkg-config sdl2) - -- i.e. on OSX where it gets set in update-workspaces.sh - pkgconfig.add_includes("sdl2", os.getenv("SDL2_CONFIG")) + pkgconfig.add_includes("sdl2") end end, link_settings = function() if os.istarget("windows") then add_default_lib_paths("sdl2") elseif not _OPTIONS["android"] then - pkgconfig.add_links("sdl2", os.getenv("SDL2_CONFIG")) + pkgconfig.add_links("sdl2") end end, }, @@ -629,31 +631,26 @@ compile_settings = function() if os.istarget("windows") then add_default_include_paths("vorbis") - elseif os.istarget("macosx") then - add_default_include_paths("libogg") - add_default_include_paths("vorbis") + else + pkgconfig.add_includes("ogg") + pkgconfig.add_includes("vorbisfile") end end, link_settings = function() if os.istarget("windows") then add_default_lib_paths("vorbis") - elseif os.istarget("macosx") then - add_default_lib_paths("libogg") - add_default_lib_paths("vorbis") - end - -- TODO: We need to force linking with these as currently - -- they need to be loaded explicitly on execution - if os.getversion().description == "OpenBSD" then add_default_links({ - unix_names = { "ogg", - "vorbis" }, + win_names = { "libvorbisfile" }, + }) + elseif os.getversion().description == "OpenBSD" then + -- TODO: We need to force linking with these as currently + -- they need to be loaded explicitly on execution + add_default_links({ + unix_names = { "ogg", "vorbis" }, }) + else + pkgconfig.add_links("vorbisfile") end - add_default_links({ - win_names = { "libvorbisfile" }, - unix_names = { "vorbisfile" }, - osx_names = { "vorbis", "vorbisenc", "vorbisfile", "ogg" }, - }) end, }, wxwidgets = { Index: build/premake/pkgconfig/pkgconfig.lua =================================================================== --- build/premake/pkgconfig/pkgconfig.lua +++ build/premake/pkgconfig/pkgconfig.lua @@ -1,5 +1,6 @@ local m = {} -m._VERSION = "1.1.0-dev" +m._VERSION = "1.1.1-dev" +m.alternative_module_path = nil local function os_capture(cmd) return io.popen(cmd, 'r'):read('*a'):gsub("\n", " ") @@ -8,7 +9,12 @@ function m.add_includes(lib, alternative_cmd, alternative_flags) local result if not alternative_cmd then - result = os_capture("pkg-config --cflags "..lib) + if m.alternative_module_path then + local alt_path = m.alternative_module_path..lib.."/lib/pkgconfig/" + result = os_capture("pkg-config --cflags "..lib.." --with-path="..alt_path) + else + result = os_capture("pkg-config --cflags "..lib) + end else if not alternative_flags then result = os_capture(alternative_cmd.." --cflags") @@ -42,7 +48,12 @@ function m.add_links(lib, alternative_cmd, alternative_flags) local result if not alternative_cmd then - result = os_capture("pkg-config --libs "..lib) + if m.alternative_module_path then + local alt_path = m.alternative_module_path..lib.."/lib/pkgconfig/" + result = os_capture("pkg-config --libs "..lib.." --with-path="..alt_path) + else + result = os_capture("pkg-config --libs "..lib) + end else if not alternative_flags then result = os_capture(alternative_cmd.." --libs") Index: build/workspaces/update-workspaces.sh =================================================================== --- build/workspaces/update-workspaces.sh +++ build/workspaces/update-workspaces.sh @@ -70,13 +70,8 @@ # Set minimal SDK version export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"} - # Set *_CONFIG variables on OS X, to override the path to e.g. sdl2-config - export GLOOX_CONFIG=${GLOOX_CONFIG:="$(pwd)/../../libraries/osx/gloox/bin/gloox-config"} - export ICU_CONFIG=${ICU_CONFIG:="$(pwd)/../../libraries/osx/icu/bin/icu-config"} - export LIBPNG_CONFIG=${PNG_CONFIG:="$(pwd)/../../libraries/osx/libpng/bin/libpng-config"} - export SDL2_CONFIG=${SDL2_CONFIG:="$(pwd)/../../libraries/osx/sdl2/bin/sdl2-config"} + # Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig) export WX_CONFIG=${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"} - export XML2_CONFIG=${XML2_CONFIG:="$(pwd)/../../libraries/osx/libxml2/bin/xml2-config"} fi # Don't want to build bundled libs on OS X Index: libraries/osx/build-osx-libs.sh =================================================================== --- libraries/osx/build-osx-libs.sh +++ libraries/osx/build-osx-libs.sh @@ -269,9 +269,10 @@ LIB_ARCHIVE="$LIB_VERSION.tar.gz" LIB_DIRECTORY="$LIB_VERSION" LIB_URL="ftp://xmlsoft.org/libxml2/" +PKGCONFIG_NAME="libxml-2.0" -mkdir -p libxml2 -pushd libxml2 > /dev/null +mkdir -p $PKGCONFIG_NAME +pushd $PKGCONFIG_NAME > /dev/null if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] then @@ -483,19 +484,17 @@ popd > /dev/null # -------------------------------------------------------------- +# Dependency of vorbis echo -e "Building libogg..." LIB_VERSION="${OGG_VERSION}" LIB_ARCHIVE="$LIB_VERSION.tar.gz" LIB_DIRECTORY="$LIB_VERSION" LIB_URL="http://downloads.xiph.org/releases/ogg/" +PKGCONFIG_NAME="ogg" -# Dependency of vorbis -# we can install them in the same directory for convenience -mkdir -p libogg -mkdir -p vorbis - -pushd libogg > /dev/null +mkdir -p PKGCONFIG_NAME +pushd PKGCONFIG_NAME > /dev/null OGG_DIR="$(pwd)" if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] @@ -527,6 +526,8 @@ LIB_DIRECTORY="$LIB_VERSION" LIB_URL="http://downloads.xiph.org/releases/vorbis/" +mkdir -p vorbis +ln -sf vorbisfile vorbis pushd vorbis > /dev/null if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] @@ -747,9 +748,10 @@ LIB_ARCHIVE="$LIB_VERSION-src.tgz" LIB_DIRECTORY="icu" LIB_URL="https://github.com/unicode-org/icu/releases/download/release-67-1/" +PKGCONFIG_NAME="icu-i18n" -mkdir -p $LIB_DIRECTORY -pushd icu > /dev/null +mkdir -p $PKGCONFIG_NAME +pushd $PKGCONFIG_NAME > /dev/null if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] then @@ -791,8 +793,8 @@ LIB_DIRECTORY="$LIB_VERSION" LIB_URL="http://enet.bespin.org/download/" -mkdir -p enet -pushd enet > /dev/null +mkdir -p libenet +pushd libenet > /dev/null if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]] then