diff --git a/build-mg-win32.sh b/build-mg-win32.sh index 31720c0c9..17467083a 100755 --- a/build-mg-win32.sh +++ b/build-mg-win32.sh @@ -2,10 +2,11 @@ NUMCORES=`cat /proc/cpuinfo | grep -cE '^processor'` +#PROJECT_SOURCE_DIR="$(dirname $(readlink -f $0))" mkdir -p build-win32 cd build-win32 -cmake -DCMAKE_TOOLCHAIN_FILE=../mk/cmake/Modules/Toolchain-mingw32.cmake -DXERCESC_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/include -DXERCESC_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/lib -DXERCESC_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/lib/libxerces-c2_8_0.dll -DOPENAL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/openal-soft-1.12.854 -DOPENAL_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/OpenAL32.dll -DOGG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/libogg-1.2.1/include -DOGG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libogg.dll -DVORBIS_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libvorbis.dll -DVORBIS_FILE_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libvorbisfile.dll -DLUA_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/lua-5.1/src -DLUA_LIBRARIES=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/lua5.1.dll -DJPEG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/jpeg-8b -DJPEG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libjpeg.dll -DZLIB_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/zlib-1.2.5 -DZLIB_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libz.a -DPNG_PNG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/lpng141 -DPNG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libpng.dll -DCURL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/curl-7.21.3/include -DCURL_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/libs/libcurl.dll -DSDL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/SDL-1.2.x/include -DCMAKE_INSTALL_PREFIX= -DMINIUPNPC_VERSION_PRE1_6=ON -DWANT_STATIC_LIBS=ON .. +cmake -DCMAKE_TOOLCHAIN_FILE=../mk/cmake/Modules/Toolchain-mingw32.cmake -DXERCESC_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/include -DXERCESC_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/lib -DXERCESC_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/lib/libxerces-c2_8_0.dll -DOPENAL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/openal-soft-1.12.854 -DOPENAL_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/OpenAL32.dll -DOGG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/libogg-1.2.1/include -DOGG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libogg.dll -DVORBIS_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libvorbis.dll -DVORBIS_FILE_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libvorbisfile.dll -DLUA_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/lua-5.1/src -DLUA_LIBRARIES=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/lua5.1.dll -DJPEG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/jpeg-8b -DJPEG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libjpeg.dll -DZLIB_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/zlib-1.2.5 -DZLIB_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libz.a -DPNG_PNG_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/lpng141 -DPNG_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libpng.dll -DCURL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/curl-7.21.3/include -DCURL_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libcurl.dll -DSDL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/SDL-1.2.x/include -DFREETYPE_INCLUDE_DIR_ft2build=${PROJECT_SOURCE_DIR}/source/win32_deps/freetype-2.4.8/include -DFREETYPE_INCLUDE_DIR_freetype2=${PROJECT_SOURCE_DIR}/source/win32_deps/freetype-2.4.8/include/freetype -DFREETYPE_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libfreetype-6.dll -DFTGL_INCLUDE_DIR=${PROJECT_SOURCE_DIR}/source/win32_deps/ftgl-2.1.3~rc5/src -DFTGL_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/libftgl.a -DGLEW_INCLUDE_PATH=${PROJECT_SOURCE_DIR}/source/win32_deps/glew-1.7.0/include -DGLEW_LIBRARY=${PROJECT_SOURCE_DIR}/source/win32_deps/lib/glew32.dll -DCMAKE_INSTALL_PREFIX= -DWANT_STATIC_LIBS=ON .. make -j$NUMCORES diff --git a/mk/linux/mg-version.sh b/mk/linux/mg-version.sh index 40b578295..e9959d29f 100755 --- a/mk/linux/mg-version.sh +++ b/mk/linux/mg-version.sh @@ -4,10 +4,10 @@ # Written by Mark Vejvoda # Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+ -OLD_MG_VERSION=3.6.0.1 -OLD_MG_VERSION_BINARY=3.6.0 +OLD_MG_VERSION=3.6.0.2 +OLD_MG_VERSION_BINARY=3.6.0.2 #MG_VERSION=3.6.1-dev -MG_VERSION=3.6.0.2 +MG_VERSION=3.6.0.3 if [ "$1" = "--oldversion" ]; then echo "$OLD_MG_VERSION" diff --git a/mk/windoze/CopyWindowsRuntimeDlls.bat b/mk/windoze/CopyWindowsRuntimeDlls.bat index 592f4418c..abf708bf4 100644 --- a/mk/windoze/CopyWindowsRuntimeDlls.bat +++ b/mk/windoze/CopyWindowsRuntimeDlls.bat @@ -2,5 +2,6 @@ rem if not exist ..\..\data\glest_game\dsound.dll copy dsound.dll ..\..\data\glest_game\ if not exist ..\..\data\glest_game\xerces-c_3_0.dll copy ..\..\source\win32_deps\bin\xerces-c_3_0.dll ..\..\data\glest_game\ +if not exist ..\..\data\glest_game\openal32.dll copy ..\..\source\win32_deps\bin\openal32.dll ..\..\data\glest_game\ if not "%1" == "nopause" pause diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index 9f436b112..c4082f245 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -147,7 +147,7 @@ Config::Config(std::pair type, std::pair f #if defined(CUSTOM_DATA_INSTALL_PATH) if(foundPath == false) { - foundPath = tryCustomPath(cfgType, fileName, TOSTRING(CUSTOM_DATA_INSTALL_PATH)); + foundPath = tryCustomPath(cfgType, fileName, formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); } #endif diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 5389355a1..5eddb1b19 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -2441,7 +2441,7 @@ int glestMain(int argc, char** argv) { #if defined(CUSTOM_DATA_INSTALL_PATH) - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",TOSTRING(CUSTOM_DATA_INSTALL_PATH)); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)).c_str()); #endif const int knownArgCount = sizeof(GAME_ARGS) / sizeof(GAME_ARGS[0]); diff --git a/source/shared_lib/CMakeLists.txt b/source/shared_lib/CMakeLists.txt index c6b379713..3700b6d2f 100644 --- a/source/shared_lib/CMakeLists.txt +++ b/source/shared_lib/CMakeLists.txt @@ -293,6 +293,30 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${IRCCLIENT_LIBRARY}) endif() + set(CMAKE_REQUIRED_INCLUDES "${IRCCLIENT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_LIBRARIES "${IRCCLIENT_LIBRARY}") + check_cxx_source_runs(" + #include + #include + #include + int main() + { + unsigned int high = 0; + unsigned int low = 0; + irc_get_version(&high,&low); + if( (high == 1 && low >= 6) || (high > 1)) { + return 0; + } + throw 1; + }" + HAS_LIBIRCCLIENT_1_6) + + IF(HAS_LIBIRCCLIENT_1_6) + message(STATUS "Found HAS_LIBIRCCLIENT_1_6: ${HAS_LIBIRCCLIENT_1_6}") + ELSE() + ADD_DEFINITIONS(-DLIBIRCCLIENT_PRE1_6) + ENDIF() + IF(WIN32) SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/socket.cpp) SET(MG_SOURCE_FILES ${MG_SOURCE_FILES} ${PROJECT_SOURCE_DIR}/source/shared_lib/sources/platform/posix/ircclient.cpp) diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index c4e0ad9de..98b53d29d 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -211,6 +211,7 @@ bool EndsWith(const string &str, const string& key); void endPathWithSlash(string &path, bool requireOSSlash=false); void trimPathWithStartingSlash(string &path); void updatePathClimbingParts(string &path); +string formatPath(string path); string replaceAll(string& context, const string& from, const string& to); bool removeFile(string file); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 967180107..f44abbfdc 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -500,6 +500,13 @@ void endPathWithSlash(string &path,bool requireOSSlash) { } } +string formatPath(string path) { + replaceAll(path, "\"", ""); + replaceAll(path, "//", "/"); + + return path; +} + void trimPathWithStartingSlash(string &path) { if(StartsWith(path, "/") == true || StartsWith(path, "\\") == true) { path.erase(path.begin(),path.begin()+1); diff --git a/source/shared_lib/sources/platform/posix/ircclient.cpp b/source/shared_lib/sources/platform/posix/ircclient.cpp index b09c972d7..764f62362 100644 --- a/source/shared_lib/sources/platform/posix/ircclient.cpp +++ b/source/shared_lib/sources/platform/posix/ircclient.cpp @@ -15,6 +15,11 @@ #include "platform_common.h" #include "libircclient.h" +// upstream moved some defines into new headers as of 1.6 +#ifndef LIBIRCCLIENT_PRE1_6 +#include "libirc_rfcnumeric.h" +#endif + #include #include #include diff --git a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp index fd84e740b..33fa0f1aa 100644 --- a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp +++ b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp @@ -79,11 +79,11 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits, #ifndef WIN32 string mg_icon_file = ""; #if defined(CUSTOM_DATA_INSTALL_PATH_VALUE) - if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png")) { - mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.png"; + if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png")) { + mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.png"; } - else if(fileExists(CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp")) { - mg_icon_file = CUSTOM_DATA_INSTALL_PATH_VALUE + "megaglest.bmp"; + else if(fileExists(formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp")) { + mg_icon_file = formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH_VALUE)) + "megaglest.bmp"; } #endif diff --git a/source/shared_lib/sources/util/properties.cpp b/source/shared_lib/sources/util/properties.cpp index cd05523ab..5fa7683c5 100644 --- a/source/shared_lib/sources/util/properties.cpp +++ b/source/shared_lib/sources/util/properties.cpp @@ -215,20 +215,15 @@ std::map Properties::getTagReplacementValues(std::map *mapTag replaceAll(value, "{APPLICATIONPATH}", Properties::applicationPath); #if defined(CUSTOM_DATA_INSTALL_PATH) - replaceAll(value, "$APPLICATIONDATAPATH", TOSTRING(CUSTOM_DATA_INSTALL_PATH)); - replaceAll(value, "%%APPLICATIONDATAPATH%%", TOSTRING(CUSTOM_DATA_INSTALL_PATH)); - replaceAll(value, "{APPLICATIONDATAPATH}", TOSTRING(CUSTOM_DATA_INSTALL_PATH)); - - //replaceAll(value, "$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); - //replaceAll(value, "%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/"); + replaceAll(value, "$APPLICATIONDATAPATH", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); + replaceAll(value, "%%APPLICATIONDATAPATH%%", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); + replaceAll(value, "{APPLICATIONDATAPATH}", formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH))); #else replaceAll(value, "$APPLICATIONDATAPATH", Properties::applicationPath); replaceAll(value, "%%APPLICATIONDATAPATH%%", Properties::applicationPath); replaceAll(value, "{APPLICATIONDATAPATH}", Properties::applicationPath); - //replaceAll(value, "$COMMONDATAPATH", Properties::applicationPath + "/commondata/"); - //replaceAll(value, "%%COMMONDATAPATH%%", Properties::applicationPath + "/commondata/"); #endif replaceAll(value, "$GAMEVERSION", Properties::gameVersion);