1 { lib, stdenv, fetchurl, fetchpatch, cdrtools, m4, darwin }:
4 inherit (darwin.apple_sdk.frameworks) IOKit;
6 stdenv.mkDerivation rec {
7 pname = "dvd+rw-tools";
11 url = "http://fy.chalmers.se/~appro/linux/DVD+RW/tools/${pname}-${version}.tar.gz";
12 sha256 = "1jkjvvnjcyxpql97xjjx0kwvy70kxpiznr2zpjy2hhci5s10zmpq";
15 patches = [ ./darwin.patch ]
17 ++ builtins.map ({pfile, sha256}: fetchpatch {
18 url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/app-cdr/dvd+rw-tools/files/${pfile}?id=b510df361241e8f16314b1f14642305f0111dac6";
21 [{ pfile = "dvd+rw-tools-7.0-dvddl-r1.patch"; sha256 = "12l33jq6405shfwdycrj52qmd07h5bsp1vjaddknfri456azjny5"; }
22 { pfile = "dvd+rw-tools-7.0-glibc2.6.90.patch"; sha256 = "1fb3gap2in782pa4164h1w0ha8ggsq3inissa1k0zn2p2r3rb5ln"; }
23 { pfile = "dvd+rw-tools-7.0-reload.patch"; sha256 = "12v2y2y6ci5hh6lbmsk97dzgznrm4bxwhc81mq684ix0qspb9mq4"; }
24 { pfile = "dvd+rw-tools-7.0-sysmacros.patch"; sha256 = "1rkb26cyhfxklkmna3l9b4797f6gzlxyqqin44jwnq3jmwfrs6v0"; }
25 { pfile = "dvd+rw-tools-7.0-wctomb-r1.patch"; sha256 = "1xg770l0b4bjn30y7nqg619v4m5ickcn2n8hv9k2an6r191daq58"; }
26 { pfile = "dvd+rw-tools-7.0-wexit.patch"; sha256 = "0sqzlkm19fmjx4lzxkxwn2ymrj9fq0zk0jkys3xm6xvd2ibb6kxl"; }
27 { pfile = "dvd+rw-tools-7.1-bluray_pow_freespace.patch"; sha256 = "0iscz8fs5002ymk6wl2fz4x06b7bdnc57rfz8kbv3216acqi5rv3"; }
28 { pfile = "dvd+rw-tools-7.1-bluray_srm+pow.patch"; sha256 = "0sy40m12w987i6g0cyxv8cfmab4vp7cd222lv05apknfi2y7smmw"; }
29 { pfile = "dvd+rw-tools-7.1-lastshort.patch"; sha256 = "01wspv70sil20khkg5kj086b1x8rrig4yhcq9s88bdjd42nv0vpx"; }
30 { pfile = "dvd+rw-tools-7.1-noevent.patch"; sha256 = "1kbmxpg15wci33f2h6pxxvf3qm0kpyzx9wj5a3l67sk34hvza3z6"; }
33 nativeBuildInputs = [ m4 ];
34 buildInputs = [ cdrtools ]
35 ++ lib.optionals stdenv.isDarwin [ IOKit ];
38 "prefix=${placeholder "out"}"
39 "CC=${stdenv.cc.targetPrefix}cc"
40 "CXX=${stdenv.cc.targetPrefix}c++"
43 env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
44 # error: invalid suffix on literal; C++11 requires a space between literal and identifier
45 "-Wno-reserved-user-defined-literal"
46 # error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'IOByteCount' (aka 'unsigned int') in initializer list
47 "-Wno-c++11-narrowing"
51 homepage = "http://fy.chalmers.se/~appro/linux/DVD+RW/tools";
52 description = "Tools for mastering Blu-ray and DVD+-RW/+-R media";
53 platforms = platforms.unix;
54 license = with licenses; [ gpl2 publicDomain ];