games-strategy/colobot: Fix build failure due to missing include
[gentoo.git] / games-strategy / uqm / uqm-0.7.0.1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 inherit desktop toolchain-funcs
6
7 MY_PV=$(ver_rs 3 '-')
8 MY_P="${PN}-${MY_PV}"
9 BASE_PV=$(ver_cut 1-3)
10 BASE_P="${PN}-${BASE_PV}"
11
12 DESCRIPTION="The Ur-Quan Masters: Port of Star Control 2"
13 HOMEPAGE="http://sc2.sourceforge.net/"
14 SRC_URI="mirror://sourceforge/sc2/${MY_P}-source.tgz
15         mirror://sourceforge/sc2/${BASE_P}-content.uqm
16         music? ( mirror://sourceforge/sc2/${BASE_P}-3domusic.uqm )
17         voice? ( mirror://sourceforge/sc2/${BASE_P}-voice.uqm )
18         remix? ( mirror://sourceforge/sc2/${PN}-remix-disc1.uqm \
19                 mirror://sourceforge/sc2/${PN}-remix-disc2.uqm \
20                 mirror://sourceforge/sc2/${PN}-remix-disc3.uqm \
21                 mirror://sourceforge/sc2/${PN}-remix-disc4.uqm )"
22
23 LICENSE="GPL-2+"
24 SLOT="0"
25 KEYWORDS="~amd64 ~ppc64 ~x86"
26 IUSE="music opengl remix voice"
27
28 RDEPEND="
29         media-libs/libmikmod
30         media-libs/libogg
31         >=media-libs/libpng-1.4:0=
32         media-libs/libsdl[X,sound,joystick,video]
33         media-libs/libvorbis
34         media-libs/sdl-image[png]
35         sys-libs/zlib
36         opengl? ( virtual/opengl )
37 "
38 DEPEND="${RDEPEND}
39         virtual/pkgconfig
40 "
41
42 S="${WORKDIR}/${MY_P}"
43
44 PATCHES=(
45         "${FILESDIR}/${BASE_P}-tempdir.patch"
46         "${FILESDIR}/${BASE_P}-warning.patch"
47 )
48
49 src_prepare() {
50         default
51
52         local myopengl=$(usex opengl 'opengl' 'pure')
53
54         cat <<-EOF > config.state
55         CHOICE_debug_VALUE='nodebug'
56         CHOICE_graphics_VALUE='${myopengl}'
57         CHOICE_sound_VALUE='mixsdl'
58         CHOICE_accel_VALUE='plainc'
59         INPUT_install_prefix_VALUE='/usr/share'
60         INPUT_install_bindir_VALUE='\$prefix/bin'
61         INPUT_install_libdir_VALUE='\$prefix/lib'
62         INPUT_install_sharedir_VALUE='/usr/share/'
63         EOF
64
65         # Take out the read so we can be non-interactive.
66         sed -i \
67                 -e '/read CHOICE/d' build/unix/menu_functions || die
68
69         # respect CFLAGS
70         sed -i \
71                 -e "s/-O3//" build/unix/build.config || die
72
73         sed -i \
74                 -e "s:@INSTALL_LIBDIR@:/usr/$(get_libdir)/:g" \
75                 build/unix/uqm-wrapper.in || die
76
77         # respect CC
78         sed -i \
79                 -e "s/PROG_gcc_FILE=\"gcc\"/PROG_gcc_FILE=\"$(tc-getCC)\"/" \
80                 build/unix/config_proginfo_build || die
81 }
82
83 src_compile() {
84         MAKE_VERBOSE=1 ./build.sh uqm || die
85 }
86
87 src_install() {
88         # Using the included install scripts seems quite painful.
89         # This manual install is totally fragile but maybe they'll
90         # use a sane build system for the next release.
91         newbin uqm-wrapper uqm
92         exeinto /usr/"$(get_libdir)"/${PN}
93         doexe uqm
94
95         insinto /usr/share/${PN}/content/packages
96         doins "${DISTDIR}"/${BASE_P}-content.uqm
97         echo ${BASE_P} > "${ED}"/usr/share/${PN}/content/version || die
98
99         insinto /usr/share/${PN}/content/addons
100         if use music; then
101                 doins "${DISTDIR}"/${BASE_P}-3domusic.uqm
102         fi
103
104         if use voice; then
105                 doins "${DISTDIR}"/${BASE_P}-voice.uqm
106         fi
107
108         if use remix; then
109                 insinto /usr/share/${PN}/content/addons
110                 doins "${DISTDIR}"/${PN}-remix-disc{1,2,3,4}.uqm
111         fi
112
113         dodoc AUTHORS ChangeLog Contributing README WhatsNew doc/users/manual.txt
114         docinto devel
115         dodoc doc/devel/[!n]*
116         docinto devel/netplay
117         dodoc doc/devel/netplay/*
118         make_desktop_entry uqm "The Ur-Quan Masters"
119 }