diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua index 73c6ccdb77..ce6a67162f 100644 --- a/build/premake/extern_libs4.lua +++ b/build/premake/extern_libs4.lua @@ -496,13 +496,13 @@ extern_lib_defs = { }, miniupnpc = { compile_settings = function() - if not _OPTIONS["with-system-miniupnpc"] then - add_source_include_paths("miniupnpc") + if os.is("windows") or os.is("macosx") then + add_default_include_paths("miniupnpc") end end, link_settings = function() - if not _OPTIONS["with-system-miniupnpc"] then - add_source_lib_paths("miniupnpc") + if os.is("windows") or os.is("macosx") then + add_default_lib_paths("miniupnpc") end add_default_links({ win_names = { "miniupnpc" }, diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 3ca8cf5fc5..de94e0b718 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -9,7 +9,6 @@ newoption { trigger = "minimal-flags", description = "Only set compiler/linker f newoption { trigger = "outpath", description = "Location for generated project files" } newoption { trigger = "sdl2", description = "Experimental build using SDL 2" } newoption { trigger = "with-c++11", description = "Enable C++11 on GCC" } -newoption { trigger = "with-system-miniupnpc", description = "Search standard paths for libminiupnpc, instead of using bundled copy" } newoption { trigger = "with-system-mozjs24", description = "Search standard paths for libmozjs24, instead of using bundled copy" } newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } diff --git a/build/workspaces/update-workspaces.sh b/build/workspaces/update-workspaces.sh index 843b42035e..b5e3f8bf0e 100644 --- a/build/workspaces/update-workspaces.sh +++ b/build/workspaces/update-workspaces.sh @@ -49,8 +49,7 @@ do case $i in --without-nvtt ) without_nvtt=true; premake_args="${premake_args} --without-nvtt" ;; --with-system-nvtt ) with_system_nvtt=true; premake_args="${premake_args} --with-system-nvtt" ;; - --with-system-enet ) echo "NOTE: the --with-system-enet option is deprecated, system ENet is now required"; echo ;; - --with-system-miniupnpc ) with_system_miniupnpc=true; premake_args="${premake_args} --with-system-miniupnpc" ;; + --with-system-miniupnpc ) echo "NOTE: the --with-system-miniupnpc option is deprecated, system miniupnpc is now required"; echo ;; --with-system-mozjs24 ) with_system_mozjs24=true; premake_args="${premake_args} --with-system-mozjs24" ;; --enable-atlas ) enable_atlas=true ;; --disable-atlas ) enable_atlas=false ;; @@ -73,7 +72,6 @@ if [ "`uname -s`" = "Darwin" ]; then # 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 SDL_CONFIG=${SDL_CONFIG:="$(pwd)/../../libraries/osx/sdl/bin/sdl-config"} export SDL2_CONFIG=${SDL2_CONFIG:="$(pwd)/../../libraries/osx/sdl2/bin/sdl2-config"} export WX_CONFIG=${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"} export XML2_CONFIG=${XML2_CONFIG:="$(pwd)/../../libraries/osx/libxml2/bin/xml2-config"} diff --git a/libraries/LICENSE.txt b/libraries/LICENSE.txt index e767d2a44c..5788d8f2aa 100644 --- a/libraries/LICENSE.txt +++ b/libraries/LICENSE.txt @@ -14,9 +14,6 @@ win32/ contains headers and precompiled static libs for Windows builds. source/fcollada MIT (see src/FCollada/Copyright.txt) - source/miniupnpc - BSD - source/nvtt MIT - see src/NVIDIA_Texture_Tools_LICENSE.txt @@ -53,6 +50,9 @@ win32/ contains headers and precompiled static libs for Windows builds. win32/libxml2 MIT + win32/miniupnpc + BSD + win32/openal LGPL v2.0 (or later) diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh index 6ba6566bb4..cc6e4e3ac7 100755 --- a/libraries/osx/build-osx-libs.sh +++ b/libraries/osx/build-osx-libs.sh @@ -42,12 +42,12 @@ NSPR_VERSION="4.10.3" # OS X only includes part of ICU, and only the dylib ICU_VERSION="icu4c-52_1" ENET_VERSION="enet-1.3.12" +MINIUPNPC_VERSION="miniupnpc-1.9" # -------------------------------------------------------------- # Bundled with the game: # * SpiderMonkey 24 # * NVTT # * FCollada -# * MiniUPnPc # -------------------------------------------------------------- # Provided by OS X: # * OpenAL @@ -112,7 +112,7 @@ download_lib() if [ ! -e $filename ]; then echo "Downloading $filename" - curl -L -O ${url}${filename} || die "Download of $url$filename failed" + curl -L -o ${filename} ${url}${filename} || die "Download of $url$filename failed" fi } @@ -352,7 +352,7 @@ then mkdir -p build-release pushd build-release - CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --with-expat=builtin --with-libjpeg=builtin --with-png=builtin --without-libtiff --without-sdl --without-x" + CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-macosx_arch=$ARCH --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --with-expat=builtin --with-libjpeg=builtin --with-png=builtin --without-libtiff --without-sdl --without-x" # wxWidgets configure now defaults to targeting 10.5, if not specified, # but that conflicts with our flags if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then @@ -549,7 +549,7 @@ then popd # TODO: how can we not build the dylibs? rm -f lib/*.dylib - touch .already-built + touch .already-built else already_built fi @@ -619,6 +619,39 @@ else fi popd > /dev/null +# -------------------------------------------------------------- +echo -e "Building MiniUPnPc..." + +LIB_VERSION="${MINIUPNPC_VERSION}" +LIB_ARCHIVE="$LIB_VERSION.tar.gz" +LIB_DIRECTORY="$LIB_VERSION" +LIB_URL="http://miniupnp.tuxfamily.org/files/download.php?file=" + +mkdir -p miniupnpc +pushd miniupnpc > /dev/null + +if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ .already-built -ot $LIB_DIRECTORY ]] +then + INSTALL_DIR="$(pwd)" + + rm -f .already-built + download_lib $LIB_URL $LIB_ARCHIVE + + rm -rf $LIB_DIRECTORY bin include lib share + tar -xf $LIB_ARCHIVE + pushd $LIB_DIRECTORY + + # patch miniupnpc to fix symbol visibility (fixed upstream, see https://github.com/miniupnp/miniupnp/issues/63 ) + (patch -p0 -i../../patches/miniupnpc-clang-fix.patch && make clean && CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS} && INSTALLPREFIX="$INSTALL_DIR" make install) || die "MiniUPnPc build failed" + popd + # TODO: how can we not build the dylibs? + rm -f lib/*.dylib + touch .already-built +else + already_built +fi +popd > /dev/null + # -------------------------------------------------------------------- # The following libraries are shared on different OSes and may # be customized, so we build and install them from bundled sources @@ -751,28 +784,3 @@ else already_built fi popd > /dev/null - -# -------------------------------------------------------------- -# MiniUPnPc - no install -echo -e "Building MiniUPnPc..." - -pushd ../source/miniupnpc > /dev/null - -if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] -then - rm -f .already-built - rm -f lib/*.a - pushd src - rm -rf output - mkdir -p ../lib - - (make clean && CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS make ${JOBS}) || die "MiniUPnPc build failed" - - cp libminiupnpc.a ../lib/ - - popd - touch .already-built -else - already_built -fi -popd > /dev/null diff --git a/libraries/osx/patches/miniupnpc-clang-fix.patch b/libraries/osx/patches/miniupnpc-clang-fix.patch new file mode 100644 index 0000000000..b1cfba2968 --- /dev/null +++ b/libraries/osx/patches/miniupnpc-clang-fix.patch @@ -0,0 +1,27 @@ +Index: declspec.h +=================================================================== +--- declspec.h ++++ declspec.h +@@ -5,11 +5,15 @@ + #ifdef MINIUPNP_EXPORTS + #define LIBSPEC __declspec(dllexport) + #else +- #define LIBSPEC __declspec(dllimport) +- #endif +-#else +- #define LIBSPEC +-#endif ++ #define LIBSPEC __declspec(dllimport) ++ #endif ++#else ++ #if defined(__GNUC__) && __GNUC__ >= 4 ++ #define LIBSPEC __attribute__ ((visibility ("default"))) ++ #else ++ #define LIBSPEC ++ #endif ++#endif ++ ++#endif + +-#endif +-