1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 autoreconfHook,
7 makeWrapper,
8 pkg-config,
9 doxygen,
10 freetype,
11 libX11,
12 libftdi,
13 libusb-compat-0_1,
14 libusb1,
15 ncurses,
16 perl,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "lcdproc";
21 version = "0.5.9";
22
23 src = fetchFromGitHub {
24 owner = "lcdproc";
25 repo = "lcdproc";
26 rev = "v${version}";
27 sha256 = "1r885zv1gsh88j43x6fvzbdgfkh712a227d369h4fdcbnnfd0kpm";
28 };
29
30 patches = [
31 ./hardcode_mtab.patch
32
33 # Pull upstream fix for -fno-common toolchains:
34 # https://github.com/lcdproc/lcdproc/pull/148
35 (fetchpatch {
36 name = "fno-common.patch";
37 url = "https://github.com/lcdproc/lcdproc/commit/fda5302878692da933dc03cd011f8ddffefa07a4.patch";
38 sha256 = "0ld6p1r4rjsnjr63afw3lp5lx25jxjs07lsp9yc3q96r91r835cy";
39 })
40 ];
41
42 # we don't need to see the GPL every time we launch lcdd in the foreground
43 postPatch = ''
44 substituteInPlace server/main.c \
45 --replace 'output_GPL_notice();' '// output_GPL_notice();'
46 '';
47
48 configureFlags = [
49 "--enable-lcdproc-menus"
50 "--enable-drivers=all"
51 "--with-pidfile-dir=/run"
52 ];
53
54 buildInputs = [
55 freetype
56 libX11
57 libftdi
58 libusb-compat-0_1
59 libusb1
60 ncurses
61 ];
62
63 nativeBuildInputs = [
64 autoreconfHook
65 doxygen
66 makeWrapper
67 pkg-config
68 ];
69
70 # In 0.5.9: gcc: error: libbignum.a: No such file or directory
71 enableParallelBuilding = false;
72
73 postFixup = ''
74 for f in $out/bin/*.pl ; do
75 substituteInPlace $f \
76 --replace /usr/bin/perl ${lib.getBin perl}/bin/perl
77 done
78
79 # NixOS will not use this file anyway but at least we can now execute LCDd
80 substituteInPlace $out/etc/LCDd.conf \
81 --replace server/drivers/ $out/lib/lcdproc/
82 '';
83
84 meta = with lib; {
85 description = "Client/server suite for controlling a wide variety of LCD devices";
86 homepage = "https://lcdproc.org/";
87 license = licenses.gpl2Plus;
88 maintainers = with maintainers; [ peterhoeg ];
89 platforms = platforms.unix;
90 # never built on aarch64-darwin since first introduction in nixpkgs
91 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
92 };
93}