games-strategy/s25rttr: use HTTPs
[gentoo.git] / games-strategy / s25rttr / s25rttr-0.8.1-r3.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 inherit eutils cmake-utils gnome2-utils readme.gentoo-r1
6
7 DESCRIPTION="Open Source remake of The Settlers II game (needs original game files)"
8 HOMEPAGE="https://www.siedler25.org/"
9 # no upstream source tarball yet
10 # https://bugs.launchpad.net/s25rttr/+bug/1069546
11 SRC_URI="https://dev.gentoo.org/~hasufell/distfiles/${P}.tar.xz"
12
13 LICENSE="GPL-3"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="debug"
17
18 RDEPEND="
19         app-arch/bzip2
20         media-libs/libsamplerate
21         media-libs/libsdl[X,sound,opengl,video]
22         media-libs/libsndfile
23         media-libs/sdl-mixer[vorbis]
24         net-libs/miniupnpc
25         virtual/libiconv
26         virtual/opengl
27 "
28 DEPEND="${RDEPEND}
29         sys-devel/gettext
30 "
31
32 PATCHES=(
33         "${FILESDIR}"/${P}-cmake.patch
34         "${FILESDIR}"/${P}-soundconverter.patch
35         "${FILESDIR}"/${P}-fpic.patch
36         "${FILESDIR}"/${P}-format.patch
37         "${FILESDIR}"/${P}-miniupnpc-api-14.patch
38         "${FILESDIR}"/${P}-cmake-3.patch
39         "${FILESDIR}"/${P}-gcc6.patch
40 )
41
42 DOC_CONTENTS="Copy your Settlers2 game files into ~/.${PN}/S2"
43
44 src_configure() {
45         local arch
46         case ${ARCH} in
47                 amd64)
48                         arch="x86_64" ;;
49                 x86)
50                         arch="i386" ;;
51                 *) die "Architecture ${ARCH} not yet supported" ;;
52         esac
53
54         local mycmakeargs=(
55                 -DCOMPILEFOR="linux"
56                 -DCOMPILEARCH="${arch}"
57                 -DCMAKE_SKIP_RPATH=YES
58                 -DPREFIX="/usr/"
59                 -DBINDIR="/usr/bin"
60                 -DDATADIR="/usr/share"
61                 -DLIBDIR="/usr/$(get_libdir)/${PN}"
62                 -DDRIVERDIR="/usr/$(get_libdir)/${PN}"
63                 -DGAMEDIR="~/.${PN}/S2"
64                 -DBUILD_GLFW_DRIVER=OFF
65         )
66
67         cmake-utils_src_configure
68 }
69
70 src_compile() {
71         # work around some relative paths (CMAKE_IN_SOURCE_BUILD not supported)
72         ln -s "${CMAKE_USE_DIR}"/RTTR "${CMAKE_BUILD_DIR}"/RTTR || die
73
74         cmake-utils_src_compile
75
76         mv "${CMAKE_USE_DIR}"/RTTR/{sound-convert,s-c_resample} "${T}"/ || die
77 }
78
79 src_install() {
80         cd "${CMAKE_BUILD_DIR}" || die
81
82         exeinto /usr/"$(get_libdir)"/${PN}
83         doexe "${T}"/{sound-convert,s-c_resample}
84         exeinto /usr/"$(get_libdir)"/${PN}/video
85         doexe driver/video/SDL/src/libvideoSDL.so
86         exeinto /usr/"$(get_libdir)"/${PN}/audio
87         doexe driver/audio/SDL/src/libaudioSDL.so
88
89         insinto /usr/share
90         doins -r "${CMAKE_USE_DIR}"/RTTR
91         dosym ./LSTS/splash.bmp /usr/share/RTTR/splash.bmp
92
93         doicon -s 64 "${CMAKE_USE_DIR}"/debian/${PN}.png
94         dobin src/s25client
95         make_desktop_entry "s25client" "Settlers RTTR" "${PN}"
96
97         dodoc RTTR/texte/{keyboardlayout.txt,readme.txt}
98         readme.gentoo_create_doc
99 }
100
101 pkg_preinst() {
102         gnome2_icon_savelist
103 }
104
105 pkg_postinst() {
106         gnome2_icon_cache_update
107         readme.gentoo_print_elog
108 }
109
110 pkg_postrm() {
111         gnome2_icon_cache_update
112 }