You are not logged in.

#1 2009-05-13 21:26:47

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Patch to make SuperTux 0.3.1 compile (rather hacky)

I was trying to compile SuperTux 0.3.1 from source (using the CMake method), but G++ was throwing up errors constantly. It seems that the developer(s) use an OS which automatically includes certain header files, much like OS X — this was a source of much frustration when I was trying to compile a small program a few weeks ago.

So... I added the necessary headers, not necessarily in the best places. But it compiles and runs properly, at least. Here's the patch (generated with `diff -crB supertux2-orig supertux2`):

diff -crB supertux2-orig/src/addon_manager.hpp supertux2/src/addon_manager.hpp
*** supertux2-orig/src/addon_manager.hpp    2008-01-03 15:59:28.000000000 -0500
--- supertux2/src/addon_manager.hpp    2009-05-13 17:12:05.841549420 -0400
***************
*** 24,29 ****
--- 24,30 ----
  #include <string>
  #include <vector>
  #include "addon.hpp"
+ #include <stdlib.h>
  
  /**
   * Checks for, installs and removes Add-ons
diff -crB supertux2-orig/src/console.hpp supertux2/src/console.hpp
*** supertux2-orig/src/console.hpp    2008-01-03 15:59:27.000000000 -0500
--- supertux2/src/console.hpp    2009-05-13 17:06:57.164315374 -0400
***************
*** 27,32 ****
--- 27,33 ----
  #include <sstream>
  #include <iostream>
  #include <squirrel.h>
+ #include <memory>
  
  class Console;
  class ConsoleStreamBuffer;
diff -crB supertux2-orig/src/lisp/lexer.cpp supertux2/src/lisp/lexer.cpp
*** supertux2-orig/src/lisp/lexer.cpp    2008-01-03 15:59:26.000000000 -0500
--- supertux2/src/lisp/lexer.cpp    2009-05-13 17:13:55.713986557 -0400
***************
*** 18,23 ****
--- 18,24 ----
  //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  #include <config.h>
  
+ #include <string.h>
  #include <sstream>
  #include <stdexcept>
  #include <iostream>
diff -crB supertux2-orig/src/lisp/lisp.cpp supertux2/src/lisp/lisp.cpp
*** supertux2-orig/src/lisp/lisp.cpp    2008-01-03 15:59:26.000000000 -0500
--- supertux2/src/lisp/lisp.cpp    2009-05-13 17:14:16.621225401 -0400
***************
*** 19,24 ****
--- 19,25 ----
  
  #include <config.h>
  
+ #include <stdio.h>
  #include "lisp.hpp"
  
  namespace lisp
diff -crB supertux2-orig/src/random_generator.cpp supertux2/src/random_generator.cpp
*** supertux2-orig/src/random_generator.cpp    2008-01-03 15:59:27.000000000 -0500
--- supertux2/src/random_generator.cpp    2009-05-13 17:12:44.987481868 -0400
***************
*** 35,41 ****
  //          http://www.jbox.dk/sanos/source/lib/random.c.html
  #include <config.h>
  
! 
  #include <stdexcept>
  #include <time.h>
  #include <cassert>
--- 35,41 ----
  //          http://www.jbox.dk/sanos/source/lib/random.c.html
  #include <config.h>
  
! #include <stdio.h>
  #include <stdexcept>
  #include <time.h>
  #include <cassert>
diff -crB supertux2-orig/src/sprite/sprite_manager.cpp supertux2/src/sprite/sprite_manager.cpp
*** supertux2-orig/src/sprite/sprite_manager.cpp    2008-01-03 15:59:26.000000000 -0500
--- supertux2/src/sprite/sprite_manager.cpp    2009-05-13 17:07:34.679723689 -0400
***************
*** 22,27 ****
--- 22,28 ----
  #include <iostream>
  #include <sstream>
  #include <stdexcept>
+ #include <string>
  
  #include "sprite_manager.hpp"
  #include "sprite_data.hpp"
diff -crB supertux2-orig/src/sprite/sprite_manager.hpp supertux2/src/sprite/sprite_manager.hpp
*** supertux2-orig/src/sprite/sprite_manager.hpp    2008-01-03 15:59:26.000000000 -0500
--- supertux2/src/sprite/sprite_manager.hpp    2009-05-13 17:08:33.844210933 -0400
***************
*** 21,26 ****
--- 21,28 ----
  #define SUPERTUX_SPRITE_MANAGER_H
  
  #include <map>
+ #include <string>
+ #include <algorithm>
  
  class SpriteData;
  class Sprite;
diff -crB supertux2-orig/src/textscroller.cpp supertux2/src/textscroller.cpp
*** supertux2-orig/src/textscroller.cpp    2008-01-03 15:59:27.000000000 -0500
--- supertux2/src/textscroller.cpp    2009-05-13 17:09:32.962239410 -0400
***************
*** 35,40 ****
--- 35,41 ----
  #include "main.hpp"
  #include "fadeout.hpp"
  #include "control/joystickkeyboardcontroller.hpp"
+ #include <memory>
  
  static const float DEFAULT_SPEED = 20;
  static const float LEFT_BORDER = 50;
diff -crB supertux2-orig/src/textscroller.hpp supertux2/src/textscroller.hpp
*** supertux2-orig/src/textscroller.hpp    2008-01-03 15:59:27.000000000 -0500
--- supertux2/src/textscroller.hpp    2009-05-13 17:11:34.553028250 -0400
***************
*** 24,29 ****
--- 24,30 ----
  #include <vector>
  #include <string>
  #include <map>
+ #include <memory>
  
  #include "screen.hpp"
  #include "math/vector.hpp"
diff -crB supertux2-orig/src/title.cpp supertux2/src/title.cpp
*** supertux2-orig/src/title.cpp    2008-01-03 15:59:28.000000000 -0500
--- supertux2/src/title.cpp    2009-05-13 17:09:05.419755446 -0400
***************
*** 32,37 ****
--- 32,38 ----
  #include <SDL.h>
  #include <SDL_image.h>
  #include <physfs.h>
+ #include <algorithm>
  
  #include "title.hpp"
  #include "mainloop.hpp"
diff -crB supertux2-orig/src/video/sdl_texture.hpp supertux2/src/video/sdl_texture.hpp
*** supertux2-orig/src/video/sdl_texture.hpp    2008-01-03 15:59:22.000000000 -0500
--- supertux2/src/video/sdl_texture.hpp    2009-05-13 17:16:07.160647518 -0400
***************
*** 23,28 ****
--- 23,29 ----
  #include <config.h>
  
  #include <SDL.h>
+ #include <algorithm>
  
  #include "texture.hpp"
  #include "color.hpp"

Use it by cd-ing to the source directory and running `patch -p1 < patch_name.patch`.

# Patch was a little corrupted, fixed it.

Last edited by Peasantoid (2009-05-13 21:47:02)

Offline

Board footer

Powered by FluxBB