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