From 0cd441867adedc5add8b65a42d0f156e906ab25e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 29 Mar 2011 16:22:12 +0300 Subject: Add fixes for localisation dir in linux portable build and error detection. --- configure.ac | 11 +++++++++++ nightly/buildlinux.sh | 12 ++++++++++-- nightly/buildwindows.sh | 13 +++++++++++++ src/Makefile.am | 4 ++++ src/main.cpp | 10 ++++++++-- 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 2b79d4261..74ed0d6b1 100755 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,17 @@ esac],[with_manaserv=false]) AM_CONDITIONAL(ENABLE_MANASERV, test x$with_manaserv = xtrue) +# Enable portable +AC_ARG_ENABLE(portable, +[ --enable-portable Turn on portable mode for linux], +[case "${enableval}" in + yes) portable_enabled=true ;; + no) portable_enabled=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-portable) ;; +esac],[portable_enabled=false]) + +AM_CONDITIONAL(ENABLE_PORTABLE, test x$portable_enabled = xtrue) + AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/nightly/buildlinux.sh b/nightly/buildlinux.sh index ebc07dd87..43eb06883 100755 --- a/nightly/buildlinux.sh +++ b/nightly/buildlinux.sh @@ -2,13 +2,21 @@ cd .. -DIR=`pwd` DSTDIR=packaging/build/linux autoreconf -i #make clean -./configure --datadir=. localedir=locale +./configure --enable-portable=yes +result=$? +if [ "$result" != 0 ]; then + exit $result +fi + make +result=$? +if [ "$result" != 0 ]; then + exit $result +fi if [ -e src/manaplus ]; then diff --git a/nightly/buildwindows.sh b/nightly/buildwindows.sh index ede9f0f04..286471d4c 100755 --- a/nightly/buildwindows.sh +++ b/nightly/buildwindows.sh @@ -5,11 +5,24 @@ dir=`pwd` cd .. export PATH=/usr/i586-mingw32msvc/bin:$PATH CXXFLAGS="-Wall -g0 -O2" cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain.nightly . +result=$? +if [ "$result" != 0 ]; then + exit $result +fi make -j5 2>make.log +result=$? +if [ "$result" != 0 ]; then + exit $result +fi cd ./packaging/windows ./make-translations.sh +result=$? +if [ "$result" != 0 ]; then + exit $result +fi + makensis -DDLLDIR=$dir/../packaging/windows/libs/dll/ \ -DPRODUCT_VERSION="nightly-$1" \ -DEXESUFFIX=/src \ diff --git a/src/Makefile.am b/src/Makefile.am index 825b40718..fb698aee3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,10 @@ manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \ -DLOCALEDIR=\""$(localedir)"\" \ -Wall +if ENABLE_PORTABLE +manaplus_CXXFLAGS += -DENABLE_PORTABLE +endif + manaplus_SOURCES = gui/widgets/avatarlistbox.cpp \ gui/widgets/avatarlistbox.h \ gui/widgets/battletab.cpp \ diff --git a/src/main.cpp b/src/main.cpp index 6efa736e7..beb23a72c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -195,8 +195,13 @@ static void initInternationalization() putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str()); // mingw doesn't like LOCALEDIR to be defined for some reason bindtextdomain("manaplus", "translations/"); +#else +#if ENABLE_PORTABLE + bindtextdomain("manaplus", (std::string(PHYSFS_getBaseDir()) + + "../locale/").c_str()); #else bindtextdomain("manaplus", LOCALEDIR); +#endif #endif setlocale(LC_MESSAGES, ""); bind_textdomain_codeset("manaplus", "UTF-8"); @@ -244,8 +249,6 @@ int main(int argc, char *argv[]) return 0; } - initInternationalization(); - // Initialize PhysicsFS if (!PHYSFS_init(argv[0])) { @@ -253,6 +256,9 @@ int main(int argc, char *argv[]) << PHYSFS_getLastError() << std::endl; return 1; } + + initInternationalization(); + atexit((void(*)()) PHYSFS_deinit); initXML(); -- cgit v1.2.3-70-g09d2