linuxPackages_latest.broadcom_sta: add patch to compile on Kernel 6.12 (#359484)
[NixPkgs.git] / pkgs / by-name / x1 / x11vnc / package.nix
blob463daf17cc88aee2f3158c43453fb815028099ac
1 { lib, stdenv, fetchFromGitHub, fetchpatch,
2   openssl, zlib, libjpeg, xorg, coreutils, libvncserver,
3   autoreconfHook, pkg-config }:
5 stdenv.mkDerivation rec {
6   pname = "x11vnc";
7   version = "0.9.16";
9   src = fetchFromGitHub {
10     owner = "LibVNC";
11     repo = "x11vnc";
12     rev = version;
13     sha256 = "1g652mmi79pfq4p5p7spaswa164rpzjhc5rn2phy5pm71lm0vib1";
14   };
16   patches = [
17     (fetchpatch {
18       name = "CVE-2020-29074.patch";
19       url = "https://github.com/LibVNC/x11vnc/commit/69eeb9f7baa14ca03b16c9de821f9876def7a36a.patch";
20       sha256 = "0hdhp32g2i5m0ihmaxkxhsn3d5f2qasadvwpgxify4xnzabmyb2d";
21     })
23     # Pull upstream fix for -fno-common toolchains:
24     #   https://github.com/LibVNC/x11vnc/pull/121
25     (fetchpatch {
26       name = "fno-common.patch";
27       url = "https://github.com/LibVNC/x11vnc/commit/a48b0b1cd887d7f3ae67f525d7d334bd2feffe60.patch";
28       sha256 = "046gjsmg0vm0m4y9ny17y2jayc4ba7vib2whw71l5x1hjp6pksjs";
29     })
30   ];
32   nativeBuildInputs = [ autoreconfHook pkg-config ];
34   buildInputs =
35     [ xorg.libXfixes xorg.xorgproto openssl xorg.libXdamage
36       zlib xorg.libX11 libjpeg
37       xorg.libXtst xorg.libXinerama xorg.libXrandr
38       xorg.libXext
39       xorg.libXi xorg.libXrender
40       libvncserver
41     ];
43   postPatch = ''
44     substituteInPlace src/unixpw.c \
45         --replace '"/bin/su"' '"/run/wrappers/bin/su"' \
46         --replace '"/bin/true"' '"${coreutils}/bin/true"'
48     sed -i -e '/#!\/bin\/sh/a"PATH=${xorg.xdpyinfo}\/bin:${xorg.xauth}\/bin:$PATH\\n"' -e 's|/bin/su|/run/wrappers/bin/su|g' src/ssltools.h
50     # Xdummy script is currently broken, so we avoid building it. This removes everything Xdummy-related from the affected Makefile
51     sed -i -e '/^\tXdummy.c\ \\$/,$d' -e 's/\tx11vnc_loop\ \\/\tx11vnc_loop/' misc/Makefile.am
52   '';
54   meta = with lib; {
55     description = "VNC server connected to a real X11 screen";
56     homepage = "https://github.com/LibVNC/x11vnc/";
57     platforms = platforms.linux;
58     license = licenses.gpl2Plus;
59     maintainers = with maintainers; [ OPNA2608 ];
60     mainProgram = "x11vnc";
61   };