commit:     ef86f45bb93769a83d51e01ea6990ce9be60ed1b
Author:     Nicholas Vinson <nvinson234 <AT> gmail <DOT> com>
AuthorDate: Sun Apr  3 00:25:32 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Tue May  3 13:23:40 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef86f45b

games-arcade/savagewheels: New ebuild.

This will add savagewheels-1.6.0.

Package-Manager: portage-2.2.28
Closes: https://github.com/gentoo/gentoo/pull/1290

Signed-off-by: Patrice Clement <monsieurp <AT> gentoo.org>

 games-arcade/savagewheels/Manifest                 |   2 +
 .../files/savagewheels-1.6.0-cmakelists.txt.patch  | 128 ++++++++
 .../files/savagewheels-1.6.0-linux_dirs.patch      | 359 +++++++++++++++++++++
 games-arcade/savagewheels/files/savagewheels.in    |  42 +++
 games-arcade/savagewheels/metadata.xml             |  18 ++
 .../savagewheels/savagewheels-1.6.0.ebuild         |  86 +++++
 6 files changed, 635 insertions(+)

diff --git a/games-arcade/savagewheels/Manifest 
b/games-arcade/savagewheels/Manifest
new file mode 100644
index 0000000..f6d4749
--- /dev/null
+++ b/games-arcade/savagewheels/Manifest
@@ -0,0 +1,2 @@
+DIST savagewheels-1.6.0.tar.gz 593352 SHA256 
c127eb37fd6b591ff579fa70b989afada1f20c6c63924583ff653d4efe7712fe SHA512 
20622b1472d0c9dbf35250ab2334e4f84cabcb72c328a2a728fdbd113bc4b156a7fc2028ef51cd994dabbd27777d5eb07574295b393e9e81db31770a2f5e901f
 WHIRLPOOL 
699c4ca19fd29c6e66bd3ef806b3e4bc19e787bba8c85428ad6e2701cac489b908fc74b6b3ce91e1ff1bc0306b3fd5ffccb52b743bbc1fb16da9ebef5a4d1b83
+DIST savagewheels-gamedata-1.4.0.tar.gz 13183072 SHA256 
01fd7b9e122ff7d62363cbe3fd73d63de27bd48e40572e65ac9bb0d60bbad6ad SHA512 
102214e18edb911b168e41999d239e3070255720f250e8ea640d365b3f7fc4c772cbf322f4558ba6c05fd56d904613c758918e25712e89eb2aca3e948c26fc65
 WHIRLPOOL 
baafc5fe81a450ead511f4059cfe54a1e570cf8038af647c585678d2f15af0ac8f1cb8973767c8f646796748fbb1d4246d224ca2c916ee4ff5d1f516b4b4064f

diff --git 
a/games-arcade/savagewheels/files/savagewheels-1.6.0-cmakelists.txt.patch 
b/games-arcade/savagewheels/files/savagewheels-1.6.0-cmakelists.txt.patch
new file mode 100644
index 0000000..eef00f9
--- /dev/null
+++ b/games-arcade/savagewheels/files/savagewheels-1.6.0-cmakelists.txt.patch
@@ -0,0 +1,128 @@
+--- savagewheels-1.6.0/CMakeLists.txt.old      2016-04-02 16:45:40.416146450 
-0700
++++ savagewheels-1.6.0/CMakeLists.txt  2016-04-02 16:57:14.930931857 -0700
+@@ -9,22 +9,33 @@ set(APP_VER_PATCH "0")
+ 
+ ### check for required libs
+ find_package(SDL REQUIRED)
+ 
+ ### Install targets (see: http://www.cmake.org/Wiki/CMake_RPATH_handling)
+-if (NOT INSTALL_DIR)
+-    set(INSTALL_DIR "./")
++if (UNIX)
++      include (GNUInstallDirs)
++else()
++      if (NOT INSTALL_DIR)
++              set(INSTALL_DIR "./")
++      endif()
++      set(CMAKE_INSTALL_BINDIR                "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_SBINDIR               "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_LIBEXECDIR            "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_SYSCONFDIR            "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_SHAREDSTATEDIR        "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_LOCALSTATEDIR         "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_LIBDIR                "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_INCLUDEDIR            "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_OLDINCLUDEDIR         "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_DATAROOTDIR           "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_DATADIR               "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_INFODIR               "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_LOCALEDIR             "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_MANDIR                "${INSTALL_DIR}")
++      set(CMAKE_INSTALL_DOCDIR                "${INSTALL_DIR}")
+ endif()
+ 
+-# when building, don't use the install RPATH already
+-# (but later on when installing)
+-SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
+-
+-# add the automatically determined parts of the RPATH
+-SET(CMAKE_INSTALL_RPATH "${INSTALL_DIR}/")
+-SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+-
+ ### sources
+ include_directories(src/)
+ include_directories(tinyxml/)
+ 
+ set(
+@@ -113,11 +124,11 @@ if (SOUND STREQUAL "NO")
+     message(STATUS "Found SOUND=NO option. Compiling without sound support!")
+ elseif(SOUND STREQUAL "FMOD")
+     # FModEx API
+ 
+       # check if path to FMod is defined
+-      if(NOT DEFINED ${FMOD_PATH})
++      if(NOT DEFINED FMOD_PATH)
+               set(FMOD_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libs/fmod/api")
+       endif()
+ 
+     add_definitions(-I${FMOD_PATH}/inc)
+     link_directories(${FMOD_PATH}/lib)
+@@ -164,17 +175,19 @@ elseif(SOUND STREQUAL "FMOD")
+       else()
+               message(STATUS "Found FModEx lib at ${FMOD_LIBRARY}. Found 
FModEx DLL at ${FMOD_LIBRARY_SO_PATH}.")
+               
+               add_definitions(-DWITH_FMOD)
+               
+-              add_custom_command(TARGET savagewheels POST_BUILD
+-                      COMMAND ${CMAKE_COMMAND} -E copy_if_different 
+-                      ${FMOD_LIBRARY_SO_PATH} 
+-                      $<TARGET_FILE_DIR:savagewheels>)
+-                      
+-              INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${FMOD_SO_NAME}" 
+-                  DESTINATION ${INSTALL_DIR})
++              if (WIN32)
++                      add_custom_command(TARGET savagewheels POST_BUILD
++                              COMMAND "${CMAKE_COMMAND}" -E copy_if_different
++                              "${FMOD_LIBRARY_SO_PATH}"
++                              "$<TARGET_FILE_DIR:savagewheels>")
++
++                      INSTALL(FILES 
"${CMAKE_CURRENT_BINARY_DIR}/${FMOD_SO_NAME}"
++                              DESTINATION "${INSTALL_DIR}")
++              endif()
+       endif()
+ 
+ else()
+     # SDL_mixer API
+     find_package(SDL_mixer REQUIRED)
+@@ -234,19 +247,36 @@ endif()
+ ### Configure compile time header file 
+ configure_file (
+   "${PROJECT_SOURCE_DIR}/Config.h.in"
+   "${PROJECT_SOURCE_DIR}/src/Config.h")
+   
+-INSTALL(TARGETS savagewheels RUNTIME DESTINATION ${INSTALL_DIR})
+-INSTALL(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" DESTINATION 
${INSTALL_DIR})
++
++INSTALL(TARGETS savagewheels RUNTIME DESTINATION 
"${CMAKE_INSTALL_LIBEXECDIR}")
++if (WIN32 AND NOT UNIX)
++      INSTALL(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/run.sh" DESTINATION 
"${INSTALL_DIR}")
++else()
++      configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/savagewheels.in"
++              "${CMAKE_CURRENT_BINARY_DIR}/savagewheels.sh"
++              @ONLY)
++      INSTALL(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/savagewheels.sh"
++              DESTINATION "${CMAKE_INSTALL_BINDIR}" RENAME savagewheels)
++endif()
++
+ INSTALL(FILES
+     "${CMAKE_CURRENT_SOURCE_DIR}/README.md"
+     "${CMAKE_CURRENT_SOURCE_DIR}/HISTORY"
+     "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
++    "${CMAKE_CURRENT_SOURCE_DIR}/bin/LICENSE.mikmod.txt"
++    "${CMAKE_CURRENT_SOURCE_DIR}/bin/Readme.html"
++    "${CMAKE_CURRENT_SOURCE_DIR}/bin/README-SDL_mixer.txt"
++    "${CMAKE_CURRENT_SOURCE_DIR}/bin/README-SDL.txt"
+-    DESTINATION ${INSTALL_DIR})
++      DESTINATION "${CMAKE_INSTALL_DOCDIR}")
+-INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/"
+-    DESTINATION ${INSTALL_DIR}
++INSTALL(FILES
++    "${CMAKE_CURRENT_SOURCE_DIR}/bin/bindings.xml"
++        DESTINATION "${CMAKE_INSTALL_DATADIR}")
++INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/help"
++    DESTINATION "${CMAKE_INSTALL_DOCDIR}/help"
+     PATTERN "debug.html" EXCLUDE
+     PATTERN "pref" EXCLUDE)
+     
+ ### build a CPack driven installer package
+ include (InstallRequiredSystemLibraries)

diff --git 
a/games-arcade/savagewheels/files/savagewheels-1.6.0-linux_dirs.patch 
b/games-arcade/savagewheels/files/savagewheels-1.6.0-linux_dirs.patch
new file mode 100644
index 0000000..b407657
--- /dev/null
+++ b/games-arcade/savagewheels/files/savagewheels-1.6.0-linux_dirs.patch
@@ -0,0 +1,359 @@
+--- savagewheels-1.6.0/src/Main.cpp.old        2016-04-14 21:18:38.115071742 
-0700
++++ savagewheels-1.6.0/src/Main.cpp    2016-04-14 22:01:42.375422000 -0700
+@@ -43,10 +43,17 @@
+  * Alpha Release: 29.06.2003
+  */
+ 
+ #include "Main.h"
+ 
++const char *sys_datadir;
++const char *usr_cfgdir;
++const char *usr_datadir;
++
++char *ART_FILE;
++char *BINDINGS_FILE;
++
+ int main( int argc, char *argv[] )
+ {
+       bool hardware_support = true;
+       /*
+        * Start the game in a window by default.
+@@ -57,16 +64,92 @@ int main( int argc, char *argv[] )
+        * Linux Note: Running the game in fullscreen would sometimes crash the 
gfx manager.
+        * This is probably due to some video drivers. I was so far able to 
reproduce it on
+        * ATI Mobility type of video cards.
+        */
+       bool fullscreen = false;
++      String tmp;
+ 
+ #ifdef LINUX_BUILD
++      sys_datadir = getenv("SAVAGEWHEELS_SYS_DATADIR");
++      if (sys_datadir == NULL)
++      {
++          fprintf(stderr, "SAVAGEWHEELS_SYS_DATADIR not set.\n");
++          return 1;
++      }
++      sys_datadir = strdup(sys_datadir);
++
++      usr_cfgdir = getenv("SAVAGEWHEELS_USR_CONFDIR");
++      if (usr_cfgdir == NULL)
++      {
++          fprintf(stderr, "SAVAGEWHEELS_USR_CONFDIR not set.\n");
++          return 1;
++      }
++      usr_cfgdir = strdup(usr_cfgdir);
++
++      usr_datadir = getenv("SAVAGEWHEELS_USR_DATADIR");
++      if (usr_datadir == NULL)
++      {
++          fprintf(stderr, "SAVAGEWHEELS_USR_DATADIR not set.\n");
++          return 1;
++      }
++      usr_datadir = strdup(usr_datadir);
++
++      if (sys_datadir == NULL || usr_cfgdir == NULL || usr_datadir == NULL)
++      {
++          fprintf(stderr, "Insufficient memory.  Execution aborted.\n");
++          return 1;
++      }
++
+       setenv("SDL_VIDEO_CENTERED", "1", 1);
+ #else
++      sys_datadir = usr_cfgdir = usr_datadir = "./";
+       _putenv("SDL_VIDEO_CENTERED=1");
+ #endif
++      int len;
++      len = snprintf(NULL, 0, "%s/graphics/gfxdata.kdf", sys_datadir);
++      if (len < 0)
++      {
++              fprintf(stderr,
++                      "Unable to store '%s/graphics/gfxdata.kdf': %s\n",
++                      sys_datadir, strerror(errno));
++              return 1;
++      }
++      if (len == INT_MAX)
++      {
++              fprintf(stderr, "Unable to store '%s/graphics/gfxdata.kdf': "
++                      "Path too log\n", sys_datadir);
++              return 1;
++      }
++      ART_FILE = new (std::nothrow) char[len + 1];
++      if (ART_FILE == NULL)
++      {
++              fprintf(stderr, "Insufficent memory.  Execution aborted.\n");
++              return 1;
++      }
++      sprintf(ART_FILE, "%s/graphics/gfxdata.kdf", sys_datadir);
++
++      len = snprintf(NULL, 0, "%s/bindings.xml", usr_cfgdir);
++      if (len < 0)
++      {
++              fprintf(stderr,
++                      "Unable to store '%s/bindings.xml': %s\n", usr_cfgdir,
++                      strerror(errno));
++              return 1;
++      }
++      if (len == INT_MAX)
++      {
++              fprintf(stderr, "Unable to store '%s/bindings.xml': "
++                      "Path too log\n", usr_cfgdir);
++              return 1;
++      }
++      BINDINGS_FILE = new (std::nothrow) char[len + 1];
++      if (BINDINGS_FILE == NULL)
++      {
++              fprintf(stderr, "Insufficent memory.  Execution aborted.\n");
++              return 1;
++      }
++      sprintf(BINDINGS_FILE, "%s/bindings.xml", usr_cfgdir);
+ 
+       if (argc > 1) {
+               for (int i = 1; i < argc; i++) {
+                       if (!strncmp(argv[i], "-wnd", 4)) {
+                               fullscreen = false;
+@@ -104,11 +187,12 @@
+       
+       /*
+        * Load & Start Game
+        */
+         
+-      OpenLog("debug.html");
++      tmp = String(usr_datadir).append("/debug.html");
++      OpenLog(tmp.c_str());
+       
+       CGame game;
+       game.Execute(fullscreen, hardware_support);
+       game.Close();
+ 
+--- savagewheels-1.6.0/src/Main.h.old  2016-04-14 21:20:27.443522441 -0700
++++ savagewheels-1.6.0/src/Main.h      2016-04-14 21:56:22.449964486 -0700
+@@ -35,10 +35,11 @@
+ #include <cstdlib>
+ #include <cmath>
+ #include <cstdarg>
+ #include <cassert>
+ #include <exception>
++#include <cerrno>
+ 
+ #include <ctime>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <sys/timeb.h>
+@@ -84,12 +85,10 @@
+ 
+ // --- version
+ #include "Config.h"
+ 
+ // --- global game defines
+-#define ART_FILE      "graphics/gfxdata.kdf"
+-#define BINDINGS_FILE "bindings.xml"
+ #define LOAD_OK         (-1)
+ #define LOAD_FAILED     (0)
+ #define HRESULT(x)    ( (x) == NULL : LOAD_OK ? LOAD_FAILED )
+ #define NLPTR_SURF    0 //((SDL_Surface *)NULL)
+ 
+@@ -100,10 +99,16 @@
+ #endif
+ 
+ typedef std::string                   String;
+ typedef std::ostringstream    OutputSStream;
+ 
++extern const char *sys_datadir;
++extern const char *usr_cfgdir;
++extern const char *usr_datadir;
++
++extern char *ART_FILE;
++extern char *BINDINGS_FILE;
+ //#include "pstdint.h" // portable types
+ #include "Utils.h"
+ #include "CKdf.h"
+ #include "CSdl.h"
+ #include "CSwv_module.h"
+--- savagewheels-1.6.0/src/Utils.cpp.old       2016-04-15 19:28:21.757879157 
-0700
++++ savagewheels-1.6.0/src/Utils.cpp   2016-04-15 19:28:28.478786779 -0700
+@@ -261,11 +261,11 @@ inline String GetFormattedTime()
+ bool OpenLog ( const char* filename )
+ {
+     String time( GetFormattedTime() );
+ 
+     // open debug file
+-    debug_file.open ( "debug.html", std::ios::out ); //ios::ate );
++    debug_file.open ( filename, std::ios::out ); //ios::ate );
+     if ( ! debug_file.good() )
+       return false;
+ 
+     debug_file << "<html><head><title>Savage Wheels Log 
File</title></head><body><h1>Savage Wheels V" << VER_MAJ << "." << VER_MIN << " 
- Log File</h1>";
+     debug_file << "<hr/><pre>";
+--- savagewheels-1.6.0/src/CGame.cpp.old       2016-04-15 20:43:37.479330001 
-0700
++++ savagewheels-1.6.0/src/CGame.cpp   2016-04-15 21:04:48.044721904 -0700
+@@ -116,10 +116,11 @@ void CGame::Close()
+ ///////////////////////////////////////////////////////////////////////
+ bool CGame::LoadGame()
+ {
+       char buf[255];
+       int  i = 0;
++      String tmp (sys_datadir);
+ 
+       AppendToLog( LOG_DASH );
+       AppendToLog("Loading Game...");
+ 
+       // global screen rect
+@@ -161,11 +162,14 @@ bool CGame::LoadGame()
+       srand( (unsigned)SDL_GetTicks() );
+ 
+       UpdateSplash();  // UPDATESPLASH... 
+ 
+       // search for vehicles
+-      if ( Swv.SearchAndLoad( "autos" ) != SWV_SUCCESS ) return false;
++      tmp.resize(strlen(sys_datadir));
++      tmp.append("/autos");
++      if ( Swv.SearchAndLoad( tmp.c_str() ) != SWV_SUCCESS )
++              return false;
+ 
+       // check for vehicle number
+       if ( Swv.GetVehicles() < 4 ) 
+       {
+               AppendToLog( "Not enough vehicles in the /auto dir!" );
+--- savagewheels-1.6.0/src/CSdl.cpp.old        2016-04-16 16:00:56.600502348 
-0700
++++ savagewheels-1.6.0/src/CSdl.cpp    2016-04-16 16:01:16.152226435 -0700
+@@ -1298,13 +1298,10 @@
+       return NULL;
+ #else
+       
+       SDL_Surface *sdl_surf = NULL;
+ 
+-      char filename_buf[255];
+-      sprintf( filename_buf, "../%s", filename );
+-
+       if ( ( sdl_surf = SDL_LoadBMP( filename_buf )) == NULL )
+       {
+               LOG("...failed to load graphics from : " << filename_buf );
+               return NULL;
+       }
+--- savagewheels-1.6.0/src/CSounds.cpp.old     2016-04-16 16:06:43.887600441 
-0700
++++ savagewheels-1.6.0/src/CSounds.cpp 2016-04-16 16:17:44.729332218 -0700
+@@ -46,22 +46,39 @@
+ // Name: Initialize()
+ // Desc: Load all ingame sounds
+ //////////////////////////////////////////////////////////////////////
+ bool CSounds::Initialize( CSdl *pSdl )
+ {
+-      ASSERT( _sdl != NULL );
++      ASSERT( pSdl != NULL );
+       this->_sdl = pSdl;
+ 
+ #if defined(WITH_FMOD) || defined(WITH_SDLMIXER)
++      String tmp (sys_datadir);
+ 
+-#define LOAD_SOUND( container, name, buffered ) if ( (sounds[container] = 
_sdl->LoadSound( name, buffered )) == -1 ) { \
+-      LOG( "Failed to load " << name << " ! "); \
+-      return false; }
++#define LOAD_SOUND( container, name, buffered)                                
        \
++      do {                                                                    
\
++              tmp.append("/").append(name);                                   
\
++              sounds[container] =                                             
\
++                      _sdl->LoadSound( tmp.c_str(), buffered );               
\
++              if ( sounds[container] == -1 ) {                                
\
++                      LOG( "Failed to load " << name << " ! " );              
\
++                      return false;                                           
\
++              }                                                               
\
++              tmp.resize(strlen(sys_datadir));                                
\
++      } while(0)
+ 
+-#define LOAD_MUSIC( container, name ) if ( (music[container] = 
_sdl->LoadSound( name, false, true )) == -1 ) { \
+-      LOG( "Failed to load music " << name << " ! "); \
+-      return false; }
++#define LOAD_MUSIC( container, name)                                          
\
++      do {                                                                    
\
++              tmp.append("/").append(name);                                   
\
++              music[container] =                                              
\
++                      _sdl->LoadSound( tmp.c_str(), false, true );            
\
++              if ( music[container] == -1 ) {                                 
\
++                      LOG( "Failed to load music " << name << " ! " );        
\
++                      return false;                                           
\
++              }                                                               
\
++              tmp.resize(strlen(sys_datadir));                                
\
++      } while(0)
+ 
+       LOAD_SOUND( SND_CRASHLIGHT1, "sound/crash3.wav", true );
+       LOAD_SOUND( SND_CRASHLIGHT2, "sound/crash2.wav", true );
+       LOAD_SOUND( SND_CRASHLIGHT3, "sound/crash1.wav", true );
+       LOAD_SOUND( SND_EXPLOSION1, "sound/exp.wav", true );
+--- savagewheels-1.6.0/src/CSwv_module.cpp.old 2016-04-16 20:58:04.366973388 
-0700
++++ savagewheels-1.6.0/src/CSwv_module.cpp     2016-04-16 20:58:13.026851358 
-0700
+@@ -204,12 +204,10 @@ int CSwv_module::Load( char *filename, S
+ //            DBG("pos: " << swv_file->pfiles[i].pos
+ //                            << " size (KB): " << swv_file->pfiles[i].length
+ //                            << " name: " << swv_file->pfiles[i].filename);
+ //    }
+       
+-      // set module filename
+-      sprintf( swv_file->filename, "%s", filename );
+ 
+       if ( fp != NULL )
+         fclose( fp );
+ 
+       return SWV_SUCCESS;
+--- savagewheels-1.6.0/src/CSdl.cpp.old        2016-04-16 21:02:07.680544534 
-0700
++++ savagewheels-1.6.0/src/CSdl.cpp    2016-04-16 21:06:59.400432874 -0700
+@@ -1336,12 +1336,25 @@ SDL_Surface* CSdl::LoadBitmap( const cha
+ SDL_Surface* CSdl::LoadBitmap( const char *filename, int32_t file_offset, 
Uint32 file_size, Uint32 color_key, Uint16 alpha_value )
+ {
+       SDL_Surface  *sdl_surf  = NULL;                                         
// temp surface
+       FILE             *fp            = NULL;                                 
        // file pointer
+       SDL_RWops        *sdl_rw        = NULL;                                 
        // sdl_read_write_operations
++      String tmp;
+ 
+-      if ( ( fp = fopen( filename, "rb")) == NULL ) 
++#ifdef LINUX_BUILD
++      if ( filename[0] != '/' )
++      {
++          tmp = String(sys_datadir).append("/autos/").append(filename);
++      }
++      else
++      {
++              tmp = String(filename);
++      }
++#else
++      tmp = String(filename);
++#endif
++      if ( ( fp = fopen( tmp.c_str(), "rb")) == NULL ) 
+       {
+               LOG("...failed to open file : " << filename );
+               return NULL;
+       }
+ 
+--- savagewheels-1.6.0/src/CMainMenu.cpp.old   2016-04-16 22:13:23.442523534 
-0700
++++ savagewheels-1.6.0/src/CMainMenu.cpp       2016-04-16 22:13:17.701605381 
-0700
+@@ -1121,12 +1121,13 @@ void CMainMenu::SaveSettings()
+       if ( _game == NULL )
+         return;
+ 
+       FILE *fp = NULL;
+       char  header[3] = { 'S', 'W', 'P' };
++      String strPref(String(usr_cfgdir) + "/pref");
+ 
+-      if ( ( fp = fopen( "pref", "wb" ) ) == NULL )
++      if ( ( fp = fopen( strPref.c_str(), "wb" ) ) == NULL )
+       {
+               AppendToLog( "Error writing to /pref file !" );
+               return;
+       }
+ 
+--- savagewheels-1.6.0/src/CMainMenu.cpp.old   2016-04-17 07:38:09.417653268 
-0700
++++ savagewheels-1.6.0/src/CMainMenu.cpp       2016-04-17 07:38:24.277437113 
-0700
+@@ -1167,12 +1168,13 @@ void CMainMenu::SaveSettings()
+ void CMainMenu::LoadSettings()
+ {
+       FILE  *fp = NULL;
+       char  header[3];
+       bool  success = true;
++      String strPref(String(usr_cfgdir) + "/pref");
+ 
+-      if ( ( fp = fopen( "pref", "rb" ) ) == NULL )
++      if ( ( fp = fopen( strPref.c_str(), "wb" ) ) == NULL )
+       {
+               AppendToLog( "Error opening /pref file !" );
+               success = false;
+       }
+ 

diff --git a/games-arcade/savagewheels/files/savagewheels.in 
b/games-arcade/savagewheels/files/savagewheels.in
new file mode 100644
index 0000000..c1b4c68
--- /dev/null
+++ b/games-arcade/savagewheels/files/savagewheels.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+export 
SAVAGEWHEELS_SYS_DATADIR="${SAVAGEWHEELS_SYS_DATADIR-@CMAKE_INSTALL_DATADIR@}"
+export 
SAVAGEWHEELS_LIBEXECDIR="${SAVAGEWHEELS_LIBEXECDIR-@CMAKE_INSTALL_LIBEXECDIR@}"
+export 
SAVAGEWHEELS_USR_CONFDIR="${SAVAGEWHEELS_USR_CONFDIR-${HOME}/.config/savagewheels}"
+export 
SAVAGEWHEELS_USR_DATADIR="${SAVAGEWHEELS_USR_DATADIR-${HOME}/.local/share/savagewheels}"
+
+if [ ! -d ${SAVAGEWHEELS_USR_CONFDIR} ]; then
+    if [ -e ${SAVAGEWHEELS_USR_CONFDIR} ]; then
+        printf "${SAVAGEWHEELS_USR_CONFDIR} exists but is not a directory.\n" 
>&2
+        printf "  Please remove.\n" >&2
+        exit 1
+    fi
+    mkdir -p ${SAVAGEWHEELS_USR_CONFDIR}
+    if [ $? -ne 0 ]; then
+        printf "Failed to create ${SAVAGEWHEELS_USR_CONFDIR}\n" >&2
+        exit 1
+    fi
+fi
+
+if [ ! -d ${SAVAGEWHEELS_USR_DATADIR} ]; then
+    if [ -e ${SAVAGEWHEELS_USR_DATADIR} ]; then
+        printf "${SAVAGEWHEELS_USR_DATADIR} exists but is not a directory.\n" 
>&2
+        printf "  Please remove.\n" >&2
+        exit 1
+    fi
+    mkdir -p ${SAVAGEWHEELS_USR_DATADIR}
+    if [ $? -ne 0 ]; then
+        printf "Failed to create ${SAVAGEWHEELS_USR_DATADIR}\n" >&2
+        exit 1
+    fi
+fi
+
+if [ ! -e ${SAVAGEWHEELS_USR_CONFDIR}/bindings.xml ]; then
+    cp ${SAVAGEWHEELS_SYS_DATADIR}/bindings.xml ${SAVAGEWHEELS_USR_CONFDIR}
+    if [ $? -ne 0 ]; then
+        printf "Failed to create ${SAVAGEWHEELS_USR_CONFDIR}/bindings.xml\n" 
>&2
+        exit 1
+    fi
+fi
+
+exec ${SAVAGEWHEELS_LIBEXECDIR}/savagewheels "$@"

diff --git a/games-arcade/savagewheels/metadata.xml 
b/games-arcade/savagewheels/metadata.xml
new file mode 100644
index 0000000..5279e81
--- /dev/null
+++ b/games-arcade/savagewheels/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>nvinson...@gmail.com</email>
+               <name>Nicholas Vinson</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-ma...@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <use>
+               <flag name="fmod">Enable the fmod music and sound effects 
library</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">petarov/savagewheels</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/games-arcade/savagewheels/savagewheels-1.6.0.ebuild 
b/games-arcade/savagewheels/savagewheels-1.6.0.ebuild
new file mode 100644
index 0000000..0edf982
--- /dev/null
+++ b/games-arcade/savagewheels/savagewheels-1.6.0.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit cmake-utils
+
+DESCRIPTION="2D car crashing game similar to the old classic Destruction 
Derby."
+HOMEPAGE="https://github.com/petarov/savagewheels";
+
+GAMEDATA="${PN}-gamedata-1.4.0"
+
+SRC_URI="
+       https://github.com/petarov/savagewheels/archive/v1.6.0.tar.gz -> 
${P}.tar.gz
+       
https://github.com/petarov/savagewheels/releases/download/v1.4/${PN}-gamedata.tar.gz
 -> ${GAMEDATA}.tar.gz
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="debug fmod sound"
+
+RDEPEND="
+       media-libs/libsdl
+       sound? (
+               !fmod? ( media-libs/sdl-mixer[mod,modplug] )
+               fmod? ( >=media-libs/fmod-4.38.00 )
+       )"
+
+DEPEND="${RDEPEND}"
+
+REQUIRED_USE="fmod? ( sound )"
+
+PATCHES=(
+       "${FILESDIR}/${P}-cmakelists.txt.patch"
+       "${FILESDIR}/${P}-linux_dirs.patch"
+)
+
+src_unpack() {
+       unpack ${P}.tar.gz
+
+       cp "${FILESDIR}/${PN}.in" "${S}"
+       mkdir "${WORKDIR}/${GAMEDATA}" ||
+               die "Failed to make directory: ${WORKDIR}/${GAMEDATA}"
+       cd "${WORKDIR}/${GAMEDATA}" ||
+               die "Unable to change into directory: ${WORKDIR}/${GAMEDATA}"
+       unpack "${GAMEDATA}.tar.gz"
+}
+
+src_configure() {
+       local mycmakeargs=()
+
+       if use debug; then
+               CMAKE_BUILD_TYPE=Debug
+       fi
+
+       if use sound; then
+               if use fmod; then
+                       mycmakeargs+=( -DSOUND=FMOD -DFMOD_PATH=/opt/fmodex/api 
)
+               else
+                       mycmakeargs+=( -DSOUND=YES )
+               fi
+       else
+               mycmakeargs+=( -DSOUND=NO )
+       fi
+
+       mycmakeargs+=(
+               -DCMAKE_INSTALL_DATADIR=/usr/share/games/${PN}
+               -DCMAKE_INSTALL_DATAROOTDIR=/usr/share
+               -DCMAKE_INSTALL_DOCDIR=/usr/share/doc/${P}
+               -DCMAKE_INSTALL_LIBEXECDIR=/usr/libexec/${PN}
+               -DCMAKE_INSTALL_PREFIX=/usr/games
+       )
+       cmake-utils_src_configure
+}
+
+src_install() {
+       cmake-utils_src_install
+
+       insinto "/usr/share/games/${PN}"
+       for d in "${WORKDIR}/${GAMEDATA}/*"; do
+               doins -r ${d}
+       done
+}

Reply via email to