summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjc_gargma <jc_gargma@iserlohn-fortress.net>2020-03-27 17:13:46 -0700
committerjc_gargma <jc_gargma@iserlohn-fortress.net>2020-03-27 17:13:46 -0700
commit5c075a303158a744000492e69393e6ff14edbee5 (patch)
treea6f5df5b3a83a6efc564507f8da69b620e874465
downloadopenxcom-5c075a303158a744000492e69393e6ff14edbee5.tar.xz
Initial commit
-rw-r--r--PKGBUILD49
-rw-r--r--openxcom-abs-fix.patch42
-rw-r--r--openxcom-auto_ptr-fix.patch75
-rw-r--r--openxcom-cmath-algorithm-fixes.patch55
-rw-r--r--openxcom.install5
5 files changed, 226 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 0000000..5745549
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,49 @@
+# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net>
+# Maintainer (AUR): WorMzy Tykashi <wormzy.tykashi@gmail.com>
+# Contributor (AUR): Ian Thompson <dalrik370 at gmail dot com>
+# Contributor (AUR): Anton Bazhenov <anton.bazhenov at gmail>
+# Contributor (AUR): TheBenj88 <thebenj88 *AT* gmail *DOT* com>
+
+# # I maintain this because:
+# I use it and it is not in an official repo
+
+pkgname=openxcom
+pkgver=1.0
+pkgrel=8
+pkgdesc="An open-source reimplementation of the famous X-COM game"
+arch=('i686' 'x86_64' 'aarch64')
+url="https://openxcom.org/"
+license=('GPL3')
+depends=('sdl_gfx' 'sdl_mixer' 'sdl_image' 'yaml-cpp' 'mesa')
+makedepends=('boost' 'glu' 'xmlto' 'docbook-xml' 'docbook-xsl' 'xorgproto')
+install="${pkgname}.install"
+source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/SupSuper/OpenXcom/archive/v1.0.tar.gz"
+ "openxcom-abs-fix.patch"
+ "openxcom-auto_ptr-fix.patch"
+ "openxcom-cmath-algorithm-fixes.patch")
+b2sums=('ce1c35d3d25e5f327549b3656f4b41d6e37503619c7ccb13ee5382faba905f491c01a0e2af03b70b7237bea3f3fd4a51f7a2be2c44c1feade1b848ad1a414fa3'
+ '28792cef812953605053558a85ea555efb27ac0d4225d5a1e480af136fb8c19a1bec7d4c8542c02f020eb376bb4c70fdc68cf8deda1208eeff6bea81136a5ccb'
+ '2a4d4743cb112d783a014bf77c63106693aeb9ab8bd74cde8342e06614f4330183756d01eb4559d45d9fc7d583fc4529a302d589c175b4a1a0bbce9b9a7a3a26'
+ '633e5ded118bb031cbf0ca3d70d785cd6e757949eeec3adfbfd40b06b8d4c85cc49d3da6ea0e64d4a5a92cad7791b7789c35e8e0501c374d0d24d0cb22d6c21a')
+
+prepare() {
+ cd OpenXcom-${pkgver}
+ patch -Np1 -i "${srcdir}/openxcom-abs-fix.patch"
+ patch -Np1 -i "${srcdir}/openxcom-auto_ptr-fix.patch"
+ patch -Np1 -i "${srcdir}/openxcom-cmath-algorithm-fixes.patch"
+}
+
+build() {
+ cd OpenXcom-${pkgver}
+ export CFLAGS="$CFLAGS -O3 -fstack-protector-all -flto=4 -fPIE"
+ export CXXFLAGS="$CXXFLAGS -O3 -fstack-protector-all -flto=4 -fPIE"
+ export LDFLAGS="$LDFLAGS,-pie"
+ ./autogen.sh
+ ./configure --prefix=/usr --without-docs --disable-werror
+ make
+}
+
+package() {
+ cd OpenXcom-${pkgver}
+ make DESTDIR="${pkgdir}" install
+}
diff --git a/openxcom-abs-fix.patch b/openxcom-abs-fix.patch
new file mode 100644
index 0000000..fbffbb7
--- /dev/null
+++ b/openxcom-abs-fix.patch
@@ -0,0 +1,42 @@
+From 49bec0851fc6e5365cac0f71b2c40a80ddf95e77 Mon Sep 17 00:00:00 2001
+From: Louis Delacroix <yoursecretsaresafe@googlemail.com>
+Date: Sun, 16 Nov 2014 20:47:41 +0000
+Subject: [PATCH] Fix use of abs() for floating point arguments
+
+---
+ src/Battlescape/ProjectileFlyBState.cpp | 2 +-
+ src/Geoscape/Globe.cpp | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/Battlescape/ProjectileFlyBState.cpp b/src/Battlescape/ProjectileFlyBState.cpp
+index c890d12..2ea67ae 100644
+--- a/src/Battlescape/ProjectileFlyBState.cpp
++++ b/src/Battlescape/ProjectileFlyBState.cpp
+@@ -651,7 +651,7 @@ int ProjectileFlyBState::getMaxThrowDistance(int weight, int strength, int level
+ if (curZ < 0 && dz < 0) //roll back
+ {
+ dz = std::max(dz, -1.0);
+- if (abs(dz)>1e-10) //rollback horizontal
++ if (std::abs(dz)>1e-10) //rollback horizontal
+ dist -= curZ / dz;
+ break;
+ }
+diff --git a/src/Geoscape/Globe.cpp b/src/Geoscape/Globe.cpp
+index e5249ce..1a360dd 100755
+--- a/src/Geoscape/Globe.cpp
++++ b/src/Geoscape/Globe.cpp
+@@ -1217,12 +1217,12 @@ void Globe::drawVHLine(Surface *surface, double lon1, double lat1, double lon2,
+
+ if (fabs(sx)<0.01)
+ {
+- seg = abs( sy/(2*M_PI)*48 );
++ seg = std::abs(sy/(2*M_PI)*48);
+ if (seg == 0) ++seg;
+ }
+ else
+ {
+- seg = abs( sx/(2*M_PI)*96 );
++ seg = std::abs(sx/(2*M_PI)*96);
+ if (seg == 0) ++seg;
+ }
+
diff --git a/openxcom-auto_ptr-fix.patch b/openxcom-auto_ptr-fix.patch
new file mode 100644
index 0000000..e853164
--- /dev/null
+++ b/openxcom-auto_ptr-fix.patch
@@ -0,0 +1,75 @@
+diff -aur a/src/Ruleset/RuleAlienMission.cpp b/src/Ruleset/RuleAlienMission.cpp
+--- a/src/Ruleset/RuleAlienMission.cpp 2016-05-09 14:33:33.955934374 +0100
++++ b/src/Ruleset/RuleAlienMission.cpp 2016-05-09 14:33:15.148834301 +0100
+@@ -85,7 +85,7 @@
+ if (assoc.end() == existing)
+ {
+ // New entry, load and add it.
+- std::auto_ptr<WeightedOptions> nw(new WeightedOptions);
++ std::unique_ptr<WeightedOptions> nw(new WeightedOptions);
+ nw->load(nn->second);
+ assoc.insert(std::make_pair(month, nw.release()));
+ }
+diff -aur a/src/Ruleset/Ruleset.cpp b/src/Ruleset/Ruleset.cpp
+--- a/src/Ruleset/Ruleset.cpp 2016-05-09 14:37:50.699784577 +0100
++++ b/src/Ruleset/Ruleset.cpp 2016-05-09 14:41:53.193130469 +0100
+@@ -437,7 +437,7 @@
+ }
+ else
+ {
+- std::auto_ptr<MCDPatch> patch(new MCDPatch());
++ std::unique_ptr<MCDPatch> patch(new MCDPatch());
+ patch->load(*i);
+ _MCDPatches[type] = patch.release();
+ _MCDPatchesIndex.push_back(type);
+@@ -446,7 +446,7 @@
+ for (YAML::const_iterator i = doc["extraSprites"].begin(); i != doc["extraSprites"].end(); ++i)
+ {
+ std::string type = (*i)["type"].as<std::string>();
+- std::auto_ptr<ExtraSprites> extraSprites(new ExtraSprites());
++ std::unique_ptr<ExtraSprites> extraSprites(new ExtraSprites());
+ extraSprites->load(*i, _modIndex);
+ _extraSprites.push_back(std::make_pair(type, extraSprites.release()));
+ _extraSpritesIndex.push_back(type);
+@@ -454,7 +454,7 @@
+ for (YAML::const_iterator i = doc["extraSounds"].begin(); i != doc["extraSounds"].end(); ++i)
+ {
+ std::string type = (*i)["type"].as<std::string>();
+- std::auto_ptr<ExtraSounds> extraSounds(new ExtraSounds());
++ std::unique_ptr<ExtraSounds> extraSounds(new ExtraSounds());
+ extraSounds->load(*i, _modIndex);
+ _extraSounds.push_back(std::make_pair(type, extraSounds.release()));
+ _extraSoundsIndex.push_back(type);
+@@ -468,7 +468,7 @@
+ }
+ else
+ {
+- std::auto_ptr<ExtraStrings> extraStrings(new ExtraStrings());
++ std::unique_ptr<ExtraStrings> extraStrings(new ExtraStrings());
+ extraStrings->load(*i);
+ _extraStrings[type] = extraStrings.release();
+ _extraStringsIndex.push_back(type);
+diff -aur a/src/Savegame/AlienStrategy.cpp b/src/Savegame/AlienStrategy.cpp
+--- a/src/Savegame/AlienStrategy.cpp 2016-05-09 14:37:50.704784621 +0100
++++ b/src/Savegame/AlienStrategy.cpp 2016-05-09 14:41:39.184983581 +0100
+@@ -87,7 +87,7 @@
+ {
+ std::string region = (*nn)["region"].as<std::string>();
+ const YAML::Node &missions = (*nn)["missions"];
+- std::auto_ptr<WeightedOptions> options(new WeightedOptions());
++ std::unique_ptr<WeightedOptions> options(new WeightedOptions());
+ options->load(missions);
+ _regionMissions.insert(std::make_pair(region, options.release()));
+ }
+diff -aur a/src/Savegame/SavedGame.cpp b/src/Savegame/SavedGame.cpp
+--- a/src/Savegame/SavedGame.cpp 2016-05-09 14:37:50.704784621 +0100
++++ b/src/Savegame/SavedGame.cpp 2016-05-09 14:41:29.698884793 +0100
+@@ -371,7 +371,7 @@
+ {
+ std::string missionType = (*it)["type"].as<std::string>();
+ const RuleAlienMission &mRule = *rule->getAlienMission(missionType);
+- std::auto_ptr<AlienMission> mission(new AlienMission(mRule));
++ std::unique_ptr<AlienMission> mission(new AlienMission(mRule));
+ mission->load(*it, *this);
+ _activeMissions.push_back(mission.release());
+ }
diff --git a/openxcom-cmath-algorithm-fixes.patch b/openxcom-cmath-algorithm-fixes.patch
new file mode 100644
index 0000000..e27d703
--- /dev/null
+++ b/openxcom-cmath-algorithm-fixes.patch
@@ -0,0 +1,55 @@
+diff -aur a/src/Basescape/BaseInfoState.h b/src/Basescape/BaseInfoState.h
+--- a/src/Basescape/BaseInfoState.h 2018-03-14 15:06:59.665628271 +0000
++++ b/src/Basescape/BaseInfoState.h 2018-03-14 15:43:22.067605905 +0000
+@@ -19,6 +19,7 @@
+ #ifndef OPENXCOM_BASEINFOSTATE_H
+ #define OPENXCOM_BASEINFOSTATE_H
+
++#include <cmath>
+ #include "../Engine/State.h"
+
+ namespace OpenXcom
+diff -aur a/src/Basescape/CraftInfoState.h b/src/Basescape/CraftInfoState.h
+--- a/src/Basescape/CraftInfoState.h 2018-03-14 15:02:09.783729176 +0000
++++ b/src/Basescape/CraftInfoState.h 2018-03-14 15:43:16.476703036 +0000
+@@ -19,6 +19,7 @@
+ #ifndef OPENXCOM_CRAFTINFOSTATE_H
+ #define OPENXCOM_CRAFTINFOSTATE_H
+
++#include <cmath>
+ #include "../Engine/State.h"
+
+ namespace OpenXcom
+diff -aur a/src/Engine/Language.h b/src/Engine/Language.h
+--- a/src/Engine/Language.h 2018-03-14 15:11:37.236763021 +0000
++++ b/src/Engine/Language.h 2018-03-14 15:42:14.751775215 +0000
+@@ -23,6 +23,7 @@
+ #include <vector>
+ #include <string>
+ #include <yaml-cpp/yaml.h>
++#include <algorithm>
+ #include "LocalizedText.h"
+ #include "../Savegame/Soldier.h"
+
+diff -aur a/src/Engine/OptionInfo.h b/src/Engine/OptionInfo.h
+--- a/src/Engine/OptionInfo.h 2018-03-14 15:14:50.346384845 +0000
++++ b/src/Engine/OptionInfo.h 2018-03-14 15:42:14.750775233 +0000
+@@ -23,6 +23,7 @@
+ #include <string>
+ #include <map>
+ #include <SDL.h>
++#include <algorithm>
+
+ namespace OpenXcom
+ {
+diff -aur a/src/Savegame/CraftWeapon.h b/src/Savegame/CraftWeapon.h
+--- a/src/Savegame/CraftWeapon.h 2018-03-14 15:27:14.695387913 +0000
++++ b/src/Savegame/CraftWeapon.h 2018-03-14 15:42:14.748775267 +0000
+@@ -21,6 +21,7 @@
+
+ #include <string>
+ #include <yaml-cpp/yaml.h>
++#include <cmath>
+
+ namespace OpenXcom
+ {
diff --git a/openxcom.install b/openxcom.install
new file mode 100644
index 0000000..5d741f5
--- /dev/null
+++ b/openxcom.install
@@ -0,0 +1,5 @@
+post_install() {
+ echo " OpenXcom requires the original X-COM resources."
+ echo " Copy these game subfolders to /usr/share/openxcom/data:"
+ echo "GEODATA, GEOGRAPH, MAPS, ROUTES, SOUND, TERRAIN, UFOGRAPH, UFOINTRO, UNITS"
+}