From 971596f5c35c82f9698c2866c16c7684cd6184eb Mon Sep 17 00:00:00 2001 From: Larry Hajali Date: Thu, 13 May 2010 00:26:25 +0200 Subject: games/glest: Updated for version 3.2.2 --- games/glest/README | 36 ++-- games/glest/doinst.sh | 15 -- games/glest/glest-editor.desktop | 5 +- games/glest/glest-g3d-viewer.desktop | 10 + games/glest/glest-xerces-c.patch | 41 ---- games/glest/glest.SlackBuild | 82 +++++--- games/glest/glest.desktop | 7 +- games/glest/glest.info | 6 +- games/glest/glest.sh | 53 ----- games/glest/patches/g3d_viewer.patch | 277 +++++++++++++++++++++++++ games/glest/patches/glest-3.2.2-glibc210.patch | 10 + games/glest/patches/glest-home-directory.patch | 143 +++++++++++++ games/glest/patches/glest-xerces-c.patch | 41 ++++ games/glest/slack-desc | 10 +- 14 files changed, 571 insertions(+), 165 deletions(-) create mode 100644 games/glest/glest-g3d-viewer.desktop delete mode 100644 games/glest/glest-xerces-c.patch delete mode 100644 games/glest/glest.sh create mode 100644 games/glest/patches/g3d_viewer.patch create mode 100644 games/glest/patches/glest-3.2.2-glibc210.patch create mode 100644 games/glest/patches/glest-home-directory.patch create mode 100644 games/glest/patches/glest-xerces-c.patch (limited to 'games') diff --git a/games/glest/README b/games/glest/README index 50dcd58053..889c3c2cb2 100644 --- a/games/glest/README +++ b/games/glest/README @@ -1,20 +1,28 @@ -Glest is a free 3D real-time strategy game, where you control -the armies of two different factions: Tech, which is mainly -composed of warriors and mechanical devices, and Magic, that -prefers mages and summoned creatures in the battlefield. - -Requires: glest-data, xerces-c, lua, jam and OpenAL. +Glest is a free 3D real-time strategy game, where you control the armies of +two different factions: Tech, which is mainly composed of warriors and +mechanical devices, and Magic, that prefers mages and summoned creatures +in the battlefield. +This requires glest-data, xerces-c, lua, jam, and OpenAL. Optional build requirements: wxPython. - Optional addons: glest-megapack. -According to the manpage, you should go into the Options menu -and run "Auto config" before the first time you play the game. +According to the manpage, you should go into the Options menu and run +"Auto config" before the first time you play the game. + +If you'd like to compile wxPython to have the additional map editor +(ie. glest_editor) then pass HAVE_WX=yes to the script: + HAVE_WX=yes ./glest.SlackBuild + +The map editor will only build with wxPython. If you pass HAVE_WX=yes +and have wxGTK installed then the slackbuild will fail. -If you would like to use the "glest_editor" then pass USE_WX=yes -to the slackbuild. In order to compile with wxPython pass: -USE_WX=yes ./glest.SlackBuild +Additional translations can be added to glest from: +http://www.glest.org/files/contrib/translations/ +Just unzip the file(s) and put the appropriate *.lng file into +/usr/share/glest/data/lang/ directory. It will be automatically picked +up at next game play. -Note: This slackbuild will fail if USE_WX=yes and wxGTK is -installed. +Note: According to the readme_linux.txt file, glest doesn't seem to work +with the mesa drivers. Using the ATI or NVIDIA drivers will work. For any +additional game-specific issues, see readme_linux.txt in the docs directory. diff --git a/games/glest/doinst.sh b/games/glest/doinst.sh index 88b9c5119c..4e8ba7071d 100644 --- a/games/glest/doinst.sh +++ b/games/glest/doinst.sh @@ -1,18 +1,3 @@ -config() { - NEW="$1" - OLD="$(dirname $NEW)/$(basename $NEW .new)" - # If there's no config file by that name, mv it over: - if [ ! -r $OLD ]; then - mv $NEW $OLD - elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then - # toss the redundant copy - rm $NEW - fi - # Otherwise, we leave the .new copy for the admin to consider... -} - -config etc/glest/glest.ini.new - if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 fi diff --git a/games/glest/glest-editor.desktop b/games/glest/glest-editor.desktop index d9482b9abf..4b21d53e12 100644 --- a/games/glest/glest-editor.desktop +++ b/games/glest/glest-editor.desktop @@ -1,10 +1,9 @@ [Desktop Entry] -Encoding=UTF-8 -Version=3.2.2 +Version=1.0 Name=Glest Map Editor Comment=Glest map editor Exec=glest_editor -Icon=/usr/share/pixmaps/glest.xpm +Icon=glest Terminal=0 Type=Application Categories=Application;Game;StrategyGame; diff --git a/games/glest/glest-g3d-viewer.desktop b/games/glest/glest-g3d-viewer.desktop new file mode 100644 index 0000000000..6ff860ea45 --- /dev/null +++ b/games/glest/glest-g3d-viewer.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=Glest g3d Viewer +Comment=Glest g3d viewer +Exec=glest_g3dviewer +Icon=glest +Terminal=false +Type=Application +Categories=Application;Game;StrategyGame; +StartupNotify=false diff --git a/games/glest/glest-xerces-c.patch b/games/glest/glest-xerces-c.patch deleted file mode 100644 index f7582060b3..0000000000 --- a/games/glest/glest-xerces-c.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- source/shared_lib/sources/xml/xml_parser.cpp.old 2008-02-16 16:01:28.000000000 +0300 -+++ source/shared_lib/sources/xml/xml_parser.cpp 2009-03-19 18:28:08.000000000 +0300 -@@ -87,10 +87,17 @@ - - try{ - ErrorHandler errorHandler; -+#if XERCES_VERSION_MAJOR < 3 - DOMBuilder *parser= (static_cast(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); - parser->setErrorHandler(&errorHandler); - parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true); - parser->setFeature(XMLUni::fgDOMValidation, true); -+#else -+ DOMLSParser *parser = (static_cast(implementation))->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0); -+ DOMConfiguration *config = parser->getDomConfig(); -+ config->setParameter(XMLUni::fgXercesSchemaFullChecking, true); -+ config->setParameter(XMLUni::fgDOMValidate, true); -+#endif - DOMDocument *document= parser->parseURI(path.c_str()); - - if(document==NULL){ -@@ -119,9 +126,20 @@ - } - - LocalFileFormatTarget file(path.c_str()); -+#if XERCES_VERSION_MAJOR < 3 - DOMWriter* writer = implementation->createDOMWriter(); - writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); - writer->writeNode(&file, *document); -+#else -+ DOMLSSerializer *serializer = implementation->createLSSerializer(); -+ DOMLSOutput* output=implementation->createLSOutput(); -+ DOMConfiguration* config=serializer->getDomConfig(); -+ config->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,true); -+ output->setByteStream(&file); -+ serializer->write(document,output); -+ output->release(); -+ serializer->release(); -+#endif - document->release(); - } - catch(const DOMException &e){ diff --git a/games/glest/glest.SlackBuild b/games/glest/glest.SlackBuild index 4ec27a09d2..aa3bca3a64 100644 --- a/games/glest/glest.SlackBuild +++ b/games/glest/glest.SlackBuild @@ -2,12 +2,30 @@ # Slackware build script for glest -# Written by Larry Hajali +# Copyright 2009 Larry Hajali +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=glest VERSION=${VERSION:-3.2.2} ARCH=${ARCH:-i486} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} CWD=$(pwd) @@ -40,18 +58,16 @@ cd $PRGNAM-$VERSION unzip $CWD/${PRGNAM}_source_${VERSION}.zip # Fix up files so they aren't in MS format. -# Taken from the glest slackbuild availabe at -# http://ftp.darkstarlinux.ro/. +# Taken from the glest slackbuild available +# at http://ftp.darkstarlinux.ro/. find source mk docs -type f | while read FILE; do echo $FILE sed \ -e 's|\x0D$||g' \ < $FILE > $FILE.new - mv -f $FILE.new $FILE done -# Fix permissions. chown -R root:root . find . \ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ @@ -61,19 +77,33 @@ find . \ # Allow glest to be built against xerces-c vs. 2.x or 3.x. # From the gentoo guys. http://bugs.gentoo.org/show_bug.cgi?id=263217 -patch -p0 < $CWD/glest-xerces-c.patch +patch -p0 < $CWD/patches/glest-xerces-c.patch +# Fix for the home directory. This gets rid of the wrapper script. +patch -p0 < $CWD/patches/glest-home-directory.patch +# Add support for the glest_g3dviewer for linux. +patch -p0 < $CWD/patches/g3d_viewer.patch +# Fix glest to build against newer glibc versions. +patch -p0 < $CWD/patches/glest-3.2.2-glibc210.patch # Fix an innocuous version mismatch in configure.ac. -sed -i "s|3.1.2|$VERSION|" mk/linux/configure.ac +sed -i "s|3.1.2|${VERSION}|" mk/linux/configure.ac +# Fix the config file for languages. +sed -i 's|\.lng||' mk/linux/$PRGNAM.ini 2>/dev/null || true +# Determine if we compile against wxPython for the optional map editor. if [ "$HAVE_WX" == "yes" ]; then unset USE_WX else - USE_WX="--with-wx-config=disable_wx" + USE_WX="--with-wx-config=disabled_wx" fi cd mk/linux - [ -f ./configure ] || chmod a+x autogen.sh && ./autogen.sh + if [ ! -f configure ]; then + chmod a+x autogen.sh + ./autogen.sh + else + chmod +x configure + fi CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ @@ -87,30 +117,24 @@ cd mk/linux --program-prefix="" \ --program-suffix="" \ $USE_WX \ - --build=$ARCH-slackware-linux \ - --host=$ARCH-slackware-linux + --build=$ARCH-slackware-linux jam -q cd - # Glest doesn't come with a nice installer. So we'll do it ourselves. -install -d -m 0755 $PKG/usr/{bin,share/$PRGNAM,lib${LIBDIRSUFFIX}/$PRGNAM} -install -d -m 0755 $PKG/etc/$PRGNAM +install -d -m 0755 $PKG/usr/{bin,share/$PRGNAM} +install -m 0755 mk/linux/$PRGNAM $PKG/usr/bin +install -m 0644 mk/linux/$PRGNAM.ini $PKG/usr/share/$PRGNAM cp -ar source/glest_game/* $PKG/usr/share/$PRGNAM -install -m 0755 mk/linux/$PRGNAM $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM -install -m 0644 mk/linux/$PRGNAM.ini $PKG/etc/$PRGNAM -install -m 0755 $CWD/$PRGNAM.sh $PKG/usr/bin/$PRGNAM.sh -sed -i "s|\/lib\/|\/lib${LIBDIRSUFFIX}\/|g" $PKG/usr/bin/$PRGNAM.sh # Install the editor if the user requests it. -if [ "$HAVE_WX" == "yes" ]; then +if [ "${HAVE_WX}" == "yes" ]; then install -m 0755 mk/linux/${PRGNAM}_editor $PKG/usr/bin + install -m 0755 mk/linux/${PRGNAM}_g3dviewer $PKG/usr/bin fi -# Let's not clobber this file on upgrades. -mv $PKG/etc/$PRGNAM/$PRGNAM.ini $PKG/etc/$PRGNAM/$PRGNAM.ini.new - ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ xargs strip --strip-unneeded 2> /dev/null || true @@ -124,21 +148,23 @@ gzip -9 $PKG/usr/man/man?/*.? # Make a desktop item. mkdir -p $PKG/usr/share/{applications,pixmaps} -cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop -install -m 0644 $CWD/$PRGNAM.xpm $PKG/usr/share/pixmaps -if [ "$HAVE_WX" == "yes" ]; then +install -m 0644 $CWD/$PRGNAM.desktop $PKG/usr/share/applications/ +install -m 0644 $CWD/$PRGNAM.xpm $PKG/usr/share/pixmaps/ +if [ "${HAVE_WX}" == "yes" ]; then install -m 0644 $CWD/$PRGNAM-editor.desktop \ - $PKG/usr/share/applications/$PRGNAM-editor.desktop + $PKG/usr/share/applications/ + install -m 0644 $CWD/$PRGNAM-g3d-viewer.desktop \ + $PKG/usr/share/applications/ fi -chmod 0644 $PKG/usr/share/applications/* mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a docs/* $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +chmod 0644 $PKG/usr/doc/$PRGNAM-$VERSION/* mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/games/glest/glest.desktop b/games/glest/glest.desktop index 8d9cd23c14..c834ef2cc7 100644 --- a/games/glest/glest.desktop +++ b/games/glest/glest.desktop @@ -1,10 +1,9 @@ [Desktop Entry] -Encoding=UTF-8 -Version=3.2.2 +Version=1.0 Name=Glest Comment=Cross-platform 3D realtime strategy game -Exec=glest.sh -Icon=/usr/share/pixmaps/glest.xpm +Exec=glest +Icon=glest Terminal=0 Type=Application Categories=Application;Game;StrategyGame; diff --git a/games/glest/glest.info b/games/glest/glest.info index 5b43707fc3..61132b1f69 100644 --- a/games/glest/glest.info +++ b/games/glest/glest.info @@ -1,8 +1,10 @@ PRGNAM="glest" VERSION="3.2.2" HOMEPAGE="http://glest.org/en/index.php" -DOWNLOAD="http://downloads.sourceforge.net/sourceforge/glest/glest_source_3.2.2.zip" +DOWNLOAD="http://downloads.sourceforge.net/glest/glest_source_3.2.2.zip" MD5SUM="1e961f49c1fb0e59e1e1483d66099a55" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" MAINTAINER="Larry Hajali" EMAIL="larryhaja[at]gmail[dot]com" -APPROVED="dsomero" +APPROVED="rworkman" diff --git a/games/glest/glest.sh b/games/glest/glest.sh deleted file mode 100644 index 9676827744..0000000000 --- a/games/glest/glest.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# Wrapper script taken from the Ubuntu guys. -# I guess they're good for something. :-) -# Modified for the accompanying glest.SlackBuild. - -MAINDIR=/usr/share/glest -BASEDIR="$XDG_CONFIG_HOME" -if [ -z "$BASEDIR" ]; then - BASEDIR="$HOME/.config" -fi -DIR="$BASEDIR/glest" -if [ ! -d "$DIR" ]; then - if [ -d "$HOME/.glest" ]; then - # Move the configuration directory to ~/.config - mkdir -p $BASEDIR - mv "$HOME/.glest" "$DIR" - else - mkdir $DIR - fi -fi -cd $DIR - -if [ -f glest.ini ]; then - # Update for Glest 3.2.1 - sed -i 's/\.lng//' glest.ini - language=$(cat glest.ini | grep Lang | cut -d'=' -f2) - [ -f /usr/share/glest/data/lang/${language}.lng ] || \ - sed -i "s/${language}/english/" glest.ini - # If the configuration file is too old, replace it - grep AutoTest glest.ini >/dev/null 2>&1 - if [ $? -ne 0 ]; then - mv glest.ini glest.ini.bck - cp /etc/glest/glest.ini . - [ -h docs ] || unlink docs - fi -else - cp /etc/glest/glest.ini . - sed -i 's/\.lng//' glest.ini -fi -[ -h glest ] || ln -s /usr/lib/glest/glest . -[ -f servers.ini ] || cp $MAINDIR/servers.ini . -for i in data scenarios techs tilesets; do - [ -h $i ] || ln -s $MAINDIR/$i . -done -[ -d maps ] || mkdir maps -[ -d screens ] || mkdir screens -cd maps -for i in $MAINDIR/maps/*; do - [ -h `basename $i` ] || ln -s $i . -done -cd .. - -exec ./glest diff --git a/games/glest/patches/g3d_viewer.patch b/games/glest/patches/g3d_viewer.patch new file mode 100644 index 0000000000..279f602be9 --- /dev/null +++ b/games/glest/patches/g3d_viewer.patch @@ -0,0 +1,277 @@ +Index: source/g3d_viewer/main.cpp +=================================================================== +--- source/g3d_viewer/main.cpp (Revision 191) ++++ source/g3d_viewer/main.cpp (Arbeitskopie) +@@ -2,7 +2,6 @@ + + #include + +-#include "graphics_factory_basic_gl.h" + #include "graphics_interface.h" + #include "util.h" + +@@ -11,8 +10,15 @@ + using namespace Shared::Graphics::Gl; + using namespace Shared::Util; + +-using namespace std; ++using std::exception; + ++#if (wxUSE_UNICODE == 1) ++#define STRCONV(x) wxConvUTF8.cMB2WC(x) ++#else ++#define STRCONV(x) x ++#endif ++ ++ + namespace Shared{ namespace G3dViewer{ + + // =============================================== +@@ -24,7 +30,7 @@ + + MainWindow::MainWindow(const string &modelPath): + wxFrame( +- NULL, -1, winHeader.c_str(), ++ NULL, -1, STRCONV(winHeader.c_str()), + wxPoint(Renderer::windowX, Renderer::windowY), + wxSize(Renderer::windowW, Renderer::windowH)) + { +@@ -37,38 +43,33 @@ + + glCanvas = new GlCanvas(this); + +- glCanvas->SetCurrent(); +- +- renderer->init(); +- +- + menu= new wxMenuBar(); + + //menu + menuFile= new wxMenu(); +- menuFile->Append(miFileLoad, "Load"); +- menu->Append(menuFile, "File"); ++ menuFile->Append(miFileLoad, wxT("Load")); ++ menu->Append(menuFile, wxT("File")); + + //mode + menuMode= new wxMenu(); +- menuMode->AppendCheckItem(miModeNormals, "Normals"); +- menuMode->AppendCheckItem(miModeWireframe, "Wireframe"); +- menuMode->AppendCheckItem(miModeGrid, "Grid"); +- menu->Append(menuMode, "Mode"); ++ menuMode->AppendCheckItem(miModeNormals, wxT("Normals")); ++ menuMode->AppendCheckItem(miModeWireframe, wxT("Wireframe")); ++ menuMode->AppendCheckItem(miModeGrid, wxT("Grid")); ++ menu->Append(menuMode, wxT("Mode")); + + //mode + menuSpeed= new wxMenu(); +- menuSpeed->Append(miSpeedSlower, "Slower"); +- menuSpeed->Append(miSpeedFaster, "Faster"); +- menu->Append(menuSpeed, "Speed"); ++ menuSpeed->Append(miSpeedSlower, wxT("Slower")); ++ menuSpeed->Append(miSpeedFaster, wxT("Faster")); ++ menu->Append(menuSpeed, wxT("Speed")); + + //custom color + menuCustomColor= new wxMenu(); +- menuCustomColor->AppendCheckItem(miColorRed, "Red"); +- menuCustomColor->AppendCheckItem(miColorBlue, "Blue"); +- menuCustomColor->AppendCheckItem(miColorYellow, "Yellow"); +- menuCustomColor->AppendCheckItem(miColorGreen, "Green"); +- menu->Append(menuCustomColor, "Custom Color"); ++ menuCustomColor->AppendCheckItem(miColorRed, wxT("Red")); ++ menuCustomColor->AppendCheckItem(miColorBlue, wxT("Blue")); ++ menuCustomColor->AppendCheckItem(miColorYellow, wxT("Yellow")); ++ menuCustomColor->AppendCheckItem(miColorGreen, wxT("Green")); ++ menu->Append(menuCustomColor, wxT("Custom Color")); + + menuMode->Check(miModeGrid, true); + menuCustomColor->Check(miColorRed, true); +@@ -88,13 +89,6 @@ + + timer = new wxTimer(this); + timer->Start(40); +- +- if(!modelPath.empty()){ +- Model *tmpModel= new ModelGl(); +- renderer->loadTheModel(tmpModel, modelPath); +- model= tmpModel; +- GetStatusBar()->SetStatusText(getModelInfo().c_str()); +- } + } + + MainWindow::~MainWindow(){ +@@ -104,6 +98,17 @@ + delete glCanvas; + } + ++void MainWindow::init(){ ++ glCanvas->SetCurrent(); ++ renderer->init(); ++ if(!modelPath.empty()){ ++ Model *tmpModel= new ModelGl(); ++ renderer->loadTheModel(tmpModel, modelPath); ++ model= tmpModel; ++ GetStatusBar()->SetStatusText(STRCONV(getModelInfo().c_str())); ++ } ++} ++ + void MainWindow::onPaint(wxPaintEvent &event){ + renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); + renderer->transform(rotX, rotY, zoom); +@@ -141,13 +146,14 @@ + void MainWindow::onMenuFileLoad(wxCommandEvent &event){ + string fileName; + wxFileDialog fileDialog(this); +- fileDialog.SetWildcard("G3D files (*.g3d)|*.g3d"); ++ fileDialog.SetWildcard(wxT("G3D files (*.g3d)|*.g3d")); + if(fileDialog.ShowModal()==wxID_OK){ + delete model; + Model *tmpModel= new ModelGl(); +- renderer->loadTheModel(tmpModel, fileDialog.GetPath().c_str()); ++ fileName = wxFNCONV(fileDialog.GetPath()); ++ renderer->loadTheModel(tmpModel, fileName); + model= tmpModel; +- GetStatusBar()->SetStatusText(getModelInfo().c_str()); ++ GetStatusBar()->SetStatusText(wxString(getModelInfo().c_str(), wxConvUTF8)); + } + } + +@@ -252,7 +258,7 @@ + // ===================================================== + + GlCanvas::GlCanvas(MainWindow * mainWindow): +- wxGLCanvas(mainWindow, -1) ++ wxGLCanvas(mainWindow, -1, wxDefaultPosition) + { + this->mainWindow = mainWindow; + } +@@ -261,13 +267,8 @@ + mainWindow->onMouseMove(event); + } + +-void GlCanvas::onPaint(wxPaintEvent &event){ +- mainWindow->onPaint(event); +-} +- + BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas) + EVT_MOTION(GlCanvas::onMouseMove) +- EVT_PAINT(GlCanvas::onPaint) + END_EVENT_TABLE() + + // =============================================== +@@ -277,11 +278,12 @@ + bool App::OnInit(){ + string modelPath; + if(argc==2){ +- modelPath= argv[1]; ++ modelPath = wxFNCONV(argv[1]); + } + + mainWindow= new MainWindow(modelPath); + mainWindow->Show(); ++ mainWindow->init(); + return true; + } + +@@ -290,9 +292,9 @@ + return wxApp::MainLoop(); + } + catch(const exception &e){ +- wxMessageDialog(NULL, e.what(), "Exception", wxOK | wxICON_ERROR).ShowModal(); +- return 0; ++ wxMessageDialog(NULL, STRCONV(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal(); + } ++ return 0; + } + + int App::OnExit(){ +Index: source/g3d_viewer/main.h +=================================================================== +--- source/g3d_viewer/main.h (Revision 191) ++++ source/g3d_viewer/main.h (Arbeitskopie) +@@ -7,12 +7,13 @@ + #include + #include + ++#include "graphics_factory_basic_gl.h" + #include "renderer.h" + #include "util.h" + #include "window.h" + +-using Shared::Platform::Window; +-using Shared::Platform::MouseState; ++//using Shared::Platform::Window; ++//using Shared::Platform::MouseState; + + using std::string; + +@@ -70,6 +71,8 @@ + MainWindow(const string &modelPath); + ~MainWindow(); + ++ void init(); ++ + void Notify(); + + void onPaint(wxPaintEvent &event); +Index: mk/linux/Jamfile +=================================================================== +--- mk/linux/Jamfile (Revision 191) ++++ mk/linux/Jamfile (Arbeitskopie) +@@ -26,7 +26,7 @@ + } + + Library glestlib : $(LIB_SOURCES) ; +-ExternalLibs glestlib : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ; ++ExternalLibs glestlib : SDL GL GLU XERCES VORBISFILE OPENAL LUA ; + IncludeDir glestlib : $(LIB_INCLUDE_DIRS) ; + + #### Game #### +@@ -55,7 +55,7 @@ + + Application glest : $(GLEST_SOURCES) ; + LinkWith glest : glestlib ; +-ExternalLibs glest : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ; ++ExternalLibs glest : SDL GL GLU XERCES VORBISFILE OPENAL LUA ; + IncludeDir glest : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_DIRS) ; + + #### Editor #### +@@ -69,7 +69,22 @@ + + Application glest_editor : $(GLEST_MAP_SOURCES) ; + LinkWith glest_editor : glestlib ; +- ExternalLibs glest_editor : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL WX ; ++ ExternalLibs glest_editor : SDL GL GLU XERCES VORBISFILE OPENAL WX ; + IncludeDir glest_editor : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_MAP_DIRS) ; + } + ++### Viewer ### ++if $(WX_AVAILABLE) = "yes" { ++ SubDir TOP g3d_viewer ; ++ ++ GLEST_VIEWER_DIRS = . ; ++ for i in $(GLEST_DIRS) { ++ GLEST_VIEWER_SOURCES += [ Wildcard $(i) : *.cpp *.h ] ; ++ } ++ ++ Application glest_g3dviewer : $(GLEST_VIEWER_SOURCES) ; ++ LinkWith glest_g3dviewer : glestlib ; ++ ExternalLibs glest_g3dviewer : SDL GL GLU XERCES VORBISFILE OPENAL WX ; ++ IncludeDir glest_g3dviewer : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_VIEWER_DIRS) ; ++} ++ +Index: mk/linux/autogen.sh +=================================================================== +--- mk/linux/autogen.sh (Revision 191) ++++ mk/linux/autogen.sh (Arbeitskopie) +@@ -34,4 +34,6 @@ + if [ ! -d glest_map_editor ]; then + ln -sf ../../source/glest_map_editor . + fi +- ++if [ ! -d g3d_viewer ]; then ++ ln -sf ../../source/g3d_viewer . ++fi diff --git a/games/glest/patches/glest-3.2.2-glibc210.patch b/games/glest/patches/glest-3.2.2-glibc210.patch new file mode 100644 index 0000000000..31e3ff183b --- /dev/null +++ b/games/glest/patches/glest-3.2.2-glibc210.patch @@ -0,0 +1,10 @@ +--- source/shared_lib/sources/platform/posix/socket.cpp ++++ source/shared_lib/sources/platform/posix/socket.cpp +@@ -10,6 +10,7 @@ + + #include + #include ++#include + #include + #include + #if defined(HAVE_SYS_IOCTL_H) diff --git a/games/glest/patches/glest-home-directory.patch b/games/glest/patches/glest-home-directory.patch new file mode 100644 index 0000000000..a92002ab60 --- /dev/null +++ b/games/glest/patches/glest-home-directory.patch @@ -0,0 +1,143 @@ +--- source/glest_game/ai/ai_interface.h 2009-04-15 11:17:19.000000000 +0400 ++++ source/glest_game/ai/ai_interface.h 2009-04-15 12:25:04.000000000 +0400 +@@ -84,7 +84,11 @@ + bool isFreeCells(const Vec2i &pos, int size, Field field); + + private: +- string getLogFilename() const {return "ai"+intToStr(factionIndex)+".log";} ++ string getLogFilename() const { ++ string logfn=getenv("HOME"); ++ logfn+="/.glest/ai"+intToStr(factionIndex)+".log"; ++ return logfn; ++ } + }; + + }}//end namespace +--- source/glest_game/ai/ai_rule.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/glest_game/ai/ai_rule.cpp 2009-04-15 11:19:02.000000000 +0400 +@@ -17,6 +17,8 @@ + #include "unit.h" + #include "leak_dumper.h" + ++#include ++ + using Shared::Graphics::Vec2i; + + namespace Glest{ namespace Game{ +--- source/glest_game/game/game.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/glest_game/game/game.cpp 2009-04-15 12:21:29.000000000 +0400 +@@ -443,7 +443,8 @@ + } + else if(key=='E'){ + for(int i=0; i<100; ++i){ +- string path= "screens/screen" + intToStr(i) + ".tga"; ++ string path=getenv("HOME"); ++ path+="/.glest/screens/screen" + intToStr(i) + ".tga"; + + FILE *f= fopen(path.c_str(), "rb"); + if(f==NULL){ +--- source/glest_game/main/main.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/glest_game/main/main.cpp 2009-04-15 12:32:04.000000000 +0400 +@@ -114,6 +114,17 @@ + // ===================================================== + + int glestMain(int argc, char** argv){ ++ if (!getenv("HOME")) ++ throw runtime_error("HOME external variable is not set"); ++ ++ char path[PATH_MAX]; ++ snprintf(path, PATH_MAX, "%s/.glest", getenv("HOME")); ++ mkdir(path, 0750); ++ ++ snprintf(path, PATH_MAX, "%s/.glest/screens", getenv("HOME")); ++ mkdir(path, 0750); ++ ++ chdir("/usr/share/glest"); + + MainWindow *mainWindow= NULL; + Program *program= NULL; +--- source/glest_game/main/program.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/glest_game/main/program.cpp 2009-04-15 12:11:51.000000000 +0400 +@@ -196,9 +196,11 @@ + updateTimer.init(GameConstants::updateFps, maxTimes); + updateCameraTimer.init(GameConstants::cameraFps, maxTimes); + +- //log start +- Logger &logger= Logger::getInstance(); +- logger.setFile("glest.log"); ++ //log start ++ char path[PATH_MAX]; ++ snprintf(path, PATH_MAX, "%s/.glest/glest.log", getenv("HOME")); ++ Logger &logger= Logger::getInstance(); ++ logger.setFile(path); + logger.clear(); + + //lang +--- source/shared_lib/sources/util/leak_dumper.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/shared_lib/sources/util/leak_dumper.cpp 2009-04-15 12:04:49.000000000 +0400 +@@ -52,7 +52,9 @@ + } + + AllocRegistry::~AllocRegistry(){ +- dump("leak_dump.log"); ++ char path[PATH_MAX]; ++ snprintf(path, PATH_MAX, "%s/.glest/leak_dump.log", getenv("HOME")); ++ dump(path); + } + + void AllocRegistry::allocate(AllocInfo info){ +--- source/shared_lib/sources/util/profiler.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/shared_lib/sources/util/profiler.cpp 2009-04-15 12:01:52.000000000 +0400 +@@ -71,9 +71,11 @@ + Profiler::~Profiler(){ + rootSection->stop(); + +- FILE *f= fopen("profiler.log", "w"); ++ char path[PATH_MAX]; ++ snprintf(path, PATH_MAX, "%s/.glest/profiler.log", getenv("HOME")); ++ FILE *f= fopen(path, "w"); + if(f==NULL) +- throw runtime_error("Can not open file: profiler.log"); ++ throw runtime_error("Can not open file: %s",path); + + fprintf(f, "Profiler Results\n\n"); + +--- source/shared_lib/sources/util/properties.cpp 2009-04-15 11:17:19.000000000 +0400 ++++ source/shared_lib/sources/util/properties.cpp 2009-04-15 13:09:33.000000000 +0400 +@@ -15,6 +15,9 @@ + #include + #include + ++#include ++#include ++ + #include "conversion.h" + #include "leak_dumper.h" + +@@ -34,9 +37,13 @@ + + this->path= path; + +- fileStream.open(path.c_str(), ios_base::in); ++ char str[PATH_MAX]; ++ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str()); ++ fileStream.open(str, ios_base::in); + if(fileStream.fail()){ +- throw runtime_error("Can't open propertyMap file: " + path); ++ fileStream.open(path.c_str(), ios_base::in); // use defaults ++ if(fileStream.fail()) ++ throw runtime_error("Can't open propertyMap file: " + path + " cwd: "+ getenv("PWD")); + } + + propertyMap.clear(); +@@ -71,7 +78,9 @@ + void Properties::save(const string &path){ + ofstream fileStream; + +- fileStream.open(path.c_str(), ios_base::out | ios_base::trunc); ++ char str[PATH_MAX]; ++ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str()); ++ fileStream.open(str, ios_base::out | ios_base::trunc); + + fileStream << "; === propertyMap File === \n"; + fileStream << '\n'; diff --git a/games/glest/patches/glest-xerces-c.patch b/games/glest/patches/glest-xerces-c.patch new file mode 100644 index 0000000000..f7582060b3 --- /dev/null +++ b/games/glest/patches/glest-xerces-c.patch @@ -0,0 +1,41 @@ +--- source/shared_lib/sources/xml/xml_parser.cpp.old 2008-02-16 16:01:28.000000000 +0300 ++++ source/shared_lib/sources/xml/xml_parser.cpp 2009-03-19 18:28:08.000000000 +0300 +@@ -87,10 +87,17 @@ + + try{ + ErrorHandler errorHandler; ++#if XERCES_VERSION_MAJOR < 3 + DOMBuilder *parser= (static_cast(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); + parser->setErrorHandler(&errorHandler); + parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true); + parser->setFeature(XMLUni::fgDOMValidation, true); ++#else ++ DOMLSParser *parser = (static_cast(implementation))->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0); ++ DOMConfiguration *config = parser->getDomConfig(); ++ config->setParameter(XMLUni::fgXercesSchemaFullChecking, true); ++ config->setParameter(XMLUni::fgDOMValidate, true); ++#endif + DOMDocument *document= parser->parseURI(path.c_str()); + + if(document==NULL){ +@@ -119,9 +126,20 @@ + } + + LocalFileFormatTarget file(path.c_str()); ++#if XERCES_VERSION_MAJOR < 3 + DOMWriter* writer = implementation->createDOMWriter(); + writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true); + writer->writeNode(&file, *document); ++#else ++ DOMLSSerializer *serializer = implementation->createLSSerializer(); ++ DOMLSOutput* output=implementation->createLSOutput(); ++ DOMConfiguration* config=serializer->getDomConfig(); ++ config->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,true); ++ output->setByteStream(&file); ++ serializer->write(document,output); ++ output->release(); ++ serializer->release(); ++#endif + document->release(); + } + catch(const DOMException &e){ diff --git a/games/glest/slack-desc b/games/glest/slack-desc index 67df89c11f..f5d2b19816 100644 --- a/games/glest/slack-desc +++ b/games/glest/slack-desc @@ -7,13 +7,13 @@ |-----handy-ruler------------------------------------------------------| glest: glest (A free 3d real-time customizable strategy game) -glest: +glest: glest: Glest is a free 3D real-time strategy game, where you control the glest: armies of two different factions: Tech, which is mainly composed of glest: warriors and mechanical devices, and Magic, that prefers mages and glest: summoned creatures in the battlefield. -glest: +glest: glest: Homepage: http://glest.org/en/index.php -glest: -glest: -glest: +glest: +glest: +glest: -- cgit v1.2.3