summaryrefslogtreecommitdiff
blob: e42a75cfd6688c91323f57a029c20fbcd2f11ede (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI="5"

inherit cdrom eutils games unpacker

MY_PN="ssamtfe"

DESCRIPTION="Serious Sam: The First Encounter"
HOMEPAGE="http://www.croteam.com/
	http://www.seriouszone.com/
	http://icculus.org/betas/ssam/"
SRC_URI="http://icculus.org/betas/ssam/ssam-tfe-lnx-beta1a.run
	http://icculus.org/updates/ssam/${MY_PN}-beta1b.sh.bin
	http://icculus.org/updates/ssam/${MY_PN}-beta2.sh.bin
	http://icculus.org/updates/ssam/${MY_PN}-beta3.sh.bin"
LICENSE="LOKI-EULA"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
RESTRICT="strip"
IUSE="alsa"

RDEPEND="
	>=media-libs/libsdl-1.2.15-r5[X,joystick,opengl,video,abi_x86_32(-)]
	virtual/opengl[abi_x86_32(-)]
	alsa? (
		>=media-libs/libogg-1.3.1[abi_x86_32(-)]
		>=media-libs/libsdl-1.2.15-r5[alsa,sound,abi_x86_32(-)]
		>=media-libs/libvorbis-1.3.3-r1[abi_x86_32(-)]
	)
"

DEPEND="games-util/loki_patch"

S=${WORKDIR}

QA_TEXTRELS="
opt/ssamtfe/Bin/libGame.so
opt/ssamtfe/Bin/libEntities.so
opt/ssamtfe/Bin/libamp11lib.so
opt/ssamtfe/Bin/libShaders.so
"

QA_FLAGS_IGNORED="
opt/ssamtfe/Bin/libEntities.so
opt/ssamtfe/Bin/libGame.so
opt/ssamtfe/Bin/libamp11lib.so
opt/ssamtfe/Bin/libShaders.so
opt/ssamtfe/Bin/ssam_lnxded
opt/ssamtfe/Bin/ssam_lnxded.dynamic
opt/ssamtfe/Bin/ssam_lnx.dynamic
opt/ssamtfe/Bin/ssam_lnx
"

pkg_setup() {
	games_pkg_setup

	cdrom_get_cds "Install/1_00c.gro"
}

src_unpack() {
	mkdir Mods Levels
	unpack_makeself ssam-tfe-lnx-beta1a.run

	# Copy files during unpack as the patches below apply to some of them
	einfo "Copying from ${CDROM_ROOT}"
	cp -r "${CDROM_ROOT}/Install"/* . || die "copy from CD failed"

	nonfatal unpack ./SeriousSamPatch105_USA_linux.tar.bz2
	unpack ./setupstuff.tar.gz
	unpack ./bins.tar.bz2

	# We need only runscript from bin/ directory
	mv bin/${MY_PN} .
	rm -r bin
}

src_prepare() {
	# Apply the Icculus patches
	local v
	for v in 1b 2 3 ; do
		echo "Unpacking version ${v}"
		unpack_makeself "${MY_PN}-beta${v}.sh.bin"
		loki_patch patch.dat . || die "loki patch ${v} failed"
		rm patch.dat
	done

	# Remove unneeded files from Loki patches
	rm -r bin

	# Switch to dynamic executable - runs at sane speeds on modern hardware
	sed -i -e 's;exec "./ssam_lnx";exec "./ssam_lnx.dynamic";' ${MY_PN} \
		|| die "dynamic binary update failed"
}

src_install() {
	local dir=${GAMES_PREFIX_OPT}/${MY_PN}

	# Remove bundled libs
	rm Bin/{libogg,libvorbis,libvorbisfile}.so

	# Remove unneeded files
	rm *.{bin,bz2,cab,exe,ex_,ini,gz,sh}
	rm -r data setup* Players Temp

	# Install icon
	newicon ssam.xpm ${MY_PN}.xpm

	# Install documentation
	dodoc README*

	# Install all other files
	insinto "${dir}"
	doins -r *

	# Install executables and wrapper script
	exeinto "${dir}"
	doexe ${MY_PN}
	exeinto "${dir}"/Bin
	doexe Bin/ssam_lnx*

	games_make_wrapper ${MY_PN} ./${MY_PN} "${dir}" "${dir}"
	make_desktop_entry ${MY_PN} "Serious Sam - First Encounter" ${MY_PN}

	# Ensure that file datestamps from the CD are sane
	find "${D}/${dir}" -exec touch '{}' \;

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst

	elog "The warning regarding 'XiG-SUNDRY-NONSTANDARD missing' is harmless"
	echo
}