summary refs log tree commit diff
path: root/pkgs/tools/cd-dvd/dvdisaster/default.nix
blob: 5a3828d801315100f33df095f3585868a6475218 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{ stdenv, fetchurl, pkgconfig, gettext, which
, glib, gtk2
, enableSoftening ? true
}:

stdenv.mkDerivation rec {
  pname = "dvdisaster";
  version = "0.79.5";

  src = fetchurl {
    url = "http://dvdisaster.net/downloads/${pname}-${version}.tar.bz2";
    sha256 = "0f8gjnia2fxcbmhl8b3qkr5b7idl8m855dw7xw2fnmbqwvcm6k4w";
  };

  nativeBuildInputs = [ gettext pkgconfig which ];
  buildInputs = [ glib gtk2 ];

  patches = stdenv.lib.optional enableSoftening [
    ./encryption.patch
    ./dvdrom.patch
  ];

  postPatch = ''
    patchShebangs ./
    sed -i 's/dvdisaster48.png/dvdisaster/' contrib/dvdisaster.desktop
    substituteInPlace scripts/bash-based-configure \
      --replace 'if (make -v | grep "GNU Make") > /dev/null 2>&1 ;' \
                'if make -v | grep "GNU Make" > /dev/null 2>&1 ;'
  '';

  configureFlags = [
    # Explicit --docdir= is required for on-line help to work:
    "--docdir=share/doc"
    "--with-nls=yes"
    "--with-embedded-src-path=no"
  ] ++ stdenv.lib.optional (stdenv.hostPlatform.isx86_64) "--with-sse2=yes";

  # fatal error: inlined-icons.h: No such file or directory
  enableParallelBuilding = false;

  doCheck = true;
  checkPhase = ''
    pushd regtest

    mkdir -p "$TMP"/{log,regtest}
    substituteInPlace common.bash \
      --replace /dev/shm "$TMP/log" \
      --replace /var/tmp "$TMP"

    for test in *.bash; do
      case "$test" in
      common.bash)
        echo "Skipping $test"
        continue ;;
      *)
        echo "Running $test"
        ./"$test"
      esac
    done

    popd
  '';

  postInstall = ''
    mkdir -pv $out/share/applications
    cp contrib/dvdisaster.desktop $out/share/applications/

    for size in 16 24 32 48 64; do
      mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps/
      cp contrib/dvdisaster"$size".png \
        $out/share/icons/hicolor/"$size"x"$size"/apps/dvdisaster.png
    done
  '';

  meta = with stdenv.lib; {
    homepage = "http://dvdisaster.net/";
    description = "Data loss/scratch/aging protection for CD/DVD media";
    longDescription = ''
      Dvdisaster provides a margin of safety against data loss on CD and
      DVD media caused by scratches or aging media. It creates error correction
      data which is used to recover unreadable sectors if the disc becomes
      damaged at a later time.
    '';
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ ];
  };
}