games-strategy/s25rttr: Add missing RESTRICT
[gentoo.git] / games-strategy / s25rttr / s25rttr-0.9.0_pre20200418.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit desktop xdg cmake
7
8 DESCRIPTION="Open source remake of The Settlers II: Gold Edition (needs original data files)"
9 HOMEPAGE="https://www.siedler25.org/"
10
11 # To generate from git repo:
12 # echo -e "COMMIT=\"$(git rev-parse HEAD)\"\nSRC_URI=\"\n\thttps://github.com/Return-To-The-Roots/s25client/archive/\${COMMIT}.tar.gz -> s25client-\${COMMIT}.tar.gz" && git submodule --quiet foreach --recursive 'url=$(git remote get-url origin); gh=${url#*github.com[:/]}; gh=${gh%.git}; echo -e "\thttps://github.com/${gh}/archive/${sha1}.tar.gz -> \${PN}-${gh##*/}-${sha1}.tar.gz"' | egrep -v "/(dev-tools|libsamplerate|s25update)/" | sort && echo '"'
13 COMMIT="784eb58fc1eb42751042d82f16cc92617fc6c2ae"
14 SRC_URI="
15         https://github.com/Return-To-The-Roots/s25client/archive/${COMMIT}.tar.gz -> s25client-${COMMIT}.tar.gz
16         https://github.com/mat007/turtle/archive/5f8421b1d270665347280d4cab1caf159d6858de.tar.gz -> ${PN}-turtle-5f8421b1d270665347280d4cab1caf159d6858de.tar.gz
17         https://github.com/Return-To-The-Roots/languages/archive/b1978170473bbf39a24254814e1b1f967a51ef4c.tar.gz -> ${PN}-languages-b1978170473bbf39a24254814e1b1f967a51ef4c.tar.gz
18         https://github.com/Return-To-The-Roots/libendian/archive/dd2c11498f679247530b6b7cf7bd5964f539ddfd.tar.gz -> ${PN}-libendian-dd2c11498f679247530b6b7cf7bd5964f539ddfd.tar.gz
19         https://github.com/Return-To-The-Roots/liblobby/archive/7d85ec40f03af619a6734f20edb28d991b3d61f2.tar.gz -> ${PN}-liblobby-7d85ec40f03af619a6734f20edb28d991b3d61f2.tar.gz
20         https://github.com/Return-To-The-Roots/libsiedler2/archive/800d58ea072c35d3cf9832d2f6a5cdae92fc0445.tar.gz -> ${PN}-libsiedler2-800d58ea072c35d3cf9832d2f6a5cdae92fc0445.tar.gz
21         https://github.com/Return-To-The-Roots/libutil/archive/c91488e4d2f0079a864c4be80eaba24a871e9772.tar.gz -> ${PN}-libutil-c91488e4d2f0079a864c4be80eaba24a871e9772.tar.gz
22         https://github.com/Return-To-The-Roots/mygettext/archive/7e46bbb3e24891348f5629887efb0173690e83b8.tar.gz -> ${PN}-mygettext-7e46bbb3e24891348f5629887efb0173690e83b8.tar.gz
23         https://github.com/Return-To-The-Roots/s25edit/archive/04b5e725036a0568e8da15447167c240563dbaba.tar.gz -> ${PN}-s25edit-04b5e725036a0568e8da15447167c240563dbaba.tar.gz
24         https://github.com/Return-To-The-Roots/s25maps/archive/11a5f3e95405b7cf8088641efb4939eba9639cbc.tar.gz -> ${PN}-s25maps-11a5f3e95405b7cf8088641efb4939eba9639cbc.tar.gz
25         https://github.com/satoren/kaguya/archive/38ca7e1d894c138e454bbe5c89048bdd5091545a.tar.gz -> ${PN}-kaguya-38ca7e1d894c138e454bbe5c89048bdd5091545a.tar.gz
26 "
27
28 LICENSE="GPL-2+ GPL-3 Boost-1.0"
29 SLOT="0"
30 KEYWORDS="~amd64 ~x86"
31 IUSE="test"
32 RESTRICT="!test? ( test )"
33
34 RDEPEND="
35         app-arch/bzip2
36         >=dev-lang/lua-5.1:=
37         >=dev-libs/boost-1.64:0=[nls]
38         >=media-libs/libsamplerate-0.1.9
39         >=media-libs/libsdl2-2.0.10-r2[opengl,sound,video]
40         media-libs/libsndfile
41         media-libs/sdl2-mixer[vorbis,wav]
42         net-libs/miniupnpc
43         virtual/opengl
44 "
45
46 DEPEND="
47         ${RDEPEND}
48         test? ( >=sys-devel/clang-5 )
49 "
50
51 BDEPEND="
52         sys-devel/gettext
53         virtual/pkgconfig
54 "
55
56 S="${WORKDIR}/s25client-${COMMIT}"
57
58 PATCHES=(
59         "${FILESDIR}"/${PN}-loosen-libs.patch
60 )
61
62 # Build type is checked but blank is valid.
63 CMAKE_BUILD_TYPE=
64
65 src_unpack() {
66         default
67
68         local SRC DST
69         for SRC in */; do
70                 case "${SRC}" in
71                         s25client-*)
72                                 continue ;;
73                         s25maps-*)
74                                 DST=data/RTTR/MAPS ;;
75                         *)
76                                 DST=${SRC%-*}
77                                 DST=external/${DST,,} ;;
78                 esac
79
80                 rmdir "${S}/${DST}" || die
81                 mv "${SRC}" "${S}/${DST}" || die
82         done
83 }
84
85 src_configure() {
86         local mycmakeargs=(
87                 -DBUILD_TESTING=$(usex test)
88                 -DCCACHE_PROGRAM=OFF
89                 -DCMAKE_SKIP_RPATH=ON
90                 -DRTTR_BUILD_UPDATER=OFF
91                 -DRTTR_ENABLE_OPTIMIZATIONS=OFF
92                 -DRTTR_ENABLE_SANITIZERS=$(usex test)
93                 -DRTTR_INCLUDE_DEVTOOLS=OFF
94                 -DRTTR_LIBDIR="$(get_libdir)/${PN}"
95                 -DRTTR_REVISION="${COMMIT}"
96                 -DRTTR_USE_SYSTEM_SAMPLERATE=ON
97                 -DRTTR_VERSION="${PV}"
98         )
99
100         if use test ; then
101                 einfo "Forcing clang due to USE=test."
102                 CC=${CHOST}-clang
103                 CXX=${CHOST}-clang++
104         fi
105
106         cmake_src_configure
107 }
108
109 src_test() {
110         SDL_AUDIODRIVER=dummy \
111         SDL_VIDEODRIVER=dummy \
112         cmake_src_test
113 }
114
115 src_install() {
116         cmake_src_install
117
118         doicon -s 64 tools/release/debian/s25rttr.png
119         make_desktop_entry s25client "Return to the Roots"
120 }
121
122 pkg_postinst() {
123         xdg_pkg_postinst
124
125         if ! has_version -r games-strategy/settlers-2-gold-data; then
126                 elog "Install games-strategy/settlers-2-gold-data or manually copy the DATA"
127                 elog "and GFX directories from original data files into"
128                 elog "${EPREFIX}/usr/share/${PN}/S2."
129         fi
130 }