summaryrefslogtreecommitdiff
blob: 562c43b26a893f8f71b48fd7d98ee5586e82e53f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit desktop toolchain-funcs

MY_PV=$(ver_rs 3 '-')
MY_P="${PN}-${MY_PV}"
BASE_PV=$(ver_cut 1-3)
BASE_P="${PN}-${BASE_PV}"

DESCRIPTION="The Ur-Quan Masters: Port of Star Control 2"
HOMEPAGE="http://sc2.sourceforge.net/"
SRC_URI="mirror://sourceforge/sc2/${MY_P}-source.tgz
	mirror://sourceforge/sc2/${BASE_P}-content.uqm
	music? ( mirror://sourceforge/sc2/${BASE_P}-3domusic.uqm )
	voice? ( mirror://sourceforge/sc2/${BASE_P}-voice.uqm )
	remix? ( mirror://sourceforge/sc2/${PN}-remix-disc1.uqm \
		mirror://sourceforge/sc2/${PN}-remix-disc2.uqm \
		mirror://sourceforge/sc2/${PN}-remix-disc3.uqm \
		mirror://sourceforge/sc2/${PN}-remix-disc4.uqm )"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~ppc64 ~x86"
IUSE="music opengl remix voice"

RDEPEND="
	media-libs/libmikmod
	media-libs/libogg
	>=media-libs/libpng-1.4:0=
	media-libs/libsdl[X,sound,joystick,video]
	media-libs/libvorbis
	media-libs/sdl-image[png]
	sys-libs/zlib
	opengl? ( virtual/opengl )
"
DEPEND="${RDEPEND}
	virtual/pkgconfig
"

S="${WORKDIR}/${MY_P}"

PATCHES=(
	"${FILESDIR}/${BASE_P}-tempdir.patch"
	"${FILESDIR}/${BASE_P}-warning.patch"
)

src_prepare() {
	default

	local myopengl=$(usex opengl 'opengl' 'pure')

	cat <<-EOF > config.state
	CHOICE_debug_VALUE='nodebug'
	CHOICE_graphics_VALUE='${myopengl}'
	CHOICE_sound_VALUE='mixsdl'
	CHOICE_accel_VALUE='plainc'
	INPUT_install_prefix_VALUE='/usr/share'
	INPUT_install_bindir_VALUE='\$prefix/bin'
	INPUT_install_libdir_VALUE='\$prefix/lib'
	INPUT_install_sharedir_VALUE='/usr/share/'
	EOF

	# Take out the read so we can be non-interactive.
	sed -i \
		-e '/read CHOICE/d' build/unix/menu_functions || die

	# respect CFLAGS
	sed -i \
		-e "s/-O3//" build/unix/build.config || die

	sed -i \
		-e "s:@INSTALL_LIBDIR@:/usr/$(get_libdir)/:g" \
		build/unix/uqm-wrapper.in || die

	# respect CC
	sed -i \
		-e "s/PROG_gcc_FILE=\"gcc\"/PROG_gcc_FILE=\"$(tc-getCC)\"/" \
		build/unix/config_proginfo_build || die
}

src_compile() {
	MAKE_VERBOSE=1 ./build.sh uqm || die
}

src_install() {
	# Using the included install scripts seems quite painful.
	# This manual install is totally fragile but maybe they'll
	# use a sane build system for the next release.
	newbin uqm-wrapper uqm
	exeinto /usr/"$(get_libdir)"/${PN}
	doexe uqm

	insinto /usr/share/${PN}/content/packages
	doins "${DISTDIR}"/${BASE_P}-content.uqm
	echo ${BASE_P} > "${ED}"/usr/share/${PN}/content/version || die

	insinto /usr/share/${PN}/content/addons
	if use music; then
		doins "${DISTDIR}"/${BASE_P}-3domusic.uqm
	fi

	if use voice; then
		doins "${DISTDIR}"/${BASE_P}-voice.uqm
	fi

	if use remix; then
		insinto /usr/share/${PN}/content/addons
		doins "${DISTDIR}"/${PN}-remix-disc{1,2,3,4}.uqm
	fi

	dodoc AUTHORS ChangeLog Contributing README WhatsNew doc/users/manual.txt
	docinto devel
	dodoc doc/devel/[!n]*
	docinto devel/netplay
	dodoc doc/devel/netplay/*
	make_desktop_entry uqm "The Ur-Quan Masters"
}