Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@××××××××××××××.uk>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java:master commit in: games-action/minecraft/, games-action/minecraft/files/
Date: Sun, 01 Sep 2013 16:08:41
Message-Id: 1378051439.949d9fdad8b9bd3f624c578e9450b87d38ae23e5.chewi@gentoo
1 commit: 949d9fdad8b9bd3f624c578e9450b87d38ae23e5
2 Author: James Le Cuirot <chewi <AT> aura-online <DOT> co <DOT> uk>
3 AuthorDate: Sun Sep 1 16:03:59 2013 +0000
4 Commit: James Le Cuirot <chewi <AT> aura-online <DOT> co <DOT> uk>
5 CommitDate: Sun Sep 1 16:03:59 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/java.git;a=commit;h=949d9fda
7
8 Version bump. Major changes! New versioning scheme now that upstream has started properly versioning the launcher. Many new dependencies. Old method for forcing use of Gentoo's packages no longer works. New Python script written, which can be executed by the launcher to modify the game's classpath and library path on launch.
9
10 Package-Manager: portage-2.1.13.7
11 Manifest-Sign-Key: 058FE989
12
13 ---
14 games-action/minecraft/ChangeLog | 13 ++-
15 games-action/minecraft/Manifest | 22 +++-
16 games-action/minecraft/files/minecraft-gentoo | 113 +++++++++++++++++++++
17 games-action/minecraft/files/native-symlinks.sh | 23 -----
18 games-action/minecraft/minecraft-1.2.1.ebuild | 100 ++++++++++++++++++
19 .../minecraft/minecraft-20120805-r1.ebuild | 81 ---------------
20 6 files changed, 243 insertions(+), 109 deletions(-)
21
22 diff --git a/games-action/minecraft/ChangeLog b/games-action/minecraft/ChangeLog
23 index b49e5c2..3afedde 100644
24 --- a/games-action/minecraft/ChangeLog
25 +++ b/games-action/minecraft/ChangeLog
26 @@ -1,7 +1,18 @@
27 # ChangeLog for games-action/minecraft
28 -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
29 +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
30 # $Header: $
31
32 +*minecraft-1.2.1 (01 Sep 2013)
33 +
34 + 01 Sep 2013; James Le Cuirot <chewi@××××××××××××××.uk>
35 + +files/minecraft-gentoo, +minecraft-1.2.1.ebuild, -files/native-symlinks.sh,
36 + -minecraft-20120805-r1.ebuild:
37 + Version bump. Major changes! New versioning scheme now that upstream has
38 + started properly versioning the launcher. Many new dependencies. Old method
39 + for forcing use of Gentoo's packages no longer works. New Python script
40 + written, which can be executed by the launcher to modify the game's classpath
41 + and library path on launch.
42 +
43 *minecraft-20120805-r1 (2 Dec 2012)
44
45 2 Dec 2012; James Le Cuirot <chewi@××××××××××××××.uk>
46
47 diff --git a/games-action/minecraft/Manifest b/games-action/minecraft/Manifest
48 index 0b47ab0..01b3916 100644
49 --- a/games-action/minecraft/Manifest
50 +++ b/games-action/minecraft/Manifest
51 @@ -1,6 +1,20 @@
52 +-----BEGIN PGP SIGNED MESSAGE-----
53 +Hash: SHA256
54 +
55 +AUX minecraft-gentoo 4239 SHA256 736aa5758c18d9bfb7354c5a7ec432b3dfd92a23b94f661c58d2fa60863b8eff SHA512 592d88c31d024e76cb5606f7ecb3bd616d44f5eb045cd4f31ec698ade0e12008a96f43d33bb5235301cd0524e942f8789948ba031266065ec5505cedbb4f413b WHIRLPOOL 1175f3d0608166ddbbe4024c17f8e813b4d558e27d9dfe6244c74b15c56878652e18cb50fa71937ba1e1881da8536d10c97293c2026b6afa5f33eda51fcbfbaf
56 AUX minecraft.png 20345 SHA256 5ee86aeb4185637ea901f80e698e64d07dd138448fc4ff00d96d5992792a806b SHA512 ce91da9e858dd4ab63cd5643304d59ad7169788638cd8a59edce14f62cf1723896e9e8280cc0645930f2b1ba2e1202b4755280c2d546abba263a83d32e3770e0 WHIRLPOOL b33a8599e7ebffdb7a92d4edb59a20492658c34f76a301b723dcdaba16e120c3c04800b174be3f652687cb349742e5cacbff3cbe30672e8da1dc5a10b23534d3
57 -AUX native-symlinks.sh 881 SHA256 f2e342dc8b9bdb10b75a51c6c415780ad301f7cf441a6d9d5971e014970418e7 SHA512 0b102fad15806e56e3f29248578135fc44b7e485781d29f93d0a7a2f7fadd0e7e0f1f14b252d12c13b34a1ed9c4b448778b394d9173c54318462a54acf3cb22d WHIRLPOOL c37286c0d400bb316370adacba6ebd3dbf76968f850907e964f0576c11d63c96162c41e719970a4ded9ef3bae31d4454ab8864634bfb96cdc72c76fa0efc8d5e
58 -DIST minecraft-20120805.jar 81938 SHA256 92db974aa759a3f17f3cd61550fa5010e335c57dd813dad9e39b9cc013420a49 SHA512 0b377036bd4b0049a8718016e82ddbcc3e35aebedb5cb8fb5b8f797960b6d46eff918046efdde0aa56374034c12410ec00b77b8ef81d3c5f342dc92fd58c187d WHIRLPOOL e6e7e78e21217681a74d718fe1917b75a4fcbd6c8279c29a3b4f475f5ce85ccf767d79bf8a709fcc07699bd9f547ec94ae2dbda92f4b61fa5613cca8403b60bc
59 -EBUILD minecraft-20120805-r1.ebuild 2447 SHA256 61464972f14c4d1e6bf3bcd6cdf486f271d6300540ba942e7cd7c8a565ef9c30 SHA512 5732cbce2ba94b2728fc4213634b61da61795d0ad88f8ec400b8ce33253897d67c9ef0bcc2376339e1d34c8e99558cf09a0dd2800c4c64ac073aa4342a3df357 WHIRLPOOL 8e896c60d2ba9365fe10a9377991cc0f3d3027a10125d7cea097effb7c637894964ca7c1fad634bb80849619366aaa42954071936dd2534273d7462386e51644
60 -MISC ChangeLog 4697 SHA256 f3846527d1e585c01325657dcd4f6a2ba50d25ca3f14a8aab949e8cfcc44552a SHA512 4da35301323107d8978633caa8a1ea3d91e8df5fe468dc58dbe6c1aa989e9d1ea9975811ff1200f25d485f6a3fab46ed4120e1fa5654f4dcc9074670a57841f4 WHIRLPOOL 980c8ac844e61593d8f30df2e20e8d57fb78d4a95766e7bca515233eeb399bde8ba61b3025eb3f0d72c3df87b1ba40ac8882c049ff769aff28b5b25d1f9877f7
61 +DIST minecraft-1.2.1.jar 280212 SHA256 e8d90b2637b141b556670d8460d317aadb6e4f2e644e519995c428800b25f212 SHA512 64201f5d9522c43bded397e39b29eedeed5af224a064e13eede6f5d276d7b61702c5daae998c1fff8b34c6660f8f56a40bf0f43f4024119023c77672d6319659 WHIRLPOOL 3ecf370c4c99b6ae7b33efba5ca831c360b8c72ece5f059bbeb7c5e8e7686d6562338904522e907b5b1acaca17fe99b97e985ea770f8f4f20d6040d817e4f312
62 +EBUILD minecraft-1.2.1.ebuild 2749 SHA256 7a8bc977d3c586d8cf61552afdb16c322d13ced59abfcbe91346031b05bbd6ae SHA512 5f0491a58f0bd0dce5f2f29da5aacceb8561d49ed8f47489d436e504b49cf34f5f7fede49467157fc60b02de36d0eccf771858a520d2fcf95d9e79bb0afae059 WHIRLPOOL 77ae7bf6dddab7af7cf8ca93a7538bd85f128979d1a2bdb7d6d63768498f9bf621517c4fa3efdf17e6b0490003d4b546d4b738ab564f6feedd6895070add3040
63 +MISC ChangeLog 5236 SHA256 81dbeec3ff9bc343402e6b9497e93ae72f56963e4d2ac98897630bf8070ed08d SHA512 c029e50d3c34892e3a8ed76ccaec697b826c76eb69e6ccc0332a1501673fd1d449d72ba477217dd2f32bd35bade8f20232f31c289e791eed503d808d563710b2 WHIRLPOOL 33c77f7ffa5e89ee495ca5adae84ea6f6be94abdae70b534ef7fea53540991969a27ab426f9183f4c294137bba7ec42259f7e1d49f519171dd77c5f77446ae29
64 MISC metadata.xml 525 SHA256 e9e868a41f0ca909166b4977b6188316196ef4016f0035f2ec18b3a2696ec918 SHA512 7e854e616459ccb206389144b5caf7f613632ee27fa718664e649c956d71a5652eff6aa88f1d85a5c16c76e83349b4ebeacacddb44c37320196252b869ff7d62 WHIRLPOOL 3a00529b7b3dad61a7158e86a4de5e154420772eeedf55c0fccc39da6b1b35317e75a2b0d0856d907896e60dfd134f200d8cff2d896c45701a1852cf29d2cc88
65 +-----BEGIN PGP SIGNATURE-----
66 +Version: GnuPG v2.0.20 (GNU/Linux)
67 +
68 +iQEcBAEBCAAGBQJSI2VvAAoJEGcL3XYFj+mJo9wH/i29TQPJj5L697k63I1wzZc9
69 +8IXHBfAMxQeaNyLeRrUGmL7gGAfoyZadIOTYnc01yG6Kz+L0m59kyV8s/v28nSIk
70 +J7zd33j54gYeibPykTmBwoaOM4yKcqxWHOeKaTTkBVW0GolRkNZzokXx+KgKpSHy
71 +cx9BVoPUQQpeNayyA3+mXjL7apgfvyKBIrm6estLjyoxMaxdepmosju6MJSYNRBE
72 +jWxBObK+KoHCJER7mkIdPT7tWZ6cIDL1hWINaCjTziftw0ihKCloPesfQ+yaZsT6
73 +AV5USvouzsoNtjBGQBRPwVgKOtq3eFdo5kyOOE++jR6jbGF6HX1UJ+SXhQAHbs0=
74 +=uTMZ
75 +-----END PGP SIGNATURE-----
76
77 diff --git a/games-action/minecraft/files/minecraft-gentoo b/games-action/minecraft/files/minecraft-gentoo
78 new file mode 100755
79 index 0000000..fb99e28
80 --- /dev/null
81 +++ b/games-action/minecraft/files/minecraft-gentoo
82 @@ -0,0 +1,113 @@
83 +#!/usr/bin/env python
84 +
85 +# Copyright 1999-2013 Gentoo Foundation
86 +# Distributed under the terms of the GNU General Public License v2
87 +# $Header: $
88 +
89 +import argparse, os, re, sys
90 +from java_config_2.EnvironmentManager import EnvironmentManager
91 +from java_config_2.Errors import UnexistingPackageError
92 +from itertools import chain
93 +
94 +try:
95 + from itertools import ifilter # Python 2
96 +except ImportError:
97 + ifilter = filter # Python 3
98 +
99 +klass = "net.minecraft.client.main.Main"
100 +description = "Launch Minecraft using Gentoo's packaged libraries."
101 +usage = sys.argv[0] + " [java options] " + klass + " [minecraft options]"
102 +
103 +try:
104 + split = sys.argv.index(klass)
105 +except ValueError:
106 + split = None
107 +
108 +parser = argparse.ArgumentParser(description=description, usage=usage)
109 +group = parser.add_argument_group("Java options")
110 +group.add_argument("-classpath", "-cp", dest="-classpath", required=True)
111 +group.add_argument("-Djava.library.path", dest="origNativeDir", required=True)
112 +java_args = parser.parse_known_args(sys.argv[1:split])
113 +
114 +parser = argparse.ArgumentParser(description=description, usage=usage)
115 +group = parser.add_argument_group("Minecraft options")
116 +group.add_argument("--gameDir", dest="--gameDir", required=True)
117 +group.add_argument("--version", dest="--version", required=True)
118 +minecraft_args = parser.parse_known_args(sys.argv[split+1:] if split else [])
119 +
120 +def get_jar(pkg_name, jar):
121 + global nativeDirs
122 +
123 + try:
124 + pkg = manager.get_package(pkg_name)
125 + except UnexistingPackageError:
126 + return None
127 +
128 + jars = pkg.classpath().split(":")
129 + jar = next(ifilter(lambda x: x.endswith("/" + jar), jars), None)
130 +
131 + if jar:
132 + dirs = pkg.query("LIBRARY_PATH")
133 + if dirs: nativeDirs |= set(dirs.split(":"))
134 +
135 + return jar
136 +
137 +def transform(path):
138 + if path.startswith(libDir):
139 + tail = path[len(libDir):]
140 +
141 + match = re.match("org/bouncycastle/bcprov-jdk15on/([^/]+)/", tail)
142 + if match: return get_jar("bcprov", "bcprov.jar") or path
143 +
144 + match = re.match("commons-io/commons-io/([^/]+)/", tail)
145 + if match: return get_jar("commons-io-1", "commons-io.jar") or path
146 +
147 + match = re.match("org/apache/commons/commons-lang3/([^/]+)/", tail)
148 + if match: return get_jar("commons-lang-3.1", "commons-lang.jar") or path
149 +
150 + match = re.match("com/google/code/gson/gson/([^/]+)/", tail)
151 + if match: return get_jar("gson-2.2.2", "gson.jar") or path
152 +
153 + match = re.match("com/google/guava/guava/([^/]+)/", tail)
154 + if match: return get_jar("guava-14", "guava.jar") or path
155 +
156 + match = re.match("net/java/jinput/jinput/([^/]+)/", tail)
157 + if match: return get_jar("jinput", "jinput.jar") or path
158 +
159 + match = re.match("net/sf/jopt-simple/jopt-simple/([^/]+)/", tail)
160 + if match: return get_jar("jopt-simple", "jopt-simple.jar") or path
161 +
162 + match = re.match("net/java/jutils/jutils/([^/]+)/", tail)
163 + if match: return get_jar("jutils", "jutils.jar") or path
164 +
165 + match = re.match("org/lwjgl/lwjgl/lwjgl(|_util)/([^/]+)/", tail)
166 + if match: return get_jar("lwjgl-2.9", "lwjgl" + match.group(1) + ".jar") or path
167 +
168 + match = re.match("com/paulscode/(codecwav|librarylwjglopenal|libraryjavasound|soundsystem)/([^/]+)/", tail)
169 + if match: return get_jar("paulscode-" + match.group(1), "paulscode-" + match.group(1) + ".jar") or path
170 +
171 + match = re.match("com/paulscode/codecjorbis/([^/]+)/", tail)
172 + if match: return (get_jar("paulscode-codecjorbis", "paulscode-codecjorbis.jar") or path) + ":" + (get_jar("jorbis", "jorbis.jar") or path)
173 +
174 + return path
175 +
176 +nativeDirs = set()
177 +libDir = getattr(minecraft_args[0], "--gameDir") + "/libraries/"
178 +manager = EnvironmentManager(os.getenv("ROOT", ""), os.getenv("EPREFIX", "@GENTOO_PORTAGE_EPREFIX@"))
179 +
180 +origNativeDir = getattr(java_args[0], "origNativeDir")
181 +delattr(java_args[0], "origNativeDir")
182 +
183 +classpath = getattr(java_args[0], "-classpath").split(":")
184 +setattr(java_args[0], "-classpath", ":".join(map(transform, classpath)))
185 +
186 +args = [ "java" ]
187 +args.append("-Djava.library.path=" + ":".join(nativeDirs) + ":" + origNativeDir)
188 +args.extend(list(chain.from_iterable(vars(java_args[0]).items())))
189 +args.extend(java_args[1])
190 +args.append(klass)
191 +args.extend(list(chain.from_iterable(vars(minecraft_args[0]).items())))
192 +args.extend(minecraft_args[1])
193 +
194 +sys.stderr.write(" ".join(args) + "\n")
195 +os.execlp("java", *args)
196
197 diff --git a/games-action/minecraft/files/native-symlinks.sh b/games-action/minecraft/files/native-symlinks.sh
198 deleted file mode 100644
199 index 770d212..0000000
200 --- a/games-action/minecraft/files/native-symlinks.sh
201 +++ /dev/null
202 @@ -1,23 +0,0 @@
203 -
204 -# We have patched Minecraft to not download or install its JAR
205 -# libraries but doing the same for the native libraries doesn't seem
206 -# so easy. Instead we create symlinks and make the natives directory
207 -# read-only, which seems to fool it sufficiently.
208 -
209 -NATIVES="${HOME}/.minecraft/bin/natives"
210 -mkdir -p "${NATIVES}"
211 -chmod +w "${NATIVES}"
212 -
213 -ln -snf /usr/lib/libopenal.so "${NATIVES}"/libopenal.so
214 -ln -snf $(ls -U /usr/lib/jinput/libjinput-linux{64,}.so 2> /dev/null | head -n1) "${NATIVES}"/libjinput-linux.so
215 -ln -snf $(ls -U /usr/lib/lwjgl-2.8/liblwjgl{64,}.so 2> /dev/null | head -n1) "${NATIVES}"/liblwjgl.so
216 -
217 -ln -snf libopenal.so "${NATIVES}"/libopenal64.so
218 -ln -snf libjinput-linux.so "${NATIVES}"/libjinput-linux64.so
219 -ln -snf liblwjgl.so "${NATIVES}"/liblwjgl64.so
220 -
221 -chmod a-w "${NATIVES}"
222 -
223 -# Create a dummy lwjgl.jar to fool MCPatcher.
224 -touch "${HOME}/.minecraft/bin/lwjgl.jar"
225 -
226
227 diff --git a/games-action/minecraft/minecraft-1.2.1.ebuild b/games-action/minecraft/minecraft-1.2.1.ebuild
228 new file mode 100644
229 index 0000000..68674fb
230 --- /dev/null
231 +++ b/games-action/minecraft/minecraft-1.2.1.ebuild
232 @@ -0,0 +1,100 @@
233 +# Copyright 1999-2013 Gentoo Foundation
234 +# Distributed under the terms of the GNU General Public License v2
235 +# $Header: $
236 +
237 +EAPI=5
238 +PYTHON_COMPAT=( python{2_7,3_1,3_2,3_3} )
239 +
240 +inherit eutils python-r1 games java-pkg-2
241 +
242 +DESCRIPTION="A game about placing blocks while running from skeletons. Or something like that..."
243 +HOMEPAGE="http://www.minecraft.net"
244 +SRC_URI="https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar -> $P.jar"
245 +LICENSE="Minecraft"
246 +SLOT="0"
247 +KEYWORDS="~amd64"
248 +IUSE=""
249 +RESTRICT="mirror"
250 +
251 +DEPEND="app-arch/zip
252 + >=virtual/jdk-1.6"
253 +
254 +RDEPEND="|| (
255 + >=dev-java/icetea-6[X]
256 + >=dev-java/icedtea-bin-6[X]
257 + >=dev-java/oracle-jre-bin-1.6[X]
258 + >=dev-java/oracle-jdk-bin-1.6[X]
259 + >=dev-java/sun-jre-bin-1.6[X]
260 + >=dev-java/sun-jdk-1.6[X] )
261 +
262 + dev-java/gson:2.2.2
263 + dev-java/java-config:2
264 + >=dev-java/jopt-simple-4.5:0
265 +
266 + dev-java/bcprov:0
267 + dev-java/commons-io:1
268 + dev-java/commons-lang:3.1
269 + dev-java/guava:14
270 + >=dev-java/jinput-1_pre20100416:0
271 + dev-java/jutils:0
272 + dev-java/lwjgl:2.9
273 + dev-java/paulscode-codecjorbis:0
274 + dev-java/paulscode-codecwav:0
275 + dev-java/paulscode-librarylwjglopenal:0
276 + dev-java/paulscode-libraryjavasound:0
277 + dev-java/paulscode-soundsystem:0"
278 +
279 +S="${WORKDIR}"
280 +
281 +pkg_setup() {
282 + java-pkg-2_pkg_setup
283 + games_pkg_setup
284 +}
285 +
286 +src_unpack() {
287 + zip -d "${DISTDIR}/${A}" -O "${PN}.jar" com/\* joptsimple/\* || die
288 +}
289 +
290 +src_prepare() {
291 + sed "s:@GENTOO_PORTAGE_EPREFIX@:${EPREFIX}:g" "${FILESDIR}/${PN}-gentoo" > "${PN}-gentoo" || die
292 +}
293 +
294 +src_install() {
295 + # These dependencies are used by the launcher. The others are used
296 + # by the game itself and are sourced using the wrapper below.
297 + java-pkg_register-dependency gson-2.2.2
298 + java-pkg_register-dependency jopt-simple
299 +
300 + python_scriptinto "${GAMES_PREFIX}/bin"
301 + python_foreach_impl python_doscript "${PN}-gentoo"
302 +
303 + java-pkg_dojar "${PN}.jar"
304 + java-pkg_dolauncher "${PN}" -into "${GAMES_PREFIX}" --main net.minecraft.bootstrap.Bootstrap
305 +
306 + doicon "${FILESDIR}/${PN}.png"
307 + make_desktop_entry "${PN}" "Minecraft"
308 +
309 + prepgamesdirs
310 +}
311 +
312 +pkg_postinst() {
313 + ewarn "The Minecraft launcher uses Gentoo's own packages but the game itself"
314 + ewarn "uses upstream libraries by default. Using Gentoo's packages for the game"
315 + ewarn "is recommended. Just follow these steps..."
316 + ewarn ""
317 + ewarn " # Start the launcher"
318 + ewarn " # Log in"
319 + ewarn " # Click Edit Profile"
320 + ewarn " # Tick the Executable check box"
321 + ewarn " # Replace the text box content with minecraft-gentoo"
322 + ewarn " # Click Save Profile"
323 + ewarn " # Play!"
324 + ewarn ""
325 + ewarn "You can revert to upstream libraries by unticking the check box. When"
326 + ewarn "reporting bugs to Gentoo, please state whether you are using upstream"
327 + ewarn "libraries or not. Always use upstream libraries when reporting bugs"
328 + ewarn "upstream."
329 + echo
330 +
331 + games_pkg_postinst
332 +}
333
334 diff --git a/games-action/minecraft/minecraft-20120805-r1.ebuild b/games-action/minecraft/minecraft-20120805-r1.ebuild
335 deleted file mode 100644
336 index 154c006..0000000
337 --- a/games-action/minecraft/minecraft-20120805-r1.ebuild
338 +++ /dev/null
339 @@ -1,81 +0,0 @@
340 -# Copyright 1999-2012 Gentoo Foundation
341 -# Distributed under the terms of the GNU General Public License v2
342 -# $Header: $
343 -
344 -EAPI="2"
345 -inherit eutils games java-pkg-2
346 -
347 -DESCRIPTION="A game about placing blocks while running from skeletons. Or something like that..."
348 -HOMEPAGE="http://www.minecraft.net"
349 -SRC_URI="http://www.minecraft.net/download/minecraft.jar -> $P.jar"
350 -LICENSE="as-is"
351 -SLOT="0"
352 -KEYWORDS="~amd64 ~x86"
353 -IUSE="ipv6"
354 -RESTRICT="mirror"
355 -
356 -# lwjgl 2.4 is used by upstream but we're using 2.6+ because of reports
357 -# that it fixes a bug where keyboard controls get stuck. You can
358 -# determine what version upstream uses by looking for the version number
359 -# near the top of...
360 -#
361 -# javap -classpath lwjgl.jar -c org.lwjgl.Sys
362 -
363 -DEPEND=">=virtual/jdk-1.5" # Only need this for jar.
364 -
365 -RDEPEND=">=dev-java/jinput-1_pre20100416
366 - >=dev-java/lwjgl-2.8.3:2.8
367 - || ( >=dev-java/icedtea-bin-6[X]
368 - >=dev-java/icedtea-6
369 - >=dev-java/oracle-jre-bin-1.6[X]
370 - >=dev-java/oracle-jdk-bin-1.6[X]
371 - >=dev-java/sun-jre-bin-1.6[X]
372 - >=dev-java/sun-jdk-1.6[X] )"
373 -
374 -S="${WORKDIR}"
375 -
376 -pkg_setup() {
377 - java-pkg-2_pkg_setup
378 - games_pkg_setup
379 -}
380 -
381 -src_prepare() {
382 - # Don't download or install JAR libraries. Hacky but works.
383 - sed -i "s/lwjgl\.jar, jinput\.jar, lwjgl_util\.jar,/ /g" \
384 - net/minecraft/GameUpdater.class || die
385 -
386 - # Recreate JAR.
387 - jar cfe "${PN}.jar" net.minecraft.MinecraftLauncher LZMA/ net/ || die
388 -}
389 -
390 -src_install() {
391 - java-pkg_register-dependency jinput
392 - java-pkg_register-dependency lwjgl-2.8 lwjgl.jar
393 - java-pkg_register-dependency lwjgl-2.8 lwjgl_util.jar
394 - java-pkg_dojar "${PN}.jar"
395 -
396 - local ARGS
397 - use ipv6 || ARGS="-Djava.net.preferIPv4Stack=true"
398 -
399 - # Launching with -jar seems to create classpath problems.
400 - java-pkg_dolauncher "${PN}" -into "${GAMES_PREFIX}" \
401 - -pre "${FILESDIR}/native-symlinks.sh" \
402 - --java_args "-Xmx1024M -Xms512M ${ARGS}" \
403 - --main net.minecraft.MinecraftLauncher
404 -
405 - doicon "${FILESDIR}/${PN}.png" || die
406 - make_desktop_entry "${PN}" "Minecraft"
407 -
408 - prepgamesdirs
409 -}
410 -
411 -pkg_postinst() {
412 - ewarn "We have patched Minecraft to use libraries built from source for your"
413 - ewarn "own system. If you encounter problems, PLEASE also try the official"
414 - ewarn "version before reporting them upstream. Make sure that you delete"
415 - ewarn "~/.minecraft/bin/version and ~/.minecraft/bin/natives before using the"
416 - ewarn "official version so that the libraries can be downloaded by the game."
417 - echo
418 -
419 - games_pkg_postinst
420 -}