game-action/minetest: Version bump to 0.4.13
[gentoo.git] / games-action / minetest / minetest-0.4.13.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit cmake-utils eutils gnome2-utils user vcs-snapshot
7
8 DESCRIPTION="An InfiniMiner/Minecraft inspired game"
9 HOMEPAGE="http://minetest.net/"
10 SRC_URI="http://github.com/minetest/minetest/tarball/${PV} -> ${P}.tar.gz"
11
12 LICENSE="LGPL-2.1+ CC-BY-SA-3.0 OFL-1.1 Apache-2.0"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="+curl dedicated doc leveldb luajit nls redis +server +sound spatial +truetype"
16
17 RDEPEND="dev-db/sqlite:3
18         sys-libs/zlib
19         curl? ( net-misc/curl )
20         !dedicated? (
21                 app-arch/bzip2
22                 >=dev-games/irrlicht-1.8-r2
23                 dev-libs/gmp:0
24                 media-libs/libpng:0
25                 virtual/jpeg:0
26                 virtual/opengl
27                 x11-libs/libX11
28                 x11-libs/libXxf86vm
29                 sound? (
30                         media-libs/libogg
31                         media-libs/libvorbis
32                         media-libs/openal
33                 )
34                 truetype? ( media-libs/freetype:2 )
35         )
36         leveldb? ( dev-libs/leveldb )
37         luajit? ( dev-lang/luajit:2 )
38         nls? ( virtual/libintl )
39         redis? ( dev-libs/hiredis )
40         spatial? ( sci-libs/libspatialindex )"
41 DEPEND="${RDEPEND}
42         >=dev-games/irrlicht-1.8-r2
43         doc? ( app-doc/doxygen media-gfx/graphviz )
44         nls? ( sys-devel/gettext )"
45
46 pkg_setup() {
47         if use server || use dedicated ; then
48                 enewgroup ${PN}
49                 enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
50         fi
51 }
52
53 src_prepare() {
54         # set paths
55         sed \
56                 -e "s#@BINDIR@#/usr/bin#g" \
57                 -e "s#@GROUP@#${PN}#g" \
58                 "${FILESDIR}"/minetestserver.confd > "${T}"/minetestserver.confd || die
59 }
60
61 src_configure() {
62         local mycmakeargs=(
63                 $(usex dedicated "-DBUILD_SERVER=ON -DBUILD_CLIENT=OFF" "$(cmake-utils_use_build server SERVER) -DBUILD_CLIENT=ON")
64                 -DCUSTOM_BINDIR="/usr/bin"
65                 -DCUSTOM_DOCDIR="/usr/share/doc/${PF}"
66                 -DCUSTOM_LOCALEDIR="/usr/share/${PN}/locale"
67                 -DCUSTOM_SHAREDIR="/usr/share/${PN}"
68                 -DCUSTOM_EXAMPLE_CONF_DIR="/usr/share/doc/${PF}"
69                 -DENABLE_CURL=$(usex curl)
70                 $(cmake-utils_use_enable truetype FREETYPE)
71                 $(cmake-utils_use_enable nls GETTEXT)
72                 -DENABLE_GLES=0
73                 $(cmake-utils_use_enable leveldb LEVELDB)
74                 $(cmake-utils_use_enable redis REDIS)
75                 -DENABLE_SPATIAL=$(usex spatial)
76                 $(cmake-utils_use_enable sound SOUND)
77                 $(cmake-utils_use luajit ENABLE_LUAJIT)
78                 -DRUN_IN_PLACE=0
79         )
80
81         use dedicated && mycmakeargs+=(
82                 -DIRRLICHT_SOURCE_DIR=/the/irrlicht/source
83                 -DIRRLICHT_INCLUDE_DIR=/usr/include/irrlicht
84         )
85
86         cmake-utils_src_configure
87 }
88
89 src_compile() {
90         cmake-utils_src_compile
91
92         if use doc ; then
93                 cmake-utils_src_compile doc
94         fi
95 }
96
97 src_install() {
98         cmake-utils_src_install
99
100         if use server || use dedicated ; then
101                 newinitd "${FILESDIR}"/minetestserver.initd minetest-server
102                 newconfd "${T}"/minetestserver.confd minetest-server
103         fi
104
105         if use doc ; then
106                 cd "${CMAKE_BUILD_DIR}"/doc || die
107                 dodoc -r html
108         fi
109 }
110
111 pkg_preinst() {
112         gnome2_icon_savelist
113 }
114
115 pkg_postinst() {
116         gnome2_icon_cache_update
117
118         if ! use dedicated ; then
119                 elog
120                 elog "optional dependencies:"
121                 elog "  games-action/minetest_game (official mod)"
122                 elog
123         fi
124
125         if use server || use dedicated ; then
126                 elog
127                 elog "Configure your server via /etc/conf.d/minetest-server"
128                 elog "The user \"minetest\" is created with /var/lib/${PN} homedir."
129                 elog "Default logfile is ~/minetest-server.log"
130                 elog
131         fi
132 }
133
134 pkg_postrm() {
135         gnome2_icon_cache_update
136 }