summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2024-08-17 23:54:07 +0100
committerJames Le Cuirot <chewi@gentoo.org>2024-08-17 23:59:31 +0100
commit22985a134ffa7f4b185a361903bbe3f76da42e36 (patch)
tree6829be5916019a5c2aa10c841861a7e0f8e088cd
parentapp-arch/7zip: depend on app-arch/xz-utils[extra-filters(+)] (diff)
downloadgentoo-22985a134ffa7f4b185a361903bbe3f76da42e36.tar.gz
gentoo-22985a134ffa7f4b185a361903bbe3f76da42e36.tar.bz2
gentoo-22985a134ffa7f4b185a361903bbe3f76da42e36.zip
games-puzzle/magiccube4d: Version bump to 4.3.343
This is a rewrite in Java. The sound doesn't work, but it doesn't work with upstream's jar either. This saves the package from last-rites. Bug: https://bugs.gentoo.org/936299 Signed-off-by: James Le Cuirot <chewi@gentoo.org>
-rw-r--r--games-puzzle/magiccube4d/Manifest1
-rw-r--r--games-puzzle/magiccube4d/files/magiccube4d-xdg-config.patch64
-rw-r--r--games-puzzle/magiccube4d/magiccube4d-4.3.343.ebuild39
-rw-r--r--games-puzzle/magiccube4d/metadata.xml11
4 files changed, 111 insertions, 4 deletions
diff --git a/games-puzzle/magiccube4d/Manifest b/games-puzzle/magiccube4d/Manifest
index a1723fcf9e19..b521087ebdbb 100644
--- a/games-puzzle/magiccube4d/Manifest
+++ b/games-puzzle/magiccube4d/Manifest
@@ -1,2 +1,3 @@
+DIST magiccube4d-4.3.343.tar.gz 871676 BLAKE2B a023ef1c84546e32f0de032f3c8515fca8568fa8e22869446a480e878574064b8e5572d2a0e76ae88af06de4f18a911f36e478e9f3c3dc1979915c0aa58d64a3 SHA512 f9fc93d54d850495e9216aa0bbf8beffa662032921e9fef54de9940fc07ad03e9af52d9a488445e4985ec2369abe90494657e6f5e199ebc2070c707dd95cc486
DIST magiccube4d.gif 20739 BLAKE2B feaf1911e483bff7244476000c75b34794911fe279772b8f5d46ee8bd4125881fb71aaab0ebac891fd0a5db38b746c940991bf5fe9e1ad8a678240b2d6cddf82 SHA512 7a8902710eaa78a6580f024a86bfa1828870dc873a4fef30a7d4fa197a67cd1dde162d6d1d1ba0bea4307c13198d52505fb1a1fa3f6d10b3914af42d7c0ebd49
DIST mc4d-src-2_2.tgz 144645 BLAKE2B 5b29963d056961ce425f7644b14c35e44ce94bc7be6ea5f3fbbb4048478366951005eb8e91fe7cb12e6f1424ad55add31493e0ad3a4ab18eea9e747f940c35f3 SHA512 19491460bada93b4ee2010004128279cb88ab866a5a8c791080d59fa86e5bacf966d7dab0c9b3074e94b77611ae341480d19b384079e83df549ef25e592b12a6
diff --git a/games-puzzle/magiccube4d/files/magiccube4d-xdg-config.patch b/games-puzzle/magiccube4d/files/magiccube4d-xdg-config.patch
new file mode 100644
index 000000000000..e60ec6125c1c
--- /dev/null
+++ b/games-puzzle/magiccube4d/files/magiccube4d-xdg-config.patch
@@ -0,0 +1,64 @@
+From 7430d876b0efdb3f828a92df60a9e2d4d7ebc113 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 17 Aug 2024 23:31:43 +0100
+Subject: [PATCH] Write config to XDG_CONFIG_HOME or ~/.config unless old
+ config exists or on Win
+
+Storing configuration outside a standard user configuration directory is bad
+practise and very unhelpful for distributions wanting to package this software.
+
+This respects the old configuation location for compatibility.
+
+XDG_CONFIG_HOME or ~/.config should make sense on just about any non-Windows OS.
+---
+ src/com/superliminal/util/PropertyManager.java | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/com/superliminal/util/PropertyManager.java b/src/com/superliminal/util/PropertyManager.java
+index 80567fc..2a6de12 100644
+--- a/src/com/superliminal/util/PropertyManager.java
++++ b/src/com/superliminal/util/PropertyManager.java
+@@ -4,6 +4,8 @@ import java.util.*;
+ import java.io.*;
+ import java.awt.*;
+ import java.net.*;
++import java.nio.file.InvalidPathException;
++import java.nio.file.Paths;
+
+ /**
+ * Title: PropertyManager
+@@ -101,8 +103,19 @@ public class PropertyManager extends Properties {
+ * Applications should load any user-specific property overrides directly into this object
+ * and then call setProperty whenever a user action needs to change one.
+ */
+- public final static PropertyManager userprefs = new LocalProps(new File(StaticUtils.getBinDir(), PRODUCT_NAME + ".props"));
++ public final static PropertyManager userprefs;
+ static {
++ File propsFile = Paths.get(StaticUtils.getBinDir(), PRODUCT_NAME + ".props").toFile();
++
++ if (!propsFile.canWrite() && !System.getProperty("os.name").startsWith("Windows")) {
++ try {
++ propsFile = Paths.get(System.getenv("XDG_CONFIG_HOME"), PRODUCT_NAME + ".props").toFile();
++ } catch (NullPointerException | InvalidPathException e) {
++ propsFile = Paths.get(System.getProperty("user.home"), ".config", PRODUCT_NAME + ".props").toFile();
++ }
++ }
++
++ userprefs = new LocalProps(propsFile);
+ System.out.println("Launch dir: " + StaticUtils.getBinDir());
+ }
+
+@@ -256,8 +269,9 @@ public class PropertyManager extends Properties {
+ if(localPropFile == null || storeFailed)
+ return;
+ try {
++ localPropFile.getParentFile().mkdirs();
+ this.store(new FileOutputStream(localPropFile), PRODUCT_NAME + " User Preferences");
+- } catch(IOException e) {
++ } catch(IOException | SecurityException e) {
+ storeFailed = true; // so as to only give fail msg once
+ if(!localPropFile.canWrite())
+ System.err.println("Can't write");
+--
+2.45.2
+
diff --git a/games-puzzle/magiccube4d/magiccube4d-4.3.343.ebuild b/games-puzzle/magiccube4d/magiccube4d-4.3.343.ebuild
new file mode 100644
index 000000000000..99641bd510a5
--- /dev/null
+++ b/games-puzzle/magiccube4d/magiccube4d-4.3.343.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit desktop java-pkg-2 java-pkg-simple xdg
+
+DESCRIPTION="Four-dimensional analog of Rubik's cube"
+HOMEPAGE="https://www.superliminal.com/cube/cube.htm"
+SRC_URI="https://github.com/cutelyaware/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${P}"
+LICENSE="free-noncomm"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND=">=virtual/jre-1.8:*"
+DEPEND=">=virtual/jdk-1.8:*"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-xdg-config.patch
+)
+
+JAVA_SRC_DIR="src"
+JAVA_RESOURCE_DIRS=( src )
+
+src_prepare() {
+ default
+ java-pkg-2_src_prepare
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ java-pkg_dolauncher ${PN} --main com.superliminal.magiccube4d.MC4DSwing --java_args "-Xms128m -Xmx512m"
+
+ newicon -s 32 src/mc4d.png ${PN}.png
+ make_desktop_entry ${PN} "Magic Cube 4D"
+
+ dodoc README.md
+}
diff --git a/games-puzzle/magiccube4d/metadata.xml b/games-puzzle/magiccube4d/metadata.xml
index 1c3ba213c494..e105507f248f 100644
--- a/games-puzzle/magiccube4d/metadata.xml
+++ b/games-puzzle/magiccube4d/metadata.xml
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<maintainer type="project">
- <email>games@gentoo.org</email>
- <name>Gentoo Games Project</name>
-</maintainer>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">cutelyaware/magiccube4d</remote-id>
+ </upstream>
</pkgmetadata>