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 # preConfigure = ''
39 # sed -e '/ifdef SYS_signalfd/atypedef long long loff_t;' -i src/fbterm.cpp
40 # sed -e '/install-exec-hook:/,/^[^\t]/{d}; /.NOEXPORT/iinstall-exec-hook:\
41 # ' -i src/Makefile.in
42 # export HOME=$PWD;
43 # export NIX_LDFLAGS="$NIX_LDFLAGS -lfreetype"
44 # '';
45
46 preInstall = ''
47 export HOME=$PWD
48 '';
49
50 postInstall =
51 let
52 fbtermrc = fetchurl {
53 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbtermrc?h=fbterm";
54 hash = "sha256-zNIfi2ZjEGc5PLdOIirKGTXESb5Wm5XBAI1sfHa31LY=";
55 };
56 in
57 ''
58 mkdir -p "$out/share/terminfo"
59 tic -a -v2 -o"$out/share/terminfo" terminfo/fbterm
60
61 mkdir -p "$out/etc/fbterm"
62 cp "${fbtermrc}" "$out/etc/fbterm"
63 '';
64
65 # Patches from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=fbterm
66 patches = [
67 (fetchpatch {
68 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbconfig.patch?h=fbterm";
69 hash = "sha256-skCdUqyMkkqxS1YUI7cofsfnNNo3SL/qe4WEIXlhm/s=";
70 })
71 (fetchpatch {
72 url = "https://aur.archlinux.org/cgit/aur.git/plain/color_palette.patch?h=fbterm";
73 hash = "sha256-SkWxzfapyBTtMpTXkiFHRAw8/uXw7cAWwg5Q3TqWlk8=";
74 })
75 (fetchpatch {
76 url = "https://aur.archlinux.org/cgit/aur.git/plain/fbterm.patch?h=fbterm";
77 hash = "sha256-XNHBTGQGeaQPip2XgcKlr123VDwils2pnyiGqkBGhzU=";
78 })
79 (fetchpatch {
80 url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Fix-build-with-gcc-6.patch?h=fbterm";
81 hash = "sha256-3d3zBvr5upICVVkd6tn63IhuB0sF67f62aKnf8KvOwg=";
82 })
83 (fetchpatch {
84 url = "https://aur.archlinux.org/cgit/aur.git/plain/fix_ftbfs_crosscompile.patch?h=fbterm";
85 hash = "sha256-jv/FSG6dHR0jKjPXQIfqsvpiT/XYzwv/VwuV+qUSovM=";
86 })
87 (fetchpatch {
88 url = "https://aur.archlinux.org/cgit/aur.git/plain/fix_ftbfs_epoll.patch?h=fbterm";
89 hash = "sha256-wkhfG0uY/5ZApcXTERkaKqz5IDpnilxUEcxull4645A=";
90 })
91 ];
92
93 meta = with lib; {
94 description = "Framebuffer terminal emulator";
95 homepage = "https://salsa.debian.org/debian/fbterm";
96 maintainers = with maintainers; [ lovesegfault raskin ];
97 license = licenses.gpl2;
98 platforms = platforms.linux;
99 };
100}