1{ lib
2, stdenv
3, fetchFromGitHub
4, autoreconfHook
5, imlib2
6, xorg
7, ncurses
8, pkg-config
9, zlib
10, x11Support ? !stdenv.isDarwin
11}:
12
13stdenv.mkDerivation rec {
14 pname = "libcaca";
15 version = "0.99.beta20";
16
17 src = fetchFromGitHub {
18 owner = "cacalabs";
19 repo = pname;
20 rev = "v${version}";
21 hash = "sha256-N0Lfi0d4kjxirEbIjdeearYWvStkKMyV6lgeyNKXcVw=";
22 };
23
24 nativeBuildInputs = [
25 autoreconfHook
26 pkg-config
27 ];
28
29 buildInputs = [
30 ncurses
31 zlib
32 (imlib2.override { inherit x11Support; })
33 ] ++ lib.optionals x11Support [
34 xorg.libX11
35 xorg.libXext
36 ];
37
38 outputs = [ "bin" "dev" "out" "man" ];
39
40 configureFlags = [
41 (if x11Support then "--enable-x11" else "--disable-x11")
42 ];
43
44 env.NIX_CFLAGS_COMPILE = lib.optionalString (!x11Support) "-DX_DISPLAY_MISSING";
45
46 postInstall = ''
47 mkdir -p $dev/bin
48 mv $bin/bin/caca-config $dev/bin/caca-config
49 '';
50
51 meta = with lib; {
52 homepage = "http://caca.zoy.org/wiki/libcaca";
53 description = "A graphics library that outputs text instead of pixels";
54 longDescription = ''
55 libcaca is a graphics library that outputs text instead of pixels, so that
56 it can work on older video cards or text terminals. It is not unlike the
57 famous AAlib library, with the following improvements:
58
59 - Unicode support
60 - 2048 available colours (some devices can only handle 16)
61 - dithering of colour images
62 - advanced text canvas operations (blitting, rotations)
63
64 Libcaca works in a text terminal (and should thus work on all Unix systems
65 including Mac OS X) using the S-Lang or ncurses libraries. It also works
66 natively on DOS and Windows.
67
68 Libcaca was written by Sam Hocevar and Jean-Yves Lamoureux.
69 '';
70 license = licenses.wtfpl;
71 maintainers = with maintainers; [ AndersonTorres ];
72 platforms = platforms.unix;
73 };
74}