2021-07-07 18:20:27 +02:00
# Copyright 1999-2021 Gentoo Authors
2020-05-16 21:33:10 +02:00
# Distributed under the terms of the GNU General Public License v2
2024-03-31 17:18:18 +02:00
EAPI = 8
2020-10-25 08:38:55 +01:00
inherit flag-o-matic unpacker desktop wrapper
2020-05-16 21:33:10 +02:00
# Latest versions are in http://icculus.org/twilight/darkplaces/files/
MY_PV = " ${ PV /_beta/beta } "
2024-03-02 11:20:58 +01:00
MY_SOURCE = " ${ PN } enginesource ${ MY_PV } .tar.gz "
2020-05-16 21:33:10 +02:00
# Different Quake 1 engines expect the lights in different directories
# http://www.fuhquake.net/download.html and http://www.kgbsyndicate.com/romi/
MY_LIGHTS = "fuhquake-lits.rar"
DESCRIPTION = "Enhanced engine for iD Software's Quake 1"
HOMEPAGE = "http://icculus.org/twilight/darkplaces/"
2024-03-02 11:20:58 +01:00
GIT_COMMIT = "95ed24831ca8dcbf6ae8f886733c35ce2ad83272"
SRC_URI = " https://github.com/DarkPlacesEngine/darkplaces/archive/ ${ GIT_COMMIT } .tar.gz -> " ${ MY_SOURCE } "
2020-05-16 21:33:10 +02:00
lights? (
http://www.fuhquake.net/files/extras/${ MY_LIGHTS }
http://www.kgbsyndicate.com/romi/id1.pk3 ) "
LICENSE = "GPL-2"
SLOT = "0"
KEYWORDS = "~amd64 ~x86"
2024-03-31 17:18:18 +02:00
IUSE = "capture cdinstall cpu_flags_x86_sse debug dedicated demo ipv6 lights sdl textures"
REQUIRED_USE = "
amd64? ( cpu_flags_x86_sse )
"
2020-05-16 21:33:10 +02:00
2024-03-02 11:20:58 +01:00
SDL_RDEPEND = "
media-libs/libsdl2[ udev]
2020-05-16 21:33:10 +02:00
x11-libs/libX11
2024-03-31 17:18:18 +02:00
media-libs/libogg
media-libs/libtheora
media-libs/libvorbis
media-libs/libxmp
2020-05-16 21:33:10 +02:00
"
RDEPEND = "
2024-03-02 11:20:58 +01:00
dev-libs/d0_blind_id
dev-games/ode
2020-05-16 21:33:10 +02:00
net-misc/curl
2024-03-02 11:20:58 +01:00
virtual/jpeg:0
sys-libs/zlib
media-libs/libpng
2020-05-16 21:33:10 +02:00
cdinstall? ( games-fps/quake1-data )
demo? ( games-fps/quake1-demodata )
textures? ( >= games-fps/quake1-textures-20050820 )
2024-03-02 11:20:58 +01:00
sdl? ( ${ SDL_RDEPEND } )
2020-05-16 21:33:10 +02:00
"
2024-03-02 11:20:58 +01:00
BDEPEND = " lights? (
app-arch/unrar
app-arch/unzip
)
app-alternatives/tar
app-alternatives/gzip
sys-apps/coreutils
sys-apps/sed
2020-05-16 21:33:10 +02:00
virtual/pkgconfig
"
2024-03-02 11:20:58 +01:00
S = " ${ WORKDIR } "
2020-05-16 21:33:10 +02:00
dir = "/usr/share/quake1"
src_unpack( ) {
if use lights ; then
2024-03-02 11:20:58 +01:00
elog "FuhQuake lights: enabled"
2020-05-16 21:33:10 +02:00
unpack " ${ MY_LIGHTS } "
unpack_zip " ${ DISTDIR } " /id1.pk3
mv *.lit maps/ || die
mv ReadMe.txt rtlights.txt
2024-03-02 11:20:58 +01:00
else
elog "FuhQuake lights: disabled"
2020-05-16 21:33:10 +02:00
fi
2024-03-02 11:20:58 +01:00
tar --strip-components 1 -xf " ${ DISTDIR } / ${ MY_SOURCE } "
2020-05-16 21:33:10 +02:00
}
src_prepare( ) {
default
cd " ${ S } "
rm mingw_note.txt
strip-flags
2024-03-31 17:18:18 +02:00
patch -p1 -i " ${ FILESDIR } /0020-make-sse-selectable.patch "
patch -p1 -i " ${ FILESDIR } /0030-builddate-template.patch " || die
sed -i " s/%{PVR}/ ${ PVR } / " builddate.c || die
2020-05-16 21:33:10 +02:00
# Only additional CFLAGS optimization is the -march flag
local march = $( get-flag -march)
sed -i \
-e " s:-lasound: $( pkg-config --libs alsa) : " \
-e "/^CPUOPTIMIZATIONS/d" \
-e '/^OPTIM_RELEASE/s/=.*/=$(CFLAGS)/' \
-e '/^OPTIM_DEBUG/s/=.*/=$(CFLAGS)/' \
-e '/^LDFLAGS_DEBUG/s/$/ $(LDFLAGS)/' \
-e '/^LDFLAGS_RELEASE/s/$/ $(LDFLAGS)/' \
-e "s:strip:true:" \
makefile.inc || die
2024-03-02 11:20:58 +01:00
if ! use ipv6; then
elog "IPv6 support: disabled"
sed -i 's/^#\(CFLAGS_NET+=-DNOSUPPORTIPV6\)$/\1/' makefile || die
else
elog "IPv6 support: enabled"
2020-05-16 21:33:10 +02:00
fi
}
src_compile( ) {
2024-03-02 11:20:58 +01:00
local video_capture = "disabled"
if use capture; then
elog "Video capture: enabled"
video_capture = "enabled"
else
elog "Video capture: disabled"
fi
2024-03-31 17:18:18 +02:00
local sse_enabled = 0
if use cpu_flags_x86_sse; then
elog "Skeletal animations: uses SSE"
sse_enabled = 1
else
if use amd64; then
elog "Skeletal animations: uses SSE, not disabling on AMD64"
sse_enabled = 1
else
elog "Skeletal animations: uses generic code"
fi
fi
2024-03-02 11:20:58 +01:00
local opts = " DP_FS_BASEDIR=\" ${ dir } \" \
DP_LINK_JPEG = shared \
DP_LINK_CRYPTO = shared \
DP_LINK_CRYPTO_RIJNDAEL = shared \
DP_LINK_ZLIB = shared \
DP_LINK_ODE = shared \
DP_VIDEO_CAPTURE = ${ video_capture } \
2024-03-31 17:18:18 +02:00
DP_PRELOAD_DEPENDENCIES = 1 \
GENTOO_BUILD = 1 \
DP_SSE = ${ sse_enabled } "
2020-05-16 21:33:10 +02:00
local type = "release"
2024-03-02 11:20:58 +01:00
if use debug; then
type = "debug"
fi
if use sdl; then
2020-05-16 21:33:10 +02:00
emake ${ opts } " sdl- ${ type } "
fi
2024-03-02 11:20:58 +01:00
if use dedicated; then
2020-05-16 21:33:10 +02:00
emake ${ opts } " sv- ${ type } "
fi
}
src_install( ) {
2024-03-02 11:20:58 +01:00
if use sdl; then
local type = sdl
2020-05-16 21:33:10 +02:00
# darkplaces executable is needed, even just for demo
newbin " ${ PN } - ${ type } " ${ PN }
newicon darkplaces72x72.png ${ PN } .png
2024-03-02 11:20:58 +01:00
if use demo; then
2020-05-16 21:33:10 +02:00
# Install command-line for demo, even if not desktop entry
make_wrapper ${ PN } -demo " ${ PN } -game demo "
fi
2024-03-02 11:20:58 +01:00
if use demo && ! use cdinstall; then
2020-05-16 21:33:10 +02:00
make_desktop_entry ${ PN } -demo "Dark Places (Demo)"
else
# Full version takes precedence over demo
make_desktop_entry ${ PN } "Dark Places"
fi
fi
2024-03-02 11:20:58 +01:00
if use dedicated; then
2020-05-16 21:33:10 +02:00
newbin ${ PN } -dedicated ${ PN } -ded
fi
2024-03-02 11:20:58 +01:00
dodoc *.txt todo " ${ WORKDIR } " /*.txt
if use lights; then
2020-05-16 21:33:10 +02:00
insinto " ${ dir } " /id1
doins -r " ${ WORKDIR } " /{ cubemaps,maps}
if use demo ; then
# Set up symlinks, for the demo levels to include the lights
local d
for d in cubemaps maps ; do
dosym " ${ dir } /id1/ ${ d } " " ${ dir } /demo/ ${ d } "
done
fi
fi
}
pkg_postinst( ) {
if ! use cdinstall && ! use demo ; then
2024-03-31 17:18:18 +02:00
elog " Remember to place pak0.pak and pak1.pak in ${ dir } /id1 "
if use cdda; then
elog " If you wish to have the original soundtrack available without playing from an optical drive, please make sure that the path ${ dir } /id1/sound/cdtracks exists, and that it contains the original soundtrack. The expected filename schema is track%i.%s with a double-digit count, either in WAV RIFF or OGG Vorbis format. "
fi
2020-05-16 21:33:10 +02:00
fi
}