]> Pileus Git - ~andy/sunrise/blob - games-strategy/s25rttr/s25rttr-9999.ebuild
882e83fc6d27406b9d29797eca694fb076f67bda
[~andy/sunrise] / games-strategy / s25rttr / s25rttr-9999.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=3
6
7 EBZR_REPO_URI="lp:s25rttr"
8
9 inherit eutils cmake-utils bzr games
10
11 DESCRIPTION="Open Source remake of The Settlers II game"
12 HOMEPAGE="http://www.siedler25.org/"
13
14 LICENSE="GPL-3"
15 SLOT="0"
16 KEYWORDS=""
17 IUSE=""
18
19 RDEPEND="app-arch/bzip2
20         media-libs/libsamplerate
21         media-libs/libsdl[X,audio,video]
22         media-libs/libsndfile
23         media-libs/sdl-mixer
24         net-libs/miniupnpc
25         virtual/opengl"
26 DEPEND="${RDEPEND}
27         sys-devel/gettext"
28
29 src_prepare() {
30         # date Sat Apr 7 2012
31         epatch "${FILESDIR}"/${PV}-cmake.patch
32         # date Mon Apr 30 2012
33         epatch "${FILESDIR}"/${PV}-soundconverter.patch
34 }
35
36 src_configure() {
37         # build system does not set the version for us
38         # will prevent us from connecting to other players
39         local mydate
40         mydate=$(bzr version-info "${EBZR_STORE_DIR}/${EBZR_PROJECT}" 2> /dev/null \
41                 | awk '{if ($1 == "date:") {gsub("-", "",$2); print $2}}')
42
43         local mycmakeargs=(
44                 -DPREFIX="${GAMES_PREFIX}"
45                 -DBINDIR="${GAMES_BINDIR}"
46                 -DDATADIR="${GAMES_DATADIR}"
47                 -DLIBDIR="$(games_get_libdir)/${PN}"
48                 -DDRIVERDIR="$(games_get_libdir)/${PN}"
49                 -DGAMEDIR="~/.${PN}/S2"
50                 -DWINDOW_VERSION="${mydate}"
51                 -DWINDOW_REVISION="${EBZR_REVNO}"
52         )
53
54         cmake-utils_src_configure
55 }
56
57 src_compile() {
58         # build system uses some relative paths
59         # CMAKE_IN_SOURCE_BUILD fails/unsupported
60         ln -s "${CMAKE_USE_DIR}"/RTTR "${CMAKE_BUILD_DIR}"/RTTR || die
61
62         cmake-utils_src_compile
63 }
64
65 src_install() {
66         cd "${CMAKE_BUILD_DIR}" || die
67
68         # libs, converter
69         exeinto "$(games_get_libdir)"/${PN}
70         doexe RTTR/{sound-convert,s-c_resample} || die
71         exeinto "$(games_get_libdir)"/${PN}/video
72         doexe driver/video/SDL/src/libvideoSDL.so || die
73         exeinto "$(games_get_libdir)"/${PN}/audio
74         doexe driver/audio/SDL/src/libaudioSDL.so || die
75
76         # data
77         insinto "${GAMES_DATADIR}"
78         rm RTTR/{sound-convert,s-c_resample} || die
79         doins -r RTTR || die
80
81         # icon, bin, wrapper, docs
82         doicon "${CMAKE_USE_DIR}"/debian/${PN}.png || die
83         dogamesbin src/s25client || die
84         make_desktop_entry "s25client" "Settlers RTTR" "${PN}"
85         dodoc RTTR/texte/{keyboardlayout.txt,readme.txt} || die
86
87         # permissions
88         prepgamesdirs
89 }
90
91 pkg_postinst() {
92         games_pkg_postinst
93         elog "Copy your Settlers2 cdrom content into ~/.${PN}/S2"
94 }