btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / cd / cdrkit / package.nix
blob7aa400e51f07dd2c1a77a5703755090cecb4f8d2
1 {lib, stdenv, fetchurl, cmake, libcap, zlib, bzip2, perl}:
3 stdenv.mkDerivation rec {
4   pname = "cdrkit";
5   version = "1.1.11";
7   src = fetchurl {
8     url = "http://cdrkit.org/releases/cdrkit-${version}.tar.gz";
9     sha256 = "1nj7iv3xrq600i37na9a5idd718piiiqbs4zxvpjs66cdrsk1h6i";
10   };
12   nativeBuildInputs = [ cmake ];
13   buildInputs = [ zlib bzip2 perl ] ++
14     lib.optionals stdenv.hostPlatform.isLinux [ libcap ];
16   hardeningDisable = [ "format" ];
17   env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.hostPlatform.isMusl [
18     "-D__THROW="
19   ] ++ lib.optionals stdenv.cc.isClang [
20     "-Wno-error=int-conversion"
21     "-Wno-error=implicit-function-declaration"
22   ]);
24   # efi-boot-patch extracted from http://arm.koji.fedoraproject.org/koji/rpminfo?rpmID=174244
25   patches = [ ./include-path.patch ./cdrkit-1.1.9-efi-boot.patch ./cdrkit-1.1.11-fno-common.patch ];
27   postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
28     substituteInPlace libusal/scsi-mac-iokit.c \
29       --replace "IOKit/scsi-commands/SCSITaskLib.h" "IOKit/scsi/SCSITaskLib.h"
30     substituteInPlace genisoimage/sha256.c \
31       --replace "<endian.h>" "<machine/endian.h>"
32     substituteInPlace genisoimage/sha512.c \
33       --replace "<endian.h>" "<machine/endian.h>"
34     substituteInPlace genisoimage/sha256.h \
35       --replace "__THROW" ""
36     substituteInPlace genisoimage/sha512.h \
37       --replace "__THROW" ""
38   '';
40   preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
41     substituteInPlace include/xconfig.h.in \
42         --replace "#define HAVE_RCMD 1" "#undef HAVE_RCMD"
43   '';
45   postConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
46     substituteInPlace  */CMakeFiles/*.dir/link.txt \
47       --replace-warn "-lrt" "-framework IOKit -framework CoreFoundation"
48   '';
50   postInstall = ''
51     # file name compatibility with the old cdrecord (growisofs wants this name)
52     ln -s $out/bin/genisoimage $out/bin/mkisofs
53     ln -s $out/bin/wodim $out/bin/cdrecord
54   '';
56   cmakeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "-DBITFIELDS_HTOL=0" ];
58   makeFlags = [ "PREFIX=\$(out)" ];
60   meta = {
61     description = "Portable command-line CD/DVD recorder software, mostly compatible with cdrtools";
63     longDescription = ''
64       Cdrkit is a suite of programs for recording CDs and DVDs,
65       blanking CD-RW media, creating ISO-9660 filesystem images,
66       extracting audio CD data, and more.  The programs included in
67       the cdrkit package were originally derived from several sources,
68       most notably mkisofs by Eric Youngdale and others, cdda2wav by
69       Heiko Eissfeldt, and cdrecord by Jörg Schilling.  However,
70       cdrkit is not affiliated with any of these authors; it is now an
71       independent project.
72     '';
74     homepage = "http://cdrkit.org/";
75     license = lib.licenses.gpl2Plus;
76     platforms = lib.platforms.unix;
77   };