]> git.draconx.ca Git - gentoo-draconx.git/blobdiff - games-strategy/uplink/uplink-1.6-r3.ebuild
games-strategy/uplink: Fixup tiff dependencies.
[gentoo-draconx.git] / games-strategy / uplink / uplink-1.6-r3.ebuild
diff --git a/games-strategy/uplink/uplink-1.6-r3.ebuild b/games-strategy/uplink/uplink-1.6-r3.ebuild
new file mode 100644 (file)
index 0000000..40ef3e2
--- /dev/null
@@ -0,0 +1,103 @@
+# Copyright © 2011, 2015, 2021, 2023 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=7
+
+inherit desktop wrapper xdg-utils
+
+MY_P=${PN}_${PV}-1
+
+DESCRIPTION="Crack into virtual computer systems"
+HOMEPAGE="http://www.uplink.co.uk"
+SRC_URI="amd64? ( ${MY_P}_amd64.tar.gz )
+       x86? ( ${MY_P}_i386.tar.gz )"
+RESTRICT="fetch"
+
+LICENSE="uplink"
+KEYWORDS="-* ~amd64 -x86" # needs libtiff.so.5 patch for x86
+SLOT="0"
+
+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-compat:4
+               ( >=media-libs/tiff-4.0.9:0 <media-libs/tiff-4.5:0 )
+       )"
+
+src_unpack () {
+       local root
+
+       unpack $A
+
+       use amd64 && root=uplink-x64
+       use x86 && root=uplink-x86
+       test -n "$root" || die "unsupported architecture"
+
+       mv "$root" "$P" || die
+}
+
+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
+
+       use amd64 && exe=uplink.bin.x86_64
+       use x86 && exe=uplink.bin.x86
+       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=/opt/uplink-$PV
+       local exe
+
+       insinto "$dir"
+       doins *.dat
+
+       use amd64 && exe=uplink.bin.x86_64
+       use x86 && exe=uplink.bin.x86
+       test -n "$exe" || die "unsupported architecture"
+
+       exeinto "$dir"
+       doexe "$exe"
+
+       doicon -s 32x32 uplink.png
+       make_desktop_entry "$PN" Uplink uplink
+       make_wrapper "$PN" "$dir/$exe"
+
+       dodoc *.txt
+}
+
+pkg_postinst () {
+       xdg_icon_cache_update
+}
+
+pkg_postrm () {
+       pkg_postinst
+}