nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchpatch,
6 ncurses,
7}:
8stdenv.mkDerivation {
9 pname = "visual-hexdiff";
10 version = "0.0.53";
11
12 src = fetchurl {
13 url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53.orig.tar.gz";
14 hash = "sha256-M1bmkW63pHlfl9zNWEq0EGN1rpVGo+BTUKM9ot4HWqo=";
15 };
16
17 patches = [
18 # Some changes the debian/ubuntu developers made over the original source code
19 # See https://changelogs.ubuntu.com/changelogs/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4/changelog
20 (fetchpatch {
21 url = "mirror://ubuntu/pool/universe/h/hexdiff/hexdiff_0.0.53-0ubuntu4.diff.gz";
22 sha256 = "sha256-X5ONNp9jeACxsulyowDQJ6REX6bty6L4in0/+rq8Wz4=";
23 decode = "gunzip --stdout";
24 name = "hexdiff_0.0.53-0ubuntu4.diff";
25 stripLen = 1;
26 })
27 ];
28
29 postPatch = ''
30 # Fix compiler error that wants a string literal as format string for `wprintw`
31 substituteInPlace sel_file.c \
32 --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);'
33 ''
34 + lib.optionalString stdenv.hostPlatform.isDarwin ''
35 # Fix compiler error on Darwin: conflicting types for 'strdup'
36 substituteInPlace sel_file.c \
37 --replace-fail 'char *strdup(char *);' ' '
38 '';
39
40 buildInputs = [ ncurses ];
41
42 preInstall = ''
43 mkdir -p $out/bin/
44 '';
45
46 makeFlags = [ "PREFIX=$(out)" ];
47
48 meta = with lib; {
49 description = "Visual hexadecimal difference editor";
50 homepage = "http://tboudet.free.fr/hexdiff/";
51 license = licenses.wtfpl;
52 maintainers = with maintainers; [ erictapen ];
53 mainProgram = "hexdiff";
54 platforms = platforms.unix;
55 };
56}