lol
1{ lib, stdenv, fetchFromGitHub, automake, autoconf, libtool, flex, bison, texinfo, fetchpatch, pkgsStatic
2, withNcurses ? true, ncurses
3}:
4
5stdenv.mkDerivation rec {
6 pname = "gpm";
7 version = "unstable-2020-06-17";
8
9 src = fetchFromGitHub {
10 owner = "telmich";
11 repo = "gpm";
12 rev = "e82d1a653ca94aa4ed12441424da6ce780b1e530";
13 sha256 = "0ndn6dwc87slvyqp2cnbb02a6hkjwb6zjhs6viysykv06hq7ihy6";
14 };
15
16 postPatch = ''
17 substituteInPlace src/prog/gpm-root.y --replace __sigemptyset sigemptyset
18 '';
19
20 nativeBuildInputs = [ automake autoconf libtool flex bison texinfo ];
21 buildInputs = [ ncurses ];
22
23 hardeningDisable = [ "format" ];
24
25 patches = [
26 (fetchpatch { # pull request telmich/gpm#42
27 url = "https://github.com/kaction/gpm/commit/217b4fe4c9b62298a4e9a54c1f07e3b52b013a09.patch";
28 sha256 = "1f74h12iph4z1dldbxk9imcq11805c3ai2xhbsqvx8jpjrcfp19q";
29 })
30
31 # Pull fix pending upstream inclusion to fix parallel installation:
32 # https://github.com/telmich/gpm/pull/43
33 (fetchpatch {
34 name = "parallel-install.patch";
35 url = "https://github.com/telmich/gpm/commit/a88fb82a7afe96e872bb31c554e9ad5888f5a451.patch";
36 sha256 = "0g1jhz9bjw7vqjv922xkhs8xkjxdqh11nj38jj3c8nv5lcil76nx";
37 })
38 ];
39 preConfigure = ''
40 ./autogen.sh
41 '';
42
43 configureFlags = [
44 "--sysconfdir=/etc"
45 "--localstatedir=/var"
46 (if withNcurses then "--with-curses" else "--without-curses")
47 ];
48
49 enableParallelBuilding = true;
50
51 # Provide libgpm.so for compatability
52 postInstall = ''
53 ln -sv $out/lib/libgpm.so.2 $out/lib/libgpm.so
54 '';
55
56 passthru.tests.static = pkgsStatic.gpm;
57
58 meta = with lib; {
59 homepage = "https://www.nico.schottelius.org/software/gpm/";
60 description = "A daemon that provides mouse support on the Linux console";
61 license = licenses.gpl2;
62 platforms = platforms.linux ++ platforms.cygwin;
63 maintainers = with maintainers; [ eelco ];
64 };
65}