summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorf43nd1r2020-02-28 05:56:06 +0100
committerf43nd1r2020-02-28 05:56:06 +0100
commitf9ae48a565ce669a508e476595124f73c753c4d9 (patch)
treeee6fa89363911de6737199866adb16ac993591ca
downloadaur-f9ae48a565ce669a508e476595124f73c753c4d9.tar.gz
initial commit
-rw-r--r--.SRCINFO25
-rw-r--r--PKGBUILD62
-rw-r--r--megamek.patch22
-rw-r--r--megameklab.desktop9
-rw-r--r--megameklab.patch92
-rw-r--r--megameklab.sh2
6 files changed, 212 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..e650a46533c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = megameklab
+ pkgdesc = Customize mechs for a MegaMek game.
+ pkgver = 0.46.1
+ pkgrel = 1
+ url = https://github.com/MegaMek/megamek
+ arch = x86_64
+ license = GPL
+ makedepends = git
+ makedepends = tar
+ depends = java-runtime>=8
+ source = megameklab::git+https://github.com/MegaMek/megameklab#tag=v0.46.1
+ source = megamek::git+https://github.com/MegaMek/megamek#tag=v0.46.1
+ source = megameklab.desktop
+ source = megameklab.sh
+ source = megameklab.patch
+ source = megamek.patch
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = 7b3615680c9892099ab6e7b675e8e22baf9680d12a58050d46d71537a7fe0372
+ sha256sums = ca4459489d3c188b7418f7b596290accec61e2b190a58f4d0fd7593911d87597
+ sha256sums = 48642023e264f90a5831a9a9e91eda2bf33881d7d60f40979ff4e689c485714e
+ sha256sums = f1c3fd91d5e142dc1d800a8228ac66c4bc847a2b87a70b352845a2931b7392e6
+
+pkgname = megameklab
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..8b4ad6d806a
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,62 @@
+# Maintainer:F43nd1r <support@faendir.com>
+pkgname=megameklab
+pkgver=0.46.1
+pkgrel=1
+epoch=
+pkgdesc="Customize mechs for a MegaMek game."
+arch=('x86_64')
+url="https://github.com/MegaMek/megamek"
+license=('GPL')
+groups=()
+depends=('java-runtime>=8')
+makedepends=('git' 'tar')
+
+source=("${pkgname}::git+https://github.com/MegaMek/${pkgname}#tag=v${pkgver}"
+ "megamek::git+https://github.com/MegaMek/megamek#tag=v${pkgver}"
+ "megameklab.desktop"
+ "megameklab.sh"
+ "megameklab.patch"
+ "megamek.patch")
+sha256sums=('SKIP'
+ 'SKIP'
+ '7b3615680c9892099ab6e7b675e8e22baf9680d12a58050d46d71537a7fe0372'
+ 'ca4459489d3c188b7418f7b596290accec61e2b190a58f4d0fd7593911d87597'
+ '48642023e264f90a5831a9a9e91eda2bf33881d7d60f40979ff4e689c485714e'
+ 'f1c3fd91d5e142dc1d800a8228ac66c4bc847a2b87a70b352845a2931b7392e6')
+
+pkgver() {
+ cd "$srcdir/${pkgname}"
+ printf "%s" "$(grep -Po "^version = \'\K[^\']*" build.gradle)"
+}
+
+prepare() {
+ cd "$srcdir/${pkgname}"
+ git am "../${pkgname}.patch"
+ cd "../megamek"
+ git am "../megamek.patch"
+}
+
+build() {
+ cd "$srcdir/${pkgname}"
+ ./gradlew clean assemble unixDistTar --no-daemon
+ cd "build/distributions"
+ tar -xvzf ${pkgname}-${pkgver}.tar.gz
+}
+
+package() {
+ cd "$srcdir"
+ install -D megameklab.desktop "${pkgdir}/usr/share/applications/${pkgname}.desktop"
+ install -Dm755 megameklab.sh "${pkgdir}/usr/bin/${pkgname}"
+
+ cd "${pkgname}/build/distributions/${pkgname}-${pkgver}"
+ install -D "MegaMekLab.jar" "${pkgdir}/usr/share/java/${pkgname}/MegaMekLab.jar"
+ install -Dm755 "lab" "${pkgdir}/usr/share/java/${pkgname}/lab"
+ cp -r "data" "${pkgdir}/usr/share/java/${pkgname}"
+ cp -r "docs" "${pkgdir}/usr/share/java/${pkgname}"
+ cp -r "lib" "${pkgdir}/usr/share/java/${pkgname}"
+ cp -r "logs" "${pkgdir}/usr/share/java/${pkgname}"
+ cp -r "mmconf" "${pkgdir}/usr/share/java/${pkgname}"
+
+ install -Dm666 /dev/null "${pkgdir}/var/log/megameklab/megameklab.log"
+}
+
diff --git a/megamek.patch b/megamek.patch
new file mode 100644
index 00000000000..e2707421b86
--- /dev/null
+++ b/megamek.patch
@@ -0,0 +1,22 @@
+From cb58aa6c53d3c2725858292e2c94e0fbcd8f7727 Mon Sep 17 00:00:00 2001
+From: f43nd1r <lukas.morawietz@gmail.com>
+Date: Fri, 28 Feb 2020 04:42:37 +0100
+Subject: [PATCH] patch
+
+---
+ .../src/megamek/common/MechSummaryCache.java | 24 +++++++++----------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/megamek/src/megamek/common/MechSummaryCache.java b/megamek/src/megamek/common/MechSummaryCache.java
+index 8c71ab0106..0fee072c44 100644
+--- a/megamek/src/megamek/common/MechSummaryCache.java
++++ b/megamek/src/megamek/common/MechSummaryCache.java
+@@ -125,7 +125,7 @@ public class MechSummaryCache {
+ * @return The path to the directory containing the unit cache.
+ */
+ public static File getUnitCacheDir() {
+- return Configuration.unitsDir();
++ return new File(System.getProperty("user.home") + "/.cache/unit_cache");
+ }
+
+ public boolean isInitialized() {
diff --git a/megameklab.desktop b/megameklab.desktop
new file mode 100644
index 00000000000..d7d33c38b03
--- /dev/null
+++ b/megameklab.desktop
@@ -0,0 +1,9 @@
+ [Desktop Entry]
+Name=MegaMekLab
+GenericName=BattleTech Unit Editor
+Exec=megameklab
+Terminal=false
+Type=Application
+Icon=megamek
+Categories=Games;Java;
+StartupWMClass=SWT
diff --git a/megameklab.patch b/megameklab.patch
new file mode 100644
index 00000000000..7f2827b6446
--- /dev/null
+++ b/megameklab.patch
@@ -0,0 +1,92 @@
+From 4b8c23714401e1d807d8c5646f9a0634a57736be Mon Sep 17 00:00:00 2001
+From: f43nd1r <lukas.morawietz@gmail.com>
+Date: Fri, 28 Feb 2020 03:48:19 +0100
+Subject: [PATCH] patch
+
+---
+ build.gradle | 2 +-
+ mmconf/log4j.xml | 2 +-
+ src/megameklab/com/MegaMekLab.java | 4 ++--
+ src/megameklab/com/util/CConfig.java | 11 +++++++----
+ 4 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/build.gradle b/build.gradle
+index 174fa991..fd3ec200 100644
+--- a/build.gradle
++++ b/build.gradle
+@@ -31,7 +31,7 @@ ext {
+ mmlBranchTag = mmlBranch.equals('master')? '' : '-' + mmlBranch
+
+ // Allows setting a dependency on a different MM branch.
+- mmBranch = 'stable'
++ mmBranch = 'master'
+ mmBranchTag = mmBranch.equals('master')? '' : '-' + mmBranch
+
+ mmDir = '../megamek'
+diff --git a/mmconf/log4j.xml b/mmconf/log4j.xml
+index 3e7b221b..3021859c 100644
+--- a/mmconf/log4j.xml
++++ b/mmconf/log4j.xml
+@@ -5,7 +5,7 @@
+
+ <!-- log to a file and roll over if the file size reaches 10 megabytes. -->
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+- <param name="File" value="logs/megameklablog.txt"/>
++ <param name="File" value="/var/log/megameklab/megameklab.log"/>
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="5"/>
+diff --git a/src/megameklab/com/MegaMekLab.java b/src/megameklab/com/MegaMekLab.java
+index 636ed977..01d11e6d 100644
+--- a/src/megameklab/com/MegaMekLab.java
++++ b/src/megameklab/com/MegaMekLab.java
+@@ -45,7 +45,7 @@ public class MegaMekLab {
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ System.setProperty("com.apple.mrj.application.apple.menu.about.name","MegaMekLab");
+
+- String logFileName = "./logs/megameklablog.txt";
++ String logFileName = "/var/log/megameklab/megameklab.log";
+ Locale.setDefault(Locale.US);
+
+ //Taharqa: I am not sure why this is here, so I am commenting it
+@@ -162,7 +162,7 @@ public class MegaMekLab {
+ final String logFileName) {
+ if (logs) {
+ try {
+- File logPath = new File("./logs/");
++ File logPath = new File("/var/log/megameklab/");
+ if (!logPath.exists()) {
+ logPath.mkdir();
+ }
+diff --git a/src/megameklab/com/util/CConfig.java b/src/megameklab/com/util/CConfig.java
+index 283b0a8d..70f9d045 100644
+--- a/src/megameklab/com/util/CConfig.java
++++ b/src/megameklab/com/util/CConfig.java
+@@ -31,9 +31,10 @@ import java.util.Properties;
+ public class CConfig {
+
+ // VARIABLES
+- public static final String CONFIG_DIR = "./mmconf";
+- public static final String CONFIG_FILE = "./mmconf/megameklab.properties";
+- public static final String CONFIG_BACKUP_FILE = "./mmconf/megameklab.properties.bak";
++ public static final String USER_DIR = System.getProperty("user.home");
++ public static final String CONFIG_DIR = USER_DIR + "/.config/megameklab";
++ public static final String CONFIG_FILE = USER_DIR + "/.config/megameklab/megameklab.properties";
++ public static final String CONFIG_BACKUP_FILE = USER_DIR + "/.config/megameklab/megameklab.properties.bak";
+
+ public static final String CONFIG_WEAPONS = "Weapons";
+ public static final String CONFIG_AMMO = "Ammo";
+@@ -84,7 +85,9 @@ public class CConfig {
+ public CConfig() {
+
+ if(!new File(CONFIG_DIR).exists()) {
+- new File(CONFIG_DIR).mkdir();
++ if(!new File(CONFIG_DIR).mkdirs()) {
++ throw new RuntimeException("Failed to create directory "+ CONFIG_DIR);
++ }
+ }
+
+ config = setDefaults();
+--
+2.25.1
+
diff --git a/megameklab.sh b/megameklab.sh
new file mode 100644
index 00000000000..14ab060dc7d
--- /dev/null
+++ b/megameklab.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+cd /usr/share/java/megameklab && exec /usr/share/java/megameklab/lab "$@"