1{ stdenv, fetchurl, autoreconfHook,
2 gzip, bzip2, pkgconfig, flex, check,
3 pam, coreutils
4}:
5
6stdenv.mkDerivation rec {
7 name = "kbd-${version}";
8 version = "2.0.4";
9
10 src = fetchurl {
11 url = "mirror://kernel/linux/utils/kbd/${name}.tar.xz";
12 sha256 = "124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz";
13 };
14
15 configureFlags = [
16 "--enable-optional-progs"
17 "--enable-libkeymap"
18 "--disable-nls"
19 ];
20
21 patches = [ ./search-paths.patch ];
22
23 postPatch =
24 ''
25 # Add Neo keymap subdirectory
26 sed -i -e 's,^KEYMAPSUBDIRS *= *,&i386/neo ,' data/Makefile.am
27
28 # Fix the path to gzip/bzip2.
29 substituteInPlace src/libkeymap/findfile.c \
30 --replace gzip ${gzip}/bin/gzip \
31 --replace bzip2 ${bzip2.bin}/bin/bzip2 \
32
33 # We get a warning in armv5tel-linux and the fuloong2f, so we
34 # disable -Werror in it.
35 ${stdenv.lib.optionalString (stdenv.isArm || stdenv.hostPlatform.isMips) ''
36 sed -i s/-Werror// src/Makefile.am
37 ''}
38 '';
39
40 postInstall = ''
41 for i in $out/bin/unicode_{start,stop}; do
42 substituteInPlace "$i" \
43 --replace /usr/bin/tty ${coreutils}/bin/tty
44 done
45 '';
46
47
48 buildInputs = [ check pam ];
49 nativeBuildInputs = [ autoreconfHook pkgconfig flex ];
50
51 makeFlags = [ "setowner=" ];
52
53 meta = with stdenv.lib; {
54 homepage = ftp://ftp.altlinux.org/pub/people/legion/kbd/;
55 description = "Linux keyboard utilities and keyboard maps";
56 platforms = platforms.linux;
57 license = licenses.gpl2Plus;
58 };
59}