aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Marino <marino@FreeBSD.org>2014-06-20 10:45:11 +0000
committerJohn Marino <marino@FreeBSD.org>2014-06-20 10:45:11 +0000
commit4291c97b9e78d584441c2817e3be6caa3de57f8a (patch)
tree7e76d6b3be2950cd92c35c2faa87b49073f12e5d
parent65d20699b6b419a0153ba8b248a2aed9080f5f82 (diff)
downloadports-4291c97b9e78d584441c2817e3be6caa3de57f8a.tar.gz
ports-4291c97b9e78d584441c2817e3be6caa3de57f8a.zip
Notes
-rw-r--r--games/minecraft-client/Makefile8
-rw-r--r--games/minecraft-client/files/Notifer.java40
-rw-r--r--games/minecraft-client/files/minecraft-client88
-rw-r--r--games/minecraft-client/files/minecraft-runtime46
-rw-r--r--games/minecraft-client/pkg-plist2
5 files changed, 136 insertions, 48 deletions
diff --git a/games/minecraft-client/Makefile b/games/minecraft-client/Makefile
index 510b2a52cc4b..b5c2a5bda77f 100644
--- a/games/minecraft-client/Makefile
+++ b/games/minecraft-client/Makefile
@@ -3,6 +3,7 @@
PORTNAME= minecraft-client
PORTVERSION= 1.7.9
+PORTREVISION= 1
CATEGORIES= games java
MASTER_SITES= http://s3.amazonaws.com/Minecraft.Download/launcher/:minecraft \
http://media-mcw.cursecdn.com/c/c5/:icon
@@ -14,12 +15,15 @@ EXTRACT_ONLY=
MAINTAINER= ports@FreeBSD.org
COMMENT= Client for the block building game
+RUN_DEPENDS= ${JAVALIBDIR}/lwjgl/lwjgl.jar:${PORTSDIR}/games/lwjgl \
+ bash:${PORTSDIR}/shells/bash
+
WRKSRC= ${WRKDIR}
NO_BUILD= yes
USE_JAVA= yes
JAVA_OS= native
JAVA_VENDOR= openjdk
-JAVA_VERSION= 1.7+
+JAVA_VERSION= 1.8+
DESKTOP_ENTRIES="Minecraft" \
"Block building game" \
"${PREFIX}/share/pixmaps/minecraft-client.png" \
@@ -38,5 +42,7 @@ do-install:
-e 's|JAVA_CMD|${JAVA}|' ${FILESDIR}/minecraft-client \
> ${WRKDIR}/minecraft-client
${INSTALL_SCRIPT} ${WRKDIR}/minecraft-client ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_SCRIPT} ${FILESDIR}/minecraft-runtime ${STAGEDIR}${DATADIR}
+ ${INSTALL_DATA} ${FILESDIR}/Notifer.java ${STAGEDIR}${DATADIR}
.include <bsd.port.mk>
diff --git a/games/minecraft-client/files/Notifer.java b/games/minecraft-client/files/Notifer.java
new file mode 100644
index 000000000000..b31d7fd291d4
--- /dev/null
+++ b/games/minecraft-client/files/Notifer.java
@@ -0,0 +1,40 @@
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+import javax.swing.Icon;
+import java.awt.EventQueue;
+
+public class Notifer extends JFrame{
+
+ //Using a standard Java icon
+ private Icon optionIcon = UIManager.getIcon("FileView.computerIcon");
+
+ public static void main(String[] args) {
+
+ EventQueue.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ //create GUI frame
+ new Notifer().setVisible(true);
+ }
+ });
+
+ }
+
+ public Notifer()
+ {
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ //setTitle("Simple Dialog Box Example");
+ //setSize(500,500);
+
+ setLocationRelativeTo(null);
+
+ // Show our warning to first time users
+ JOptionPane.showMessageDialog(this, "After the first time logging in with a new user, you will need to close the Minecraft Launcher and restart before the game will run."
+ ,"Important Notification", JOptionPane.PLAIN_MESSAGE);
+
+ System.exit(0);
+
+ }
+}
diff --git a/games/minecraft-client/files/minecraft-client b/games/minecraft-client/files/minecraft-client
index a21cadaace2e..c585fbaae186 100644
--- a/games/minecraft-client/files/minecraft-client
+++ b/games/minecraft-client/files/minecraft-client
@@ -1,50 +1,44 @@
#!/bin/sh
export JAVA_HOME=JAVA_HOME
-/bin/cat << EOF
-When starting a version for the first time, select the version you want in your
-profile, start Minecraft, close Minecraft and launcher, run minecraft-client
-again, then select version "x-freebsd" in your profile.
-If you run versions older than 1.6.1 in the Launcher, add
--Djava.net.preferIPv4Stack=true to JVM Arguments in the profile.
-
-EOF
-LIBDIR="${HOME}/.minecraft/libraries/"
-
-for i in ${LIBDIR}/org/lwjgl/lwjgl/lwjgl-platform/*/lwjgl-platform-*-natives-linux.jar; do
- if [ -f "${i}" ]; then
- cmp -s "PREFIX/share/minecraft-client/lwjgl-native-libs.jar" "${i%linux.jar}freebsd.jar"
- if [ $? -ne 0 ]; then
- cp -v "PREFIX/share/minecraft-client/lwjgl-native-libs.jar" "${i%linux.jar}freebsd.jar"
- fi
- fi
-done
-
-versions_base="${HOME}/.minecraft/versions"
-
-for i in ${HOME}/.minecraft/versions/*; do
- if [ "${i}" != "${i%-freebsd}" -o "${i}" == "${HOME}"'/.minecraft/versions/*' ]; then continue; fi
- OLDIFS=$IFS
- IFS=/
- for x in ${i}; do
- version="${x}"
- done
- IFS=${OLDIFS}
-
- native_path="${versions_base}/${version}-freebsd/"
- mkdir -p "${native_path}"
-
- vendor_file="${versions_base}/${version}/${version}"
- native_file="${native_path}/${version}-freebsd"
-
- if [ -f "${vendor_file}.jar" -a ! -f "${native_file}.jar" ]; then
- cp -v "${vendor_file}.jar" "${native_file}.jar"
- fi
- if [ -f "${vendor_file}.json" -a ! -f "${native_file}.json" ]; then
- sed -e '/"id"/s/",/-freebsd",/' -e '/lwjgl/,/extract/s/natives-linux/natives-freebsd/' \
- < "${vendor_file}.json" > "${native_file}.json"
- fi
-done
-
-exec JAVA_CMD -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider \
- -Dos.name=Linux -jar PREFIX/share/minecraft-client/Minecraft.jar
+# Look for launcher_profiles to fix
+if [ -e "${HOME}/.minecraft/launcher_profiles.json" ] ; then
+ rm ${HOME}/.minecraft/launcher_profiles.json.new 2>/dev/null
+
+ # Lets make sure we set the fixed java executable script
+ while IFS='' read -r line
+ do
+ # Skip old javaDir lines
+ echo $line | grep -q '"javaDir": "'
+ if [ $? -eq 0 ] ; then continue ; fi
+
+ # If not a name line, add and continue
+ echo $line | grep -q '"name": "'
+ if [ $? -ne 0 ] ; then
+ printf "%s\n" "$line" >> ${HOME}/.minecraft/launcher_profiles.json.new
+ continue
+ fi
+
+ # Found a profile entry, lets add the correct runtime
+ printf "%s\n" "$line" >> ${HOME}/.minecraft/launcher_profiles.json.new
+ echo ' "javaDir": "/usr/local/share/minecraft-client/minecraft-runtime",' >> ${HOME}/.minecraft/launcher_profiles.json.new
+
+ done < ${HOME}/.minecraft/launcher_profiles.json
+
+ # See if we have dangling }
+ tail -1 ${HOME}/.minecraft/launcher_profiles.json.new | grep -q "^}"
+ if [ $? -ne 0 ] ; then
+ printf "}" >> ${HOME}/.minecraft/launcher_profiles.json.new
+ fi
+
+ mv ${HOME}/.minecraft/launcher_profiles.json.new ${HOME}/.minecraft/launcher_profiles.json
+else
+ # No .minecraft dir, lets display the first time notification
+ javac -d /tmp /usr/local/share/minecraft-client/Notifer.java
+ cd /tmp
+ java Notifer
+ rm Notifer*.class
+fi
+
+exec ${JAVA_HOME}/bin/java -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider \
+ -Dos.name=Linux -jar /usr/local/share/minecraft-client/Minecraft.jar
diff --git a/games/minecraft-client/files/minecraft-runtime b/games/minecraft-client/files/minecraft-runtime
new file mode 100644
index 000000000000..2ab6b4866e8b
--- /dev/null
+++ b/games/minecraft-client/files/minecraft-runtime
@@ -0,0 +1,46 @@
+#!/usr/local/bin/bash
+
+LWJGL_JLP_OVRD="/usr/local/lib/lwjgl2.9.1"
+LWJGL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl.jar"
+LWJGL_UTIL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl_util.jar"
+
+export JAVA_HOME=/usr/local/openjdk8
+
+build_classpath() {
+ j=0
+ ocp=`echo ${1} | sed 's/:/ /g'`
+ for p in ${ocp}
+ do
+ if [[ $p == *lwjgl-* ]]
+ then
+ ncp[$j]=${LWJGL_OVRD}
+ elif [[ $p == *lwjgl_util* ]]
+ then
+ ncp[$j]=${LWJGL_UTIL_OVRD}
+ else
+ ncp[$j]=${p}
+ fi
+ j=$(( j + 1 ))
+ done
+
+ cp=`echo ${ncp[@]} | sed 's/ /:/g'`
+}
+
+
+i=0
+for var in "${@}"
+do
+ if [[ "$var" == -Djava.library* ]]
+ then
+ args[$i]="-Djava.library.path=${LWJGL_JLP_OVRD}"
+ elif [[ "$var" == *lwjgl_util* ]]
+ then
+ build_classpath "${var}"
+ args[$i]="$cp"
+ else
+ args[$i]=$var
+ fi
+ i=$(( i + 1 ))
+done
+
+${JAVA_HOME}/jre/bin/java ${args[@]}
diff --git a/games/minecraft-client/pkg-plist b/games/minecraft-client/pkg-plist
index 20d13f796a06..f60eb4264a6a 100644
--- a/games/minecraft-client/pkg-plist
+++ b/games/minecraft-client/pkg-plist
@@ -1,4 +1,6 @@
bin/minecraft-client
%%DATADIR%%/Minecraft.jar
+%%DATADIR%%/minecraft-runtime
+%%DATADIR%%/Notifer.java
share/pixmaps/minecraft-client.png
@dirrm %%DATADIR%%