]> git.draconx.ca Git - gentoo-draconx.git/blob - 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
1 # Copyright © 2011, 2015, 2021, 2023 Nick Bowler
2 # License GPLv3+: GNU General Public License version 3 or any later version.
3 # This is free software: you are free to change and redistribute it.
4 # There is NO WARRANTY, to the extent permitted by law.
5
6 EAPI=7
7
8 inherit desktop wrapper xdg-utils
9
10 MY_P=${PN}_${PV}-1
11
12 DESCRIPTION="Crack into virtual computer systems"
13 HOMEPAGE="http://www.uplink.co.uk"
14 SRC_URI="amd64? ( ${MY_P}_amd64.tar.gz )
15         x86? ( ${MY_P}_i386.tar.gz )"
16 RESTRICT="fetch"
17
18 LICENSE="uplink"
19 KEYWORDS="-* ~amd64 -x86" # needs libtiff.so.5 patch for x86
20 SLOT="0"
21
22 BDEPEND="dev-util/patchelf
23         dev-util/xdelta:3"
24 RDEPEND="media-libs/libsdl[opengl]
25         media-libs/sdl-mixer[mikmod]
26         media-libs/freetype:2
27         || (
28                 media-libs/tiff-compat:4
29                 ( >=media-libs/tiff-4.0.9:0 <media-libs/tiff-4.5:0 )
30         )"
31
32 src_unpack () {
33         local root
34
35         unpack $A
36
37         use amd64 && root=uplink-x64
38         use x86 && root=uplink-x86
39         test -n "$root" || die "unsupported architecture"
40
41         mv "$root" "$P" || die
42 }
43
44 src_prepare () {
45         local exe binpatches=(
46                 # Adjust stack allocation size to work with libtiff.so.5
47                 libtiff_compat
48         )
49
50         use amd64 && exe=uplink.bin.x86_64
51         use x86 && exe=uplink.bin.x86
52
53         for f in "${binpatches[@]}"; do
54                 patch=$exe.$f.vcdiff
55                 einfo "Applying $patch"
56                 xdelta3 -fds "$exe" "$FILESDIR/$patch" "$exe" || die
57         done
58
59         default
60 }
61
62 src_compile () {
63         local useless_libs="libjpeg.so.62 libmikmod.so.2 libz.so.1"
64         local exe
65
66         use amd64 && exe=uplink.bin.x86_64
67         use x86 && exe=uplink.bin.x86
68         test -n "$exe" || die "unsupported architecture"
69
70         for lib in $useless_libs; do
71                 einfo "Removing unused library $lib"
72                 patchelf --remove-needed "$lib" "$exe" || die
73         done
74 }
75
76 src_install () {
77         local dir=/opt/uplink-$PV
78         local exe
79
80         insinto "$dir"
81         doins *.dat
82
83         use amd64 && exe=uplink.bin.x86_64
84         use x86 && exe=uplink.bin.x86
85         test -n "$exe" || die "unsupported architecture"
86
87         exeinto "$dir"
88         doexe "$exe"
89
90         doicon -s 32x32 uplink.png
91         make_desktop_entry "$PN" Uplink uplink
92         make_wrapper "$PN" "$dir/$exe"
93
94         dodoc *.txt
95 }
96
97 pkg_postinst () {
98         xdg_icon_cache_update
99 }
100
101 pkg_postrm () {
102         pkg_postinst
103 }