Merge remote-tracking branch 'github/pr/611'.
[gentoo.git] / games-strategy / uqm / uqm-0.7.0-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 multilib toolchain-funcs games
7
8 DESCRIPTION="The Ur-Quan Masters: Port of Star Control 2"
9 HOMEPAGE="http://sc2.sourceforge.net/"
10 SRC_URI="mirror://sourceforge/sc2/${P}-source.tgz
11         mirror://sourceforge/sc2/${P}-content.uqm
12         music? ( mirror://sourceforge/sc2/${P}-3domusic.uqm )
13         voice? ( mirror://sourceforge/sc2/${P}-voice.uqm )
14         remix? ( mirror://sourceforge/sc2/${PN}-remix-disc1.uqm \
15                 mirror://sourceforge/sc2/${PN}-remix-disc2.uqm \
16                 mirror://sourceforge/sc2/${PN}-remix-disc3.uqm )"
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="amd64 ppc ppc64 x86"
21 IUSE="music opengl remix voice"
22
23 RDEPEND="media-libs/libmikmod
24         media-libs/libogg
25         >=media-libs/libpng-1.4:0
26         media-libs/libsdl[X,sound,joystick,video]
27         media-libs/libvorbis
28         media-libs/sdl-image[png]
29         sys-libs/zlib
30         opengl? ( virtual/opengl )"
31 DEPEND="${RDEPEND}
32         virtual/pkgconfig"
33
34 src_prepare() {
35         local myopengl
36
37         use opengl \
38                 && myopengl=opengl \
39                 || myopengl=pure
40
41         cat <<-EOF > config.state
42         CHOICE_debug_VALUE='nodebug'
43         CHOICE_graphics_VALUE='${myopengl}'
44         CHOICE_sound_VALUE='mixsdl'
45         CHOICE_accel_VALUE='plainc'
46         INPUT_install_prefix_VALUE='${GAMES_PREFIX}'
47         INPUT_install_bindir_VALUE='\$prefix/bin'
48         INPUT_install_libdir_VALUE='\$prefix/lib'
49         INPUT_install_sharedir_VALUE='${GAMES_DATADIR}/'
50         EOF
51
52         # Take out the read so we can be non-interactive.
53         sed -i \
54                 -e '/read CHOICE/d' build/unix/menu_functions || die
55
56         # respect CFLAGS
57         sed -i \
58                 -e "s/-O3//" build/unix/build.config || die
59
60         sed -i \
61                 -e "s:@INSTALL_LIBDIR@:$(games_get_libdir)/:g" \
62                 build/unix/uqm-wrapper.in || die
63
64         # respect CC
65         sed -i \
66                 -e "s/PROG_gcc_FILE=\"gcc\"/PROG_gcc_FILE=\"$(tc-getCC)\"/" \
67                 build/unix/config_proginfo_build || die
68 }
69
70 src_compile() {
71         MAKE_VERBOSE=1 ./build.sh uqm || die
72 }
73
74 src_install() {
75         # Using the included install scripts seems quite painful.
76         # This manual install is totally fragile but maybe they'll
77         # use a sane build system for the next release.
78         newgamesbin uqm-wrapper uqm
79         exeinto "$(games_get_libdir)"/${PN}
80         doexe uqm
81
82         insinto "${GAMES_DATADIR}"/${PN}/content/packages
83         doins "${DISTDIR}"/${P}-content.uqm
84         echo ${P} > "${D}${GAMES_DATADIR}"/${PN}/content/version || die
85
86         insinto "${GAMES_DATADIR}"/${PN}/content/addons
87         if use music; then
88                 doins "${DISTDIR}"/${P}-3domusic.uqm
89         fi
90
91         if use voice; then
92                 doins "${DISTDIR}"/${P}-voice.uqm
93         fi
94
95         if use remix; then
96                 insinto "${GAMES_DATADIR}"/${PN}/content/addons
97                 doins "${DISTDIR}"/${PN}-remix-disc{1,2,3}.uqm
98         fi
99
100         dodoc AUTHORS ChangeLog Contributing README WhatsNew doc/users/manual.txt
101         docinto devel
102         dodoc doc/devel/[!n]*
103         docinto devel/netplay
104         dodoc doc/devel/netplay/*
105         make_desktop_entry uqm "The Ur-Quan Masters"
106         prepgamesdirs
107 }