summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2016-10-11 23:27:44 +0100
committerJames Le Cuirot <chewi@gentoo.org>2016-10-11 23:29:37 +0100
commit084125792256c6117509431b3a2ab5ef6066d80a (patch)
tree7a0bf9f41761ac9973b9afd209622827cceecb34 /games-strategy/triplea
parentdev-java/upnplib: New package, needed by games-strategy/triplea (diff)
downloadgentoo-084125792256c6117509431b3a2ab5ef6066d80a.tar.gz
gentoo-084125792256c6117509431b3a2ab5ef6066d80a.tar.bz2
gentoo-084125792256c6117509431b3a2ab5ef6066d80a.zip
games-strategy/triplea: Libs (#596468), drop games eclass, fix paths
It's hard to see how this ever worked as it built against bundled libraries but did not install them. It turns out many aren't needed so we now unbundle them all except Apache Derby, which was last-rited. The server tried to write under /usr/share and ${PWD} by default, which is bad and bad. I have made it write under ~/.triplea. Package-Manager: portage-2.3.1
Diffstat (limited to 'games-strategy/triplea')
-rw-r--r--games-strategy/triplea/files/mkdir.sh1
-rw-r--r--games-strategy/triplea/files/paths.patch63
-rw-r--r--games-strategy/triplea/files/upnplib.patch14
-rw-r--r--games-strategy/triplea/triplea-1.8.0.9-r1.ebuild81
4 files changed, 159 insertions, 0 deletions
diff --git a/games-strategy/triplea/files/mkdir.sh b/games-strategy/triplea/files/mkdir.sh
new file mode 100644
index 000000000000..f1bd04d125c1
--- /dev/null
+++ b/games-strategy/triplea/files/mkdir.sh
@@ -0,0 +1 @@
+mkdir -v "${HOME}/.triplea"
diff --git a/games-strategy/triplea/files/paths.patch b/games-strategy/triplea/files/paths.patch
new file mode 100644
index 000000000000..f0cd91e3abe6
--- /dev/null
+++ b/games-strategy/triplea/files/paths.patch
@@ -0,0 +1,63 @@
+diff -Naur a/src/games/strategy/engine/framework/GameRunner2.java b/src/games/strategy/engine/framework/GameRunner2.java
+--- a/src/games/strategy/engine/framework/GameRunner2.java 2015-09-02 20:30:04.000000000 +0100
++++ b/src/games/strategy/engine/framework/GameRunner2.java 2016-10-11 23:08:50.296813567 +0100
+@@ -952,9 +952,9 @@
+ // the default
+ File rootDir;
+ if (GameRunner.isMac()) {
+- rootDir = new File(new File(userHome, "Documents"), "triplea");
++ rootDir = new File(new File(userHome, "Documents"), ".triplea");
+ } else {
+- rootDir = new File(userHome, "triplea");
++ rootDir = new File(userHome, ".triplea");
+ }
+ return rootDir;
+ }
+diff -Naur a/src/games/strategy/engine/lobby/server/userDB/Database.java b/src/games/strategy/engine/lobby/server/userDB/Database.java
+--- a/src/games/strategy/engine/lobby/server/userDB/Database.java 2015-08-19 16:35:06.000000000 +0100
++++ b/src/games/strategy/engine/lobby/server/userDB/Database.java 2016-10-11 23:08:50.296813567 +0100
+@@ -54,7 +54,7 @@
+ if (System.getProperties().containsKey(ServerLauncher.SERVER_ROOT_DIR_PROPERTY)) {
+ root = new File(System.getProperties().getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY));
+ } else {
+- root = GameRunner2.getRootFolder();
++ root = GameRunner2.getUserRootFolder();
+ }
+ if (!root.exists()) {
+ throw new IllegalStateException("Root dir does not exist");
+diff -Naur a/src/games/strategy/util/AccessLogFileHandler.java b/src/games/strategy/util/AccessLogFileHandler.java
+--- a/src/games/strategy/util/AccessLogFileHandler.java 2015-08-19 16:35:06.000000000 +0100
++++ b/src/games/strategy/util/AccessLogFileHandler.java 2016-10-11 23:10:31.219309604 +0100
+@@ -12,7 +12,7 @@
+ private static final String logFile;
+
+ static {
+- final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, "."));
++ final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, games.strategy.engine.framework.GameRunner2.getUserRootFolder().getAbsolutePath()));
+ if (!rootDir.exists()) {
+ throw new IllegalStateException("no dir called:" + rootDir.getAbsolutePath());
+ }
+diff -Naur a/src/games/strategy/util/RotatingLogFileHandlerForHeadlessGameServer.java b/src/games/strategy/util/RotatingLogFileHandlerForHeadlessGameServer.java
+--- a/src/games/strategy/util/RotatingLogFileHandlerForHeadlessGameServer.java 2015-08-19 16:35:06.000000000 +0100
++++ b/src/games/strategy/util/RotatingLogFileHandlerForHeadlessGameServer.java 2016-10-11 23:10:40.227175356 +0100
+@@ -13,7 +13,7 @@
+ private static final String logFile;
+
+ static {
+- final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, "."));
++ final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, games.strategy.engine.framework.GameRunner2.getUserRootFolder().getAbsolutePath()));
+ if (!rootDir.exists()) {
+ throw new IllegalStateException("no dir called:" + rootDir.getAbsolutePath());
+ }
+diff -Naur a/src/games/strategy/util/RotatingLogFileHandler.java b/src/games/strategy/util/RotatingLogFileHandler.java
+--- a/src/games/strategy/util/RotatingLogFileHandler.java 2015-08-19 16:35:06.000000000 +0100
++++ b/src/games/strategy/util/RotatingLogFileHandler.java 2016-10-11 23:10:46.851076636 +0100
+@@ -12,7 +12,7 @@
+ private static final String logFile;
+
+ static {
+- final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, "."));
++ final File rootDir = new File(System.getProperty(ServerLauncher.SERVER_ROOT_DIR_PROPERTY, games.strategy.engine.framework.GameRunner2.getUserRootFolder().getAbsolutePath()));
+ if (!rootDir.exists()) {
+ throw new IllegalStateException("no dir called:" + rootDir.getAbsolutePath());
+ }
diff --git a/games-strategy/triplea/files/upnplib.patch b/games-strategy/triplea/files/upnplib.patch
new file mode 100644
index 000000000000..f17b7891302a
--- /dev/null
+++ b/games-strategy/triplea/files/upnplib.patch
@@ -0,0 +1,14 @@
+diff -Naur a/src/games/strategy/net/UniversalPlugAndPlayHelper.java b/src/games/strategy/net/UniversalPlugAndPlayHelper.java
+--- a/src/games/strategy/net/UniversalPlugAndPlayHelper.java 2015-08-19 16:35:06.000000000 +0100
++++ b/src/games/strategy/net/UniversalPlugAndPlayHelper.java 2016-10-11 22:10:37.287834187 +0100
+@@ -166,8 +166,8 @@
+ System.out.println("To " + m_local.getHostAddress() + ":" + internalPort);
+ boolean mapped = false;
+ try {
+- mapped = m_device.addPortMapping("TripleA Game Hosting", "TCP", null, externalPort, m_local.getHostAddress(),
+- internalPort, 0);
++ mapped = m_device.addPortMapping("TripleA Game Hosting", null, internalPort, externalPort,
++ m_local.getHostAddress(), 0, "TCP");
+ } catch (final IOException e) {
+ System.out.println("Port Mapping Failed! Please try to Forward Ports manually! \r\n " + e.getMessage());
+ return "Port Mapping Failed! Please try to Forward Ports manually! \r\n " + e.getMessage();
diff --git a/games-strategy/triplea/triplea-1.8.0.9-r1.ebuild b/games-strategy/triplea/triplea-1.8.0.9-r1.ebuild
new file mode 100644
index 000000000000..0cf68a68a96e
--- /dev/null
+++ b/games-strategy/triplea/triplea-1.8.0.9-r1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils java-pkg-2 java-ant-2 versionator
+
+MY_PV=$(replace_all_version_separators _)
+DESCRIPTION="An open source clone of the popular Axis and Allies boardgame"
+HOMEPAGE="http://triplea.sourceforge.net/"
+SRC_URI="mirror://sourceforge/triplea/${PN}_${MY_PV}_source_code_only.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="test"
+RESTRICT="test" # Needs X11 maybe use virtualx.eclass
+
+RDEPEND="dev-java/apple-java-extensions-bin:0
+ dev-java/commons-httpclient:3
+ dev-java/oracle-javamail:0
+ dev-java/osgi-core-api:0
+ dev-java/upnplib:0"
+DEPEND="${RDEPEND}
+ >=virtual/jdk-1.7
+ app-arch/unzip
+ test? ( dev-java/ant-junit:0 )"
+RDEPEND="${RDEPEND}
+ >=virtual/jre-1.7"
+
+S=${WORKDIR}/${PN}_${MY_PV}
+
+JAVA_ANT_REWRITE_CLASSPATH="true"
+EANT_GENTOO_CLASSPATH="apple-java-extensions-bin,commons-httpclient-3,oracle-javamail,osgi-core-api,upnplib"
+
+java_prepare() {
+ # Use ~/.triplea, not ~/triplea.
+ # Don't write server files under /usr/share or ${PWD}.
+ # Fix to build against our packaged upnplib.
+ epatch "${FILESDIR}"/{paths,upnplib}.patch
+
+ # Remove packaged or unneeded libs. Unfortunately Apache Derby was
+ # last-rited due to packaging issues. See bug #561410.
+ find lib/* ! -name "derby-*.jar" -delete || die
+ rm -r old/ || die
+}
+
+src_compile() {
+ eant
+ echo "triplea.saveGamesInHomeDir=true" > data/triplea.properties || die
+ # The only target creating this is zip which does unjar etc
+ jar cf ${PN}.jar -C classes . || die
+}
+
+src_test() {
+ java-pkg-2_src_test
+}
+
+src_install() {
+ insinto /usr/share/${PN}
+ doins -r assets data dice_servers maps
+
+ java-pkg_dojar ${PN}.jar
+ java-pkg_newjar lib/derby-*.jar derby.jar
+
+ java-pkg_dolauncher ${PN} \
+ --main games.strategy.engine.framework.GameRunner \
+ --java_args "-Xmx256m"
+ java-pkg_dolauncher ${PN}-server -pre "${FILESDIR}"/mkdir.sh \
+ --main games.strategy.engine.lobby.server.LobbyServer \
+ --java_args "-server -Xmx64m -Dtriplea.lobby.port=3303 -Dtriplea.lobby.console=true"
+
+ newicon icons/triplea_icon.png ${PN}.png
+ newicon icons/triplea_icon.png ${PN}-server.png
+ make_desktop_entry ${PN} TripleA
+ make_desktop_entry ${PN}-server TripleA-server
+
+ dodoc changelog.txt TripleA_RuleBook.pdf
+ docinto html
+ dodoc -r doc/* readme.html
+}