diff options
7 files changed, 193 insertions, 179 deletions
diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-boost-1.50.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-boost-1.50.patch index ed8ff748aa98..f3468ecf4be8 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-boost-1.50.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-boost-1.50.patch @@ -1,77 +1,77 @@ ---- a/ForceSelectWin.cpp.orig 2012-08-20 17:35:01.000000000 +0200 -+++ b/ForceSelectWin.cpp 2012-08-20 17:47:19.000000000 +0200 +--- a/ForceSelectWin.cpp ++++ b/ForceSelectWin.cpp @@ -1596,15 +1596,15 @@ - fs::directory_iterator directoryEnd; // default construction yields past-the-end
- for (fs::directory_iterator iter(sourcePath); iter != directoryEnd; ++iter) {
- if (is_directory(*iter)) {
-- fs::create_directory(destPath.string() + "/" + iter->leaf());
-- DoCopy(sourcePath.string() + "/" + iter->leaf(), destPath.string() + "/" + iter->leaf());
-+ fs::create_directory(destPath.string() + "/" + iter->path().filename().string());
-+ DoCopy(sourcePath.string() + "/" + iter->path().filename().string(), destPath.string() + "/" + iter->path().filename().string());
- continue;
- }
- string destFile;
-- if (iter->leaf() == sideName + ".dat")
-+ if (iter->path().filename() == sideName + ".dat")
- destFile = theInput + ".dat";
- else
-- destFile = iter->leaf();
-+ destFile = iter->path().filename().string();
-
- fs::copy_file(*iter, destPath.string() + "/" + destFile);
- }
---- a/Main.cpp.orig 2012-08-20 17:48:13.000000000 +0200 -+++ b/Main.cpp 2012-08-20 17:50:51.000000000 +0200 + fs::directory_iterator directoryEnd; // default construction yields past-the-end + for (fs::directory_iterator iter(sourcePath); iter != directoryEnd; ++iter) { + if (is_directory(*iter)) { +- fs::create_directory(destPath.string() + "/" + iter->leaf()); +- DoCopy(sourcePath.string() + "/" + iter->leaf(), destPath.string() + "/" + iter->leaf()); ++ fs::create_directory(destPath.string() + "/" + iter->path().filename().string()); ++ DoCopy(sourcePath.string() + "/" + iter->path().filename().string(), destPath.string() + "/" + iter->path().filename().string()); + continue; + } + string destFile; +- if (iter->leaf() == sideName + ".dat") ++ if (iter->path().filename() == sideName + ".dat") + destFile = theInput + ".dat"; + else +- destFile = iter->leaf(); ++ destFile = iter->path().filename().string(); + + fs::copy_file(*iter, destPath.string() + "/" + destFile); + } +--- a/Main.cpp ++++ b/Main.cpp @@ -339,12 +339,6 @@ -
- void GameInit(char* argv[]) {
- namespace fs = boost::filesystem;
-- //boost is really quite stupid
-- #ifndef WIN32
-- fs::path::default_name_check(fs::windows_name);
-- #else
-- fs::path::default_name_check(fs::native);
-- #endif
-
- FindHomePath();
- LoadSettings(argv);
---- a/Menu_Base.cpp.orig 2012-08-20 17:51:05.000000000 +0200 -+++ b/Menu_Base.cpp 2012-08-20 17:52:15.000000000 +0200 + + void GameInit(char* argv[]) { + namespace fs = boost::filesystem; +- //boost is really quite stupid +- #ifndef WIN32 +- fs::path::default_name_check(fs::windows_name); +- #else +- fs::path::default_name_check(fs::native); +- #endif + + FindHomePath(); + LoadSettings(argv); +--- a/Menu_Base.cpp ++++ b/Menu_Base.cpp @@ -206,7 +206,7 @@ -
- fs::directory_iterator directoryEnd; // default construction yields past-the-end
- for (fs::directory_iterator iter(directory); iter != directoryEnd; ++iter) {
-- string filename = iter->leaf();
-+ string filename = iter->path().filename().string();
-
- if (filename.find('.') == filename.npos)
- continue;
+ + fs::directory_iterator directoryEnd; // default construction yields past-the-end + for (fs::directory_iterator iter(directory); iter != directoryEnd; ++iter) { +- string filename = iter->leaf(); ++ string filename = iter->path().filename().string(); + + if (filename.find('.') == filename.npos) + continue; @@ -237,7 +237,7 @@ - fs::directory_iterator directoryEnd; // default construction yields past-the-end
- for (fs::directory_iterator iter(globalSettings.bdp + "fleets/"); iter != directoryEnd; ++iter) {
- if (fs::is_directory(*iter)) {
-- string fleetName = iter->leaf();
-+ string fleetName = iter->path().filename().string();
-
- if (CheckFleetExists(fleetName)) {
- tempItem.desc = fleetName;
+ fs::directory_iterator directoryEnd; // default construction yields past-the-end + for (fs::directory_iterator iter(globalSettings.bdp + "fleets/"); iter != directoryEnd; ++iter) { + if (fs::is_directory(*iter)) { +- string fleetName = iter->leaf(); ++ string fleetName = iter->path().filename().string(); + + if (CheckFleetExists(fleetName)) { + tempItem.desc = fleetName; @@ -261,7 +261,7 @@ - fs::path iterPath(GetFleetDir(whichSide));
- fs::directory_iterator directoryEnd; // default construction yields past-the-end
- for (fs::directory_iterator iter(iterPath); iter != directoryEnd; ++iter) {
-- string filename = iter->leaf();
-+ string filename = iter->path().filename().string();
-
- if (filename.find('.') == filename.npos)
- continue;
---- a/Stuff.cpp.orig 2012-08-20 17:52:36.000000000 +0200 -+++ b/Stuff.cpp 2012-08-20 17:53:11.000000000 +0200 + fs::path iterPath(GetFleetDir(whichSide)); + fs::directory_iterator directoryEnd; // default construction yields past-the-end + for (fs::directory_iterator iter(iterPath); iter != directoryEnd; ++iter) { +- string filename = iter->leaf(); ++ string filename = iter->path().filename().string(); + + if (filename.find('.') == filename.npos) + continue; +--- a/Stuff.cpp ++++ b/Stuff.cpp @@ -657,7 +657,7 @@ - fs::directory_iterator directoryEnd; // default construction yields past-the-end
- for (fs::directory_iterator iter(tempPath); iter != directoryEnd; ++iter) {
- if (fs::is_directory(*iter) && !fs::is_empty(*iter))
-- RemoveDirectory(iter->string());
-+ RemoveDirectory(iter->path().string());
- else
- fs::remove(*iter);
- }
+ fs::directory_iterator directoryEnd; // default construction yields past-the-end + for (fs::directory_iterator iter(tempPath); iter != directoryEnd; ++iter) { + if (fs::is_directory(*iter) && !fs::is_empty(*iter)) +- RemoveDirectory(iter->string()); ++ RemoveDirectory(iter->path().string()); + else + fs::remove(*iter); + } diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-boost.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-boost.patch index c7fd49135dee..0da874e8715e 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-boost.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-boost.patch @@ -1,11 +1,11 @@ ---- src/SetupBattle.cpp -+++ src/SetupBattle.cpp +--- a/SetupBattle.cpp ++++ b/SetupBattle.cpp @@ -18,7 +18,7 @@ - #include "PreBattle.h"
-
- #include <sstream>
--#include <boost/filesystem/exception.hpp>
-+#include <boost/filesystem.hpp>
-
- using std::stringstream;
- using std::getline;
+ #include "PreBattle.h" + + #include <sstream> +-#include <boost/filesystem/exception.hpp> ++#include <boost/filesystem.hpp> + + using std::stringstream; + using std::getline; diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-destdirs.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-destdirs.patch index 7c60c4efa624..01283c5ab50f 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-destdirs.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-destdirs.patch @@ -1,11 +1,11 @@ ---- a/Main.cpp.old 2006-07-28 00:04:46.000000000 +0200 -+++ b/Main.cpp 2006-07-28 00:08:28.000000000 +0200 +--- a/Main.cpp ++++ b/Main.cpp @@ -184,7 +184,7 @@ - #ifndef WIN32
- string settingsPath = userHomePath + "settings.dat";
- if (!DoesFileExist(settingsPath))
-- settingsPath = "settings.dat";
-+ settingsPath = "@GAMES_DATADIR@/galaxyhack/settings.dat";
- #else
- string settingsPath = "settings.dat";
- #endif
+ #ifndef WIN32 + string settingsPath = userHomePath + "settings.dat"; + if (!DoesFileExist(settingsPath)) +- settingsPath = "settings.dat"; ++ settingsPath = "@GAMES_DATADIR@/galaxyhack/settings.dat"; + #else + string settingsPath = "settings.dat"; + #endif diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch index 478e58001c73..f878fbd904a5 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-format.patch @@ -1,64 +1,64 @@ ---- a/JSDL.cpp.old 2016-01-04 10:42:56.404316856 +0100 -+++ b/JSDL.cpp 2016-01-04 10:51:16.744255312 +0100 +--- a/JSDL.cpp ++++ b/JSDL.cpp @@ -47,14 +47,14 @@ - if (!globalSettings.batch) {
- if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) {
- char output[120];
-- sprintf(output, SDL_GetError());
-+ strcpy(output, SDL_GetError());
- throw runtime_error(output);
- }
-
- if (!globalSettings.disableSound) {
- if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) {
- char error[120];
-- sprintf(error, SDL_GetError());
-+ strcpy(error, SDL_GetError());
- string errorStr = error;
- errorStr += ", continuing without initialising sound.";
- WriteLog(errorStr);
+ if (!globalSettings.batch) { + if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO) == -1) { + char output[120]; +- sprintf(output, SDL_GetError()); ++ strcpy(output, SDL_GetError()); + throw runtime_error(output); + } + + if (!globalSettings.disableSound) { + if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1) { + char error[120]; +- sprintf(error, SDL_GetError()); ++ strcpy(error, SDL_GetError()); + string errorStr = error; + errorStr += ", continuing without initialising sound."; + WriteLog(errorStr); @@ -81,7 +81,7 @@ - //4096 is rather a large chunksize, should be smaller if I add sound effects
- if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 4096) == -1) {
- char output[100];
-- sprintf(output, Mix_GetError());
-+ strcpy(output, Mix_GetError());
- throw runtime_error(output);
- }
- }
+ //4096 is rather a large chunksize, should be smaller if I add sound effects + if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 4096) == -1) { + char output[100]; +- sprintf(output, Mix_GetError()); ++ strcpy(output, Mix_GetError()); + throw runtime_error(output); + } + } @@ -101,7 +101,7 @@ - if (screen == NULL) {
- SDL_Quit();
- char output[120];
-- sprintf(output, SDL_GetError());
-+ strcpy(output, SDL_GetError());
- throw runtime_error(output);
- }
- }
+ if (screen == NULL) { + SDL_Quit(); + char output[120]; +- sprintf(output, SDL_GetError()); ++ strcpy(output, SDL_GetError()); + throw runtime_error(output); + } + } @@ -114,7 +114,7 @@ -
- if (loadingSurface == NULL) {
- char output[100];
-- sprintf(output, IMG_GetError());
-+ strcpy(output, IMG_GetError());
- throw runtime_error(output);
- }
-
+ + if (loadingSurface == NULL) { + char output[100]; +- sprintf(output, IMG_GetError()); ++ strcpy(output, IMG_GetError()); + throw runtime_error(output); + } + @@ -308,7 +308,7 @@ -
- if (!theMusic) {
- char output[100];
-- sprintf(output, Mix_GetError());
-+ strcpy(output, Mix_GetError());
- throw runtime_error(output);
- }
- }
+ + if (!theMusic) { + char output[100]; +- sprintf(output, Mix_GetError()); ++ strcpy(output, Mix_GetError()); + throw runtime_error(output); + } + } @@ -319,7 +319,7 @@ -
- if (Mix_PlayMusic(theMusic, -1) == -1) {
- char output[100];
-- sprintf(output, Mix_GetError());
-+ strcpy(output, Mix_GetError());
- throw runtime_error(output);
- }
- }
+ + if (Mix_PlayMusic(theMusic, -1) == -1) { + char output[100]; +- sprintf(output, Mix_GetError()); ++ strcpy(output, Mix_GetError()); + throw runtime_error(output); + } + } diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-gcc43.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-gcc43.patch index eeb64d12e587..817958b0403a 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-gcc43.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-gcc43.patch @@ -1,12 +1,11 @@ -diff -aur src.old/JSDL.cpp src/JSDL.cpp ---- src.old/JSDL.cpp 2008-07-17 18:31:38.000000000 +0200 -+++ src/JSDL.cpp 2008-07-17 19:19:39.000000000 +0200 +--- a/JSDL.cpp ++++ b/JSDL.cpp @@ -20,7 +20,7 @@ - #include <cstdlib>
- #include <fstream>
- #include <stdexcept>
--
-+#include <cstring>
- using std::runtime_error;
- using std::memcpy;
-
+ #include <cstdlib> + #include <fstream> + #include <stdexcept> +- ++#include <cstring> + using std::runtime_error; + using std::memcpy; + diff --git a/games-strategy/galaxyhack/files/galaxyhack-1.74-gentoo.patch b/games-strategy/galaxyhack/files/galaxyhack-1.74-gentoo.patch index 9e55c941bfeb..e9fb838826ec 100644 --- a/games-strategy/galaxyhack/files/galaxyhack-1.74-gentoo.patch +++ b/games-strategy/galaxyhack/files/galaxyhack-1.74-gentoo.patch @@ -1,5 +1,5 @@ ---- a/Makefile.old 2009-02-11 22:21:26.000000000 +0100 -+++ b/Makefile 2009-02-11 22:20:58.000000000 +0100 +--- a/Makefile ++++ b/Makefile @@ -6,12 +6,11 @@ # James Gregory and Everton da Silva Marques <evertonsm@yahoo.com.br> # diff --git a/games-strategy/galaxyhack/galaxyhack-1.74-r1.ebuild b/games-strategy/galaxyhack/galaxyhack-1.74-r1.ebuild index aead3e7b9481..1466c52f896d 100644 --- a/games-strategy/galaxyhack/galaxyhack-1.74-r1.ebuild +++ b/games-strategy/galaxyhack/galaxyhack-1.74-r1.ebuild @@ -1,29 +1,28 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=6 -inherit eutils flag-o-matic readme.gentoo-r1 +EAPI=7 + +inherit desktop edos2unix toolchain-funcs readme.gentoo-r1 DESCRIPTION="Multiplayer AI script based strategy game" HOMEPAGE="http://galaxyhack.sourceforge.net/" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2 mirror://gentoo/${PN}.png" +S="${WORKDIR}/${PN}/src" LICENSE="GPL-2 galaxyhack" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="" RDEPEND=" + >=dev-libs/boost-1.34:= media-libs/libsdl[video] media-libs/sdl-image[png] media-libs/sdl-mixer[mod,vorbis] - >=dev-libs/boost-1.34 " RDEPEND="${DEPEND}" -S="${WORKDIR}/${PN}/src" - DISABLE_AUTOFORMATTING="yes" DOC_CONTENTS=" Settings will default to those found in @@ -35,30 +34,46 @@ Additional user submitted fleets can be downloaded from http://galaxyhack.sourceforge.net/viewfleets.php " +PATCHES=( + "${FILESDIR}"/${P}-destdirs.patch + "${FILESDIR}"/${P}-boost.patch + "${FILESDIR}"/${P}-gcc43.patch + "${FILESDIR}"/${P}-boost-1.50.patch + "${FILESDIR}"/${P}-format.patch + "${FILESDIR}"/${P}-gentoo.patch +) + src_prepare() { + edos2unix *.cpp Makefile + default - edos2unix Makefile - eapply \ - "${FILESDIR}"/${P}-destdirs.patch \ - "${FILESDIR}"/${P}-boost.patch \ - "${FILESDIR}"/${P}-gcc43.patch \ - "${FILESDIR}"/${P}-boost-1.50.patch \ - "${FILESDIR}"/${P}-format.patch \ - "${FILESDIR}"/${P}-gentoo.patch + sed -i "s:@GAMES_DATADIR@:/usr/share:" \ Main.cpp || die sed -i "/Base data path/s:pwd:/usr/share/${PN}:" \ ../settings.dat || die + + sed -i \ + -e 's:INSTALL_DIR="${GAMES_DATADIR}":INSTALL_DIR="/usr/share/":' \ + -e 's:INSTALL_BIN_DIR="${GAMES_BINDIR}":INSTALL_BIN_DIR="/usr/bin":' \ + Makefile || die +} + +src_configure() { + tc-export CXX } src_install() { - dobin "${PN}" - cd .. + dobin ${PN} + cd .. || die + insinto /usr/share/${PN} doins -r fleets gamedata graphics music standardpictures \ settings.dat + dodoc readme.txt readme.gentoo_create_doc + doicon "${DISTDIR}"/${PN}.png make_desktop_entry ${PN} GalaxyHack } |