-# Copyright © 2011, 2015 Nick Bowler
-# License GPLv3+: GNU General Public License version 3 or later.
+# Copyright © 2011, 2015, 2021 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
-EAPI=5
+EAPI=7
-inherit games
+inherit desktop wrapper xdg-utils
MY_P=${PN}_${PV}-1
RESTRICT="fetch"
LICENSE="uplink"
-KEYWORDS="~amd64 ~x86"
+KEYWORDS="-* ~amd64 -x86" # needs libtiff.so.5 patch for x86
SLOT="0"
-DEPEND="dev-util/patchelf"
+BDEPEND="dev-util/patchelf
+ dev-util/xdelta:3"
RDEPEND="media-libs/libsdl[opengl]
media-libs/sdl-mixer[mikmod]
media-libs/freetype:2
- media-libs/tiff:3"
+ >=media-libs/tiff-4.0.9"
-src_unpack() {
+src_unpack () {
local root
unpack $A
mv "$root" "$P" || die
}
-src_compile() {
+src_prepare () {
+ local exe binpatches=(
+ # Adjust stack allocation size to work with libtiff.so.5
+ libtiff_compat
+ )
+
+ use amd64 && exe=uplink.bin.x86_64
+ use x86 && exe=uplink.bin.x86
+
+ for f in "${binpatches[@]}"; do
+ patch=$exe.$f.vcdiff
+ einfo "Applying $patch"
+ xdelta3 -fds "$exe" "$FILESDIR/$patch" "$exe" || die
+ done
+
+ default
+}
+
+src_compile () {
local useless_libs="libjpeg.so.62 libmikmod.so.2 libz.so.1"
local exe
test -n "$exe" || die "unsupported architecture"
for lib in $useless_libs; do
+ einfo "Removing unused library $lib"
patchelf --remove-needed "$lib" "$exe" || die
done
}
-src_install() {
- local dir=$GAMES_PREFIX_OPT/$PN
+src_install () {
+ local dir=/opt/uplink-$PV
local exe
insinto "$dir"
exeinto "$dir"
doexe "$exe"
- doicon uplink.png
+ doicon -s 32x32 uplink.png
make_desktop_entry "$PN" Uplink uplink
- games_make_wrapper "$PN" "$dir/$exe"
+ make_wrapper "$PN" "$dir/$exe"
dodoc *.txt
+}
+
+pkg_postinst () {
+ xdg_icon_cache_update
+}
- prepgamesdirs
+pkg_postrm () {
+ pkg_postinst
}