1{ stdenv
2, autoreconfHook
3, fetchFromGitLab
4, fetchpatch
5, fetchurl
6, fontconfig
7, freetype
8, gpm
9, lib
10, ncurses
11, pkg-config
12}:
13
14stdenv.mkDerivation rec {
15 version = "1.7-2";
16 pname = "fbterm";
17
18 src = fetchFromGitLab {
19 domain = "salsa.debian.org";
20 owner = "debian";
21 repo = pname;
22 rev = "debian/${version}";
23 hash = "sha256-vRUZgFpA1IkzkLzl7ImT+Yff5XqjFbUlkHmj/hd7XDE=";
24 };
25
26 nativeBuildInputs = [
27 autoreconfHook
28 pkg-config
29 ncurses
30 ];
31 buildInputs = [
32 gpm
33 freetype
34 fontconfig
35 ncurses
36 ];
37
38 makeFlags = [
39 "AR:=$(AR)"
40 ];
41
42 # preConfigure = ''
43 # sed -e '/ifdef SYS_signalfd/atypedef long long loff_t;' -i src/fbterm.cpp
44 # sed -e '/install-exec-hook:/,/^[^\t]/{d}; /.NOEXPORT/iinstall-exec-hook:\
45 # ' -i src/Makefile.in
46 # export HOME=$PWD;
47 # export NIX_LDFLAGS="$NIX_LDFLAGS -lfreetype"
48 # '';
49
50 preInstall = ''
51 export HOME=$PWD
52 '';
53
54 postInstall =
55 let
56 fbtermrc = fetchurl {
57 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbtermrc?h=fbterm";
58 hash = "sha256-zNIfi2ZjEGc5PLdOIirKGTXESb5Wm5XBAI1sfHa31LY=";
59 };
60 in
61 ''
62 mkdir -p "$out/share/terminfo"
63 tic -a -v2 -o"$out/share/terminfo" terminfo/fbterm
64
65 mkdir -p "$out/etc/fbterm"
66 cp "${fbtermrc}" "$out/etc/fbterm"
67 '';
68
69 # Patches from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=fbterm
70 patches = [
71 (fetchpatch {
72 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbconfig.patch?h=fbterm";
73 hash = "sha256-skCdUqyMkkqxS1YUI7cofsfnNNo3SL/qe4WEIXlhm/s=";
74 })
75 (fetchpatch {
76 url = "https://aur.archlinux.org/cgit/aur.git/plain/color_palette.patch?h=fbterm";
77 hash = "sha256-SkWxzfapyBTtMpTXkiFHRAw8/uXw7cAWwg5Q3TqWlk8=";
78 })
79 (fetchpatch {
80 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbterm.patch?h=fbterm";
81 hash = "sha256-XNHBTGQGeaQPip2XgcKlr123VDwils2pnyiGqkBGhzU=";
82 })
83 (fetchpatch {
84 url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Fix-build-with-gcc-6.patch?h=fbterm";
85 hash = "sha256-3d3zBvr5upICVVkd6tn63IhuB0sF67f62aKnf8KvOwg=";
86 })
87 (fetchpatch {
88 url = "https://aur.archlinux.org/cgit/aur.git/plain/fix_ftbfs_crosscompile.patch?h=fbterm";
89 hash = "sha256-jv/FSG6dHR0jKjPXQIfqsvpiT/XYzwv/VwuV+qUSovM=";
90 })
91 (fetchpatch {
92 url = "https://aur.archlinux.org/cgit/aur.git/plain/fix_ftbfs_epoll.patch?h=fbterm";
93 hash = "sha256-wkhfG0uY/5ZApcXTERkaKqz5IDpnilxUEcxull4645A=";
94 })
95 ];
96
97 meta = with lib; {
98 description = "Framebuffer terminal emulator";
99 homepage = "https://salsa.debian.org/debian/fbterm";
100 maintainers = with maintainers; [ lovesegfault raskin ];
101 license = licenses.gpl2;
102 platforms = platforms.linux;
103 };
104}