1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
MY_PV="1.5-R0.1"
MC_PV="${MY_PV%-*}"
MC_PN="minecraft-server-unobfuscated"
MC_JAR="${MC_PN}-${MC_PV}.jar"
inherit games vcs-snapshot java-pkg-2 java-pkg-simple
DESCRIPTION="Bukkit implementation for the official Minecraft server"
HOMEPAGE="http://bukkit.org"
SRC_URI="https://github.com/Bukkit/CraftBukkit/tarball/master -> ${P}.tar.gz
http://repo.bukkit.org/content/repositories/releases/org/bukkit/minecraft-server/${MC_PV}/minecraft-server-${MC_PV}.jar -> ${MC_JAR}"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="ipv6"
RESTRICT="test" # Needs hamcrest-1.2?
CDEPEND="dev-java/commons-lang:2.1
dev-java/ebean:0
dev-java/gson:2.2.2
dev-java/guava:10
>=dev-java/jansi-1.8:0
dev-java/jline:2
dev-java/jopt-simple:0
>=dev-java/snakeyaml-1.9:0
~games-server/bukkit-1705:0"
DEPEND="${CDEPEND}
>=virtual/jdk-1.6"
# test? ( dev-java/hamcrest
# dev-java/junit:4 )"
RDEPEND="${CDEPEND}
>=virtual/jre-1.6
games-server/minecraft-common"
S="${WORKDIR}/${P}"
JAVA_GENTOO_CLASSPATH="bukkit,commons-lang-2.1,ebean,gson-2.2.2,guava-10,jansi,jline-2,jopt-simple,snakeyaml"
JAVA_CLASSPATH_EXTRA="${DISTDIR}/${MC_JAR}"
JAVA_SRC_DIR="src/main/java"
src_unpack() {
A="${P}.tar.gz" vcs-snapshot_src_unpack
mkdir -p "${S}/target/classes/META-INF" || die
cd "${S}/target/classes" || die
unpack "${MC_JAR}"
}
java_prepare() {
# Easier to use java-pkg-simple.
rm -v pom.xml || die
cp "${FILESDIR}"/directory.sh . || die
sed -i "s/@GAMES_USER_DED@/${GAMES_USER_DED}/g" directory.sh || die
echo "Implementation-Version: Gentoo-${PVR}" > target/classes/META-INF/MANIFEST.MF || die
cp -r src/main/resources/* target/classes || die
}
src_install() {
local ARGS
use ipv6 || ARGS="-Djava.net.preferIPv4Stack=true"
java-pkg-simple_src_install
java-pkg_dolauncher "${PN}" -into "${GAMES_PREFIX}" -pre directory.sh \
--java_args "-Xmx1024M -Xms512M ${ARGS}" --main org.bukkit.craftbukkit.Main
dosym minecraft-server "/etc/init.d/${PN}"
dodoc README.md
prepgamesdirs
}
pkg_postinst() {
einfo "You may run ${PN} as a regular user or start a system-wide"
einfo "instance using /etc/init.d/${PN}. The multiverse files are"
einfo "stored in ~/.minecraft/servers or /var/lib/minecraft respectively."
echo
einfo "The console for system-wide instances can be accessed by any user in"
einfo "the ${GAMES_GROUP} group using the minecraft-server-console command. This"
einfo "starts a client instance of tmux. The most important key-binding to"
einfo "remember is Ctrl-b d, which will detach the console and return you to"
einfo "your previous screen without stopping the server."
echo
einfo "This package allows you to start multiple CraftBukkit server instances."
einfo "You can do this by adding a multiverse name after ${PN} or by"
einfo "creating a symlink such as /etc/init.d/${PN}.foo. You would"
einfo "then access the console with \"minecraft-server-console foo\". The"
einfo "default multiverse name is \"main\"."
echo
einfo "Some Bukkit plugins store information in a database. Regardless of"
einfo "whether they handle their own database connectivity or use Bukkit's"
einfo "own Ebean solution, you can install your preferred JDBC driver through"
einfo "Portage. The available drivers are..."
einfo ""
einfo " # dev-java/h2"
einfo " # dev-java/sqlite-jdbc"
einfo " # dev-java/jdbc-mysql"
einfo " # dev-java/jdbc-postgresql"
echo
if has_version games-server/minecraft-server; then
ewarn "You already have the official server installed. You may run both this"
ewarn "and CraftBukkit against the same multiverse but not simultaneously."
ewarn "This is not recommended though so don't come crying to us if it"
ewarn "trashes your world."
echo
fi
games_pkg_postinst
}
src_test() {
cd src/test/java || die
local CP=".:${S}/${PN}.jar:$(java-pkg_getjars hamcrest,junit-4,${JAVA_GENTOO_CLASSPATH})"
local TESTS=$(find * -name "*Test.java")
TESTS="${TESTS//.java}"
TESTS="${TESTS//\//.}"
ejavac -cp "${CP}" -d . $(find * -name "*.java")
ejunit4 -classpath "${CP}" ${TESTS}
}
|