]> git.draconx.ca Git - gentoo-draconx.git/blob - games-strategy/uplink/uplink-1.6-r2.ebuild
games-strategy/uplink: Update to work with latest gentoo repo.
[gentoo-draconx.git] / games-strategy / uplink / uplink-1.6-r2.ebuild
1 # Copyright © 2011, 2015, 2021 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         >=media-libs/tiff-4.0.9"
28
29 src_unpack () {
30         local root
31
32         unpack $A
33
34         use amd64 && root=uplink-x64
35         use x86 && root=uplink-x86
36         test -n "$root" || die "unsupported architecture"
37
38         mv "$root" "$P" || die
39 }
40
41 src_prepare () {
42         local exe binpatches=(
43                 # Adjust stack allocation size to work with libtiff.so.5
44                 libtiff_compat
45         )
46
47         use amd64 && exe=uplink.bin.x86_64
48         use x86 && exe=uplink.bin.x86
49
50         for f in "${binpatches[@]}"; do
51                 patch=$exe.$f.vcdiff
52                 einfo "Applying $patch"
53                 xdelta3 -fds "$exe" "$FILESDIR/$patch" "$exe" || die
54         done
55
56         default
57 }
58
59 src_compile () {
60         local useless_libs="libjpeg.so.62 libmikmod.so.2 libz.so.1"
61         local exe
62
63         use amd64 && exe=uplink.bin.x86_64
64         use x86 && exe=uplink.bin.x86
65         test -n "$exe" || die "unsupported architecture"
66
67         for lib in $useless_libs; do
68                 einfo "Removing unused library $lib"
69                 patchelf --remove-needed "$lib" "$exe" || die
70         done
71 }
72
73 src_install () {
74         local dir=/opt/uplink-$PV
75         local exe
76
77         insinto "$dir"
78         doins *.dat
79
80         use amd64 && exe=uplink.bin.x86_64
81         use x86 && exe=uplink.bin.x86
82         test -n "$exe" || die "unsupported architecture"
83
84         exeinto "$dir"
85         doexe "$exe"
86
87         doicon -s 32x32 uplink.png
88         make_desktop_entry "$PN" Uplink uplink
89         make_wrapper "$PN" "$dir/$exe"
90
91         dodoc *.txt
92 }
93
94 pkg_postinst () {
95         xdg_icon_cache_update
96 }
97
98 pkg_postrm () {
99         pkg_postinst
100 }