Use https by default
[gentoo.git] / games-rpg / eternal-lands / eternal-lands-1.9.3-r2.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 eutils flag-o-matic gnome2-utils games
7
8 DESCRIPTION="An online MMORPG written in C and SDL"
9 HOMEPAGE="http://www.eternal-lands.com"
10 SRC_URI="mirror://gentoo/elc_1.9.3-20120213.tar.bz2
11         https://dev.gentoo.org/~rich0/distfiles/${PN}.png"
12
13 LICENSE="eternal_lands"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86 ~x86-fbsd"
16 IUSE="debug doc kernel_linux"
17
18 RDEPEND="dev-libs/libxml2:=
19         media-libs/cal3d:=[-16bit-indices]
20         media-libs/freealut
21         media-libs/libpng:0=
22         media-libs/libsdl:=[X,opengl,video]
23         media-libs/libvorbis:=
24         media-libs/openal:=
25         media-libs/sdl-image:=
26         media-libs/sdl-net:=
27         >=games-rpg/eternal-lands-data-1.9.3
28         sys-libs/zlib:=[minizip]
29         virtual/glu
30         virtual/opengl
31         x11-libs/libX11:=
32         x11-libs/libXau:=
33         x11-libs/libXdmcp:=
34         x11-libs/libXext:="
35 DEPEND="${RDEPEND}
36         >=app-eselect/eselect-opengl-1.0.6-r1
37         app-arch/unzip
38         virtual/pkgconfig
39         doc? ( app-doc/doxygen
40                 media-gfx/graphviz )
41         media-libs/glew"
42
43 S="${WORKDIR}/elc"
44
45 src_prepare() {
46         local BROWSER="firefox"
47
48         sed -i \
49                 -e 's/#browser/browser/g' \
50                 -e "s/browser = mozilla/#browser = ${BROWSER}/g" \
51                 -e "s@#data_dir = /usr/local/games/el/@#data_dir = ${GAMES_DATADIR}/${PN}/@g" \
52                 el.ini || die "sed failed"
53
54         # Finally, update the server
55         sed -i -e '/#server_address =/ s/.*/#server_address = game.eternal-lands.com/' \
56                 el.ini || die "sed failed"
57
58         epatch "${FILESDIR}/${PN}-1.9.3-glbuild.patch"
59         epatch "${FILESDIR}/${PN}-1.9.3-build.patch"
60         epatch "${FILESDIR}/${PN}-1.9.3-minizip.patch"
61
62         # remove bundled minizip
63         rm io/{crypt,ioapi,unzip,zip}.h || die
64         rm io/{ioapi,unzip,zip}.c || die
65
66         cp Makefile.linux Makefile
67 }
68
69 src_compile() {
70         emake \
71                 DEBUG="$(usex debug)" \
72                 BSD_KERNEL="$(usex !kernel_linux)" \
73                 DATADIR="${GAMES_DATADIR}/${PN}/"
74
75         if use doc; then
76                 emake docs
77                 mv ./docs/html/ ../client || die "Failed to move documentation directory"
78         fi
79 }
80
81 src_install() {
82         dogamesbin el
83         make_desktop_entry el "Eternal Lands"
84
85         insopts -m 0660
86         insinto "${GAMES_DATADIR}/${PN}"
87
88         doins -r *.ini *.txt commands.lst
89
90         if use doc ; then
91                 dohtml -r "${WORKDIR}"/client/*
92         fi
93
94         doicon -s 64 "${DISTDIR}/${PN}.png"
95
96         prepgamesdirs
97 }
98
99 pkg_preinst() {
100         games_pkg_preinst
101         gnome2_icon_savelist
102 }
103
104 pkg_postinst() {
105         games_pkg_postinst
106         gnome2_icon_cache_update
107         elog "Auto Update is now enabled in Eternal Lands"
108         elog "If an update occurs then the client will suddenly exit"
109         elog "Updates only happen when the game first loads"
110         elog "Please don't report this behaviour as a bug"
111
112         # Ensure that the files are writable by the game group for auto
113         # updating.
114         chmod -R g+rw "${ROOT}/${GAMES_DATADIR}/${PN}"
115
116         # Make sure new files stay in games group
117         find "${ROOT}/${GAMES_DATADIR}/${PN}" -type d -exec chmod g+sx {} \;
118 }
119
120 pkg_postrm() {
121         gnome2_icon_cache_update
122 }