2024-05-04 14:16:34 +02:00
# Copyright 1999-2024 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
# 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"
2024-03-31 17:59:24 +02:00
HOMEPAGE = "https://icculus.org/twilight/darkplaces/"
2024-03-02 11:20:58 +01:00
GIT_COMMIT = "95ed24831ca8dcbf6ae8f886733c35ce2ad83272"
2024-03-31 17:59:24 +02:00
MY_SOURCE = " ${ PN } enginesource- ${ GIT_COMMIT } .tar.gz "
2024-03-02 11:20:58 +01:00
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"
2024-05-04 14:16:34 +02:00
KEYWORDS = "~amd64 ~arm64 ~x86"
IUSE = "capture cpu_flags_x86_sse debug dedicated demo ipv6 lights sdl textures"
2024-03-31 17:18:18 +02:00
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-04-01 09:52:44 +02:00
media-libs/libjpeg-turbo
2024-03-02 11:20:58 +01:00
sys-libs/zlib
media-libs/libpng
2020-05-16 21:33:10 +02:00
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
2024-05-04 14:16:34 +02:00
# Install command-line for demo
2020-05-16 21:33:10 +02:00
make_wrapper ${ PN } -demo " ${ PN } -game demo "
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( ) {
2024-05-04 14:16:34 +02:00
if ! 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
}