View | Details | Raw Unified | Return to bug 189028 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-1 / +7 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	minecraft-client
4
PORTNAME=	minecraft-client
5
PORTVERSION=	1.7.9
5
PORTVERSION=	1.7.9
6
PORTREVISION=	2
6
CATEGORIES=	games java
7
CATEGORIES=	games java
7
MASTER_SITES=	http://s3.amazonaws.com/Minecraft.Download/launcher/:minecraft \
8
MASTER_SITES=	http://s3.amazonaws.com/Minecraft.Download/launcher/:minecraft \
8
		http://media-mcw.cursecdn.com/c/c5/:icon
9
		http://media-mcw.cursecdn.com/c/c5/:icon
Lines 14-25 Link Here
14
MAINTAINER=	ports@FreeBSD.org
15
MAINTAINER=	ports@FreeBSD.org
15
COMMENT=	Client for the block building game
16
COMMENT=	Client for the block building game
16
17
18
RUN_DEPENDS=	${JAVALIBDIR}/lwjgl/lwjgl.jar:${PORTSDIR}/games/lwjgl \
19
		bash:${PORTSDIR}/shells/bash
20
17
WRKSRC=		${WRKDIR}
21
WRKSRC=		${WRKDIR}
18
NO_BUILD=	yes
22
NO_BUILD=	yes
19
USE_JAVA=	yes
23
USE_JAVA=	yes
20
JAVA_OS=	native
24
JAVA_OS=	native
21
JAVA_VENDOR=	openjdk
25
JAVA_VENDOR=	openjdk
22
JAVA_VERSION=	1.7+
26
JAVA_VERSION=	1.8+
23
DESKTOP_ENTRIES="Minecraft" \
27
DESKTOP_ENTRIES="Minecraft" \
24
		"Block building game" \
28
		"Block building game" \
25
		"${PREFIX}/share/pixmaps/minecraft-client.png" \
29
		"${PREFIX}/share/pixmaps/minecraft-client.png" \
Lines 38-42 Link Here
38
		-e 's|JAVA_CMD|${JAVA}|' ${FILESDIR}/minecraft-client \
42
		-e 's|JAVA_CMD|${JAVA}|' ${FILESDIR}/minecraft-client \
39
		> ${WRKDIR}/minecraft-client
43
		> ${WRKDIR}/minecraft-client
40
	${INSTALL_SCRIPT} ${WRKDIR}/minecraft-client ${STAGEDIR}${PREFIX}/bin
44
	${INSTALL_SCRIPT} ${WRKDIR}/minecraft-client ${STAGEDIR}${PREFIX}/bin
45
	${INSTALL_SCRIPT} ${FILESDIR}/minecraft-runtime ${STAGEDIR}${DATADIR}
46
	${INSTALL_DATA} ${FILESDIR}/Notifer.java ${STAGEDIR}${DATADIR}
41
47
42
.include <bsd.port.mk>
48
.include <bsd.port.mk>
(-)files/minecraft-client (-41 / +35 lines)
Lines 1-50 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
export JAVA_HOME=JAVA_HOME
2
export JAVA_HOME=JAVA_HOME
3
/bin/cat << EOF
4
When starting a version for the first time, select the version you want in your
5
profile, start Minecraft, close Minecraft and launcher, run minecraft-client
6
again, then select version "x-freebsd" in your profile.
7
3
8
If you run versions older than 1.6.1 in the Launcher, add
4
# Look for launcher_profiles to fix
9
-Djava.net.preferIPv4Stack=true to JVM Arguments in the profile.
5
if [ -e "${HOME}/.minecraft/launcher_profiles.json" ] ; then
6
   rm ${HOME}/.minecraft/launcher_profiles.json.new 2>/dev/null
10
7
11
EOF
8
   # Lets make sure we set the fixed java executable script
12
LIBDIR="${HOME}/.minecraft/libraries/"
9
   while IFS='' read -r line
10
   do
11
     # Skip old javaDir lines
12
     echo $line | grep -q '"javaDir": "'
13
     if [ $? -eq 0 ] ; then continue ; fi
13
14
14
for i in ${LIBDIR}/org/lwjgl/lwjgl/lwjgl-platform/*/lwjgl-platform-*-natives-linux.jar; do
15
     # If not a name line, add and continue
15
  if [ -f "${i}" ]; then
16
     echo $line | grep -q '"name": "'
16
    cmp -s "PREFIX/share/minecraft-client/lwjgl-native-libs.jar" "${i%linux.jar}freebsd.jar"
17
     if [ $? -ne 0 ] ; then 
17
    if [ $? -ne 0 ]; then
18
       printf "%s\n" "$line" >> ${HOME}/.minecraft/launcher_profiles.json.new
18
      cp -v "PREFIX/share/minecraft-client/lwjgl-native-libs.jar" "${i%linux.jar}freebsd.jar"
19
       continue
19
    fi
20
     fi
20
  fi
21
done
22
21
23
versions_base="${HOME}/.minecraft/versions"
22
     # Found a profile entry, lets add the correct runtime
23
     printf "%s\n" "$line" >> ${HOME}/.minecraft/launcher_profiles.json.new
24
     echo '      "javaDir": "/usr/local/share/minecraft-client/minecraft-runtime",' >> ${HOME}/.minecraft/launcher_profiles.json.new
25
     
26
   done < ${HOME}/.minecraft/launcher_profiles.json
24
27
25
for i in ${HOME}/.minecraft/versions/*; do
28
   # See if we have dangling }
26
  if [ "${i}" != "${i%-freebsd}" -o "${i}" == "${HOME}"'/.minecraft/versions/*' ]; then continue; fi
29
   tail -1 ${HOME}/.minecraft/launcher_profiles.json.new | grep -q "^}"
27
  OLDIFS=$IFS
30
   if [ $? -ne 0 ] ; then
28
  IFS=/
31
     printf "}" >> ${HOME}/.minecraft/launcher_profiles.json.new
29
  for x in ${i}; do
32
   fi
30
    version="${x}"
31
  done
32
  IFS=${OLDIFS}
33
33
34
  native_path="${versions_base}/${version}-freebsd/"
34
   mv ${HOME}/.minecraft/launcher_profiles.json.new ${HOME}/.minecraft/launcher_profiles.json
35
  mkdir -p "${native_path}"
35
else
36
   # No .minecraft dir, lets display the first time notification
37
   javac -d /tmp /usr/local/share/minecraft-client/Notifer.java
38
   cd /tmp
39
   java Notifer
40
   rm Notifer*.class
41
fi
36
42
37
  vendor_file="${versions_base}/${version}/${version}"
43
exec ${JAVA_HOME}/bin/java -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider \
38
  native_file="${native_path}/${version}-freebsd"
44
 -Dos.name=Linux -jar /usr/local/share/minecraft-client/Minecraft.jar
39
40
  if [ -f "${vendor_file}.jar" -a ! -f "${native_file}.jar" ]; then
41
    cp -v "${vendor_file}.jar" "${native_file}.jar"
42
  fi
43
  if [  -f "${vendor_file}.json" -a ! -f "${native_file}.json" ]; then
44
    sed -e '/"id"/s/",/-freebsd",/' -e '/lwjgl/,/extract/s/natives-linux/natives-freebsd/' \
45
    < "${vendor_file}.json" > "${native_file}.json"
46
  fi
47
done
48
49
exec JAVA_CMD -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider \
50
 -Dos.name=Linux -jar PREFIX/share/minecraft-client/Minecraft.jar
(-)files/Notifer.java (+40 lines)
Line 0 Link Here
1
import javax.swing.JFrame;
2
import javax.swing.JOptionPane;
3
import javax.swing.UIManager;
4
import javax.swing.Icon;
5
import java.awt.EventQueue;
6
7
public class Notifer extends JFrame{
8
    
9
    //Using a standard Java icon
10
    private Icon optionIcon = UIManager.getIcon("FileView.computerIcon");
11
    
12
    public static void main(String[] args) {
13
     
14
     EventQueue.invokeLater(new Runnable()
15
     {
16
         public void run()
17
         {
18
             //create GUI frame
19
             new Notifer().setVisible(true);          
20
         }
21
     });
22
              
23
    }
24
    
25
    public Notifer()
26
    {
27
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
28
        //setTitle("Simple Dialog Box Example");
29
        //setSize(500,500);
30
        
31
        setLocationRelativeTo(null); 
32
        
33
        // Show our warning to first time users
34
        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." 
35
                ,"Important Notification", JOptionPane.PLAIN_MESSAGE);
36
37
	System.exit(0);
38
        
39
    }
40
}
(-)files/minecraft-runtime (+46 lines)
Line 0 Link Here
1
#!/usr/local/bin/bash
2
3
LWJGL_JLP_OVRD="/usr/local/lib/lwjgl2.9.1"
4
LWJGL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl.jar"
5
LWJGL_UTIL_OVRD="/usr/local/share/java/classes/lwjgl/lwjgl_util.jar"
6
7
export JAVA_HOME=/usr/local/openjdk8
8
9
build_classpath() {
10
    j=0
11
    ocp=`echo ${1} | sed 's/:/ /g'`
12
    for p in ${ocp}
13
    do
14
        if [[ $p == *lwjgl-* ]]
15
        then
16
            ncp[$j]=${LWJGL_OVRD}
17
        elif [[ $p == *lwjgl_util* ]]
18
        then
19
            ncp[$j]=${LWJGL_UTIL_OVRD}
20
        else
21
            ncp[$j]=${p}
22
        fi
23
        j=$(( j + 1 ))
24
    done
25
26
    cp=`echo ${ncp[@]} | sed 's/ /:/g'`
27
}
28
29
30
i=0
31
for var in "${@}"
32
do
33
    if [[ "$var" == -Djava.library* ]]
34
    then
35
        args[$i]="-Djava.library.path=${LWJGL_JLP_OVRD}"
36
    elif [[ "$var" == *lwjgl_util* ]]
37
    then
38
        build_classpath "${var}"
39
        args[$i]="$cp"
40
    else
41
        args[$i]=$var
42
    fi
43
        i=$(( i + 1 ))
44
done
45
46
${JAVA_HOME}/jre/bin/java ${args[@]}
(-)pkg-plist (+2 lines)
Lines 1-4 Link Here
1
bin/minecraft-client
1
bin/minecraft-client
2
%%DATADIR%%/Minecraft.jar
2
%%DATADIR%%/Minecraft.jar
3
%%DATADIR%%/minecraft-runtime
4
%%DATADIR%%/Notifer.java
3
share/pixmaps/minecraft-client.png
5
share/pixmaps/minecraft-client.png
4
@dirrm %%DATADIR%%
6
@dirrm %%DATADIR%%

Return to bug 189028