|
| 1 | +{ |
| 2 | + stdenv, |
| 3 | + lib, |
| 4 | + fetchurl, |
| 5 | + fetchpatch, |
| 6 | + ncurses, |
| 7 | +}: |
| 8 | +stdenv.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 | + '' |
| 31 | + # Fix compiler error that wants a string literal as format string for `wprintw` |
| 32 | + substituteInPlace sel_file.c \ |
| 33 | + --replace-fail 'wprintw(win, txt_aide_fs[foo]);' 'wprintw(win, "%s", txt_aide_fs[foo]);' |
| 34 | + '' |
| 35 | + + lib.optionalString stdenv.hostPlatform.isDarwin '' |
| 36 | + # Fix compiler error on Darwin: conflicting types for 'strdup' |
| 37 | + substituteInPlace sel_file.c \ |
| 38 | + --replace-fail 'char *strdup(char *);' ' ' |
| 39 | + ''; |
| 40 | + |
| 41 | + buildInputs = [ ncurses ]; |
| 42 | + |
| 43 | + preInstall = '' |
| 44 | + mkdir -p $out/bin/ |
| 45 | + ''; |
| 46 | + |
| 47 | + makeFlags = [ "PREFIX=$(out)" ]; |
| 48 | + |
| 49 | + meta = with lib; { |
| 50 | + description = "Visual hexadecimal difference editor"; |
| 51 | + homepage = "http://tboudet.free.fr/hexdiff/"; |
| 52 | + license = licenses.wtfpl; |
| 53 | + maintainers = with maintainers; [ erictapen ]; |
| 54 | + mainProgram = "hexdiff"; |
| 55 | + platforms = platforms.unix; |
| 56 | + }; |
| 57 | +} |
0 commit comments