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