linux/hardened/patches/6.6: v6.6.73-hardened1 -> v6.6.75-hardened1
[NixPkgs.git] / pkgs / by-name / ru / runescape / package.nix
blob990466cb823233f11f47d1ffc049ffdee58b34bb
2   stdenv,
3   lib,
4   autoPatchelfHook,
5   buildFHSEnv,
6   cairo,
7   dpkg,
8   fetchurl,
9   gcc-unwrapped,
10   glib,
11   glibc,
12   gtk2-x11,
13   libGL,
14   libpulseaudio,
15   libSM,
16   libXxf86vm,
17   libX11,
18   openssl_1_1,
19   pango,
20   SDL2,
21   wrapGAppsHook3,
22   xdg-utils,
23   xorg,
24   xorg_sys_opengl,
25   zlib,
27 let
29   runescape = stdenv.mkDerivation rec {
30     pname = "runescape-launcher";
31     version = "2.2.10";
33     # Packages: https://content.runescape.com/downloads/ubuntu/dists/trusty/non-free/binary-amd64/Packages
34     # upstream is https://content.runescape.com/downloads/ubuntu/pool/non-free/r/${pname}/${pname}_${version}_amd64.deb
35     src = fetchurl {
36       url = "https://archive.org/download/${pname}_${version}_amd64/${pname}_${version}_amd64.deb";
37       sha256 = "1v96vjiblphhbqhpp3m7wbvdvcnp76ncdlf4pdcr2z1dz8nh6shg";
38     };
40     nativeBuildInputs = [
41       autoPatchelfHook
42       dpkg
43       wrapGAppsHook3
44     ];
46     buildInputs = [
47       cairo
48       gcc-unwrapped
49       glib
50       glibc
51       gtk2-x11
52       libSM
53       libXxf86vm
54       libX11
55       openssl_1_1
56       pango
57       zlib
58     ];
60     runtimeDependencies = [
61       libGL
62       libpulseaudio
63       SDL2
64       openssl_1_1
65       xdg-utils # The launcher uses `xdg-open` to open HTTP URLs in the user's browser
66       xorg_sys_opengl
67       zlib
68     ];
70     dontUnpack = true;
72     preBuild = ''
73       export DH_VERBOSE=1
74     '';
76     envVarsWithXmodifiers = ''
77       export MESA_GLSL_CACHE_DIR=~/Jagex
78       export GDK_SCALE=2
79       unset XMODIFIERS
80     '';
82     installPhase = ''
83       mkdir -p $out/bin $out/share
84       dpkg -x $src $out
86       patchShebangs $out/usr/bin/runescape-launcher
87       substituteInPlace $out/usr/bin/runescape-launcher \
88         --replace "unset XMODIFIERS" "$envVarsWithXmodifiers" \
89         --replace "/usr/share/games/runescape-launcher/runescape" "$out/share/games/runescape-launcher/runescape"
91       cp -r $out/usr/bin $out/
92       cp -r $out/usr/share $out/
94       rm -r $out/usr
95     '';
97     meta = with lib; {
98       description = "Launcher for RuneScape 3, the current main RuneScape";
99       homepage = "https://www.runescape.com/";
100       sourceProvenance = with sourceTypes; [ binaryNativeCode ];
101       license = licenses.unfree;
102       maintainers = with maintainers; [ grburst ];
103       platforms = [ "x86_64-linux" ];
104     };
105   };
110   * We can patch the runescape launcher, but it downloads a client at runtime and checks it for changes.
111   * For that we need use a buildFHSEnv.
112   * FHS simulates a classic linux shell
114 buildFHSEnv {
115   pname = "RuneScape";
116   inherit (runescape) version;
117   targetPkgs = pkgs: [
118     runescape
119     cairo
120     dpkg
121     gcc-unwrapped
122     glib
123     glibc
124     gtk2-x11
125     libGL
126     libpulseaudio
127     libSM
128     libXxf86vm
129     libX11
130     openssl_1_1
131     pango
132     SDL2
133     xdg-utils
134     xorg.libX11
135     xorg_sys_opengl
136     zlib
137   ];
138   multiPkgs = pkgs: [ libGL ];
139   runScript = "runescape-launcher";
140   extraInstallCommands = ''
141     mkdir -p "$out/share/applications"
142     cp ${runescape}/share/applications/runescape-launcher.desktop "$out/share/applications"
143     cp -r ${runescape}/share/icons "$out/share/icons"
144     substituteInPlace "$out/share/applications/runescape-launcher.desktop" \
145       --replace "/usr/bin/runescape-launcher" "RuneScape"
146   '';
148   meta = with lib; {
149     description = "RuneScape Game Client (NXT) - Launcher for RuneScape 3";
150     homepage = "https://www.runescape.com/";
151     license = licenses.unfree;
152     maintainers = with maintainers; [ grburst ];
153     platforms = [ "x86_64-linux" ];
154   };