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