nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 fetchurl,
4 autoconf,
5 automake,
6 pkg-config,
7 replaceVars,
8 lib,
9 perl,
10 flex,
11 bison,
12 readline,
13 libexif,
14 bash,
15 buildPackages,
16 # SDL depends on Qt, which doesn't cross-compile
17 x11Support ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform),
18 SDL,
19 svgSupport ? true,
20 inkscape,
21 asciiArtSupport ? true,
22 aalib,
23 gifSupport ? true,
24 giflib,
25 tiffSupport ? true,
26 libtiff,
27 jpegSupport ? true,
28 libjpeg,
29 pngSupport ? true,
30 libpng,
31}:
32
33stdenv.mkDerivation rec {
34 pname = "fim";
35 version = "0.7";
36
37 src = fetchurl {
38 url = "mirror://savannah/fbi-improved/${pname}-${version}-trunk.tar.gz";
39 sha256 = "sha256-/p7bjeZM46DJOQ9sgtebhkNpBPj2RJYY3dMXhzHnNmg=";
40 };
41
42 patches = [
43 # build tools with a build compiler
44 (replaceVars ./native-tools.patch {
45 cc_for_build = lib.getExe buildPackages.stdenv.cc;
46 # patch context
47 FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE = null;
48 HAVE_RUNNABLE_TESTS_TRUE = null;
49 })
50 ];
51
52 postPatch = ''
53 patchShebangs --build doc/vim2html.pl
54 '';
55
56 nativeBuildInputs = [
57 autoconf
58 automake
59 bison
60 flex
61 perl
62 pkg-config
63 ];
64
65 buildInputs = [
66 flex
67 readline
68 libexif
69 bash
70 ]
71 ++ lib.optional x11Support SDL
72 ++ lib.optional svgSupport inkscape
73 ++ lib.optional asciiArtSupport aalib
74 ++ lib.optional gifSupport giflib
75 ++ lib.optional tiffSupport libtiff
76 ++ lib.optional jpegSupport libjpeg
77 ++ lib.optional pngSupport libpng;
78
79 configureFlags = [
80 # mmap works on all relevant platforms
81 "ac_cv_func_mmap_fixed_mapped=yes"
82 # system regexp works on all relevant platforms
83 "fim_cv_regex_broken=no"
84 ];
85
86 env.LIBAA_CONFIG = lib.getExe' (lib.getDev aalib) "aalib-config";
87 env.LIBPNG_CONFIG = lib.getExe' (lib.getDev libpng) "libpng-config";
88 env.NIX_CFLAGS_COMPILE = lib.optionalString x11Support "-lSDL";
89
90 meta = {
91 description = "Lightweight, highly customizable and scriptable image viewer";
92 longDescription = ''
93 FIM (Fbi IMproved) is a lightweight, console based image viewer that aims
94 to be a highly customizable and scriptable for users who are comfortable
95 with software like the VIM text editor or the Mutt mail user agent.
96 '';
97 homepage = "https://www.nongnu.org/fbi-improved/";
98 license = lib.licenses.gpl2Plus;
99 platforms = lib.platforms.linux;
100 maintainers = [ ];
101 };
102}