1{ lib, stdenv, fetchurl, m4, acl, libcap, Carbon, IOKit }:
2
3stdenv.mkDerivation rec {
4 pname = "cdrtools";
5 version = "3.02a09";
6
7 src = fetchurl {
8 url = "mirror://sourceforge/cdrtools/${pname}-${version}.tar.bz2";
9 sha256 = "10ayj48jax2pvsv6j5gybwfsx7b74zdjj84znwag7wwf8n7l6a5a";
10 };
11
12 nativeBuildInputs = [ m4 ];
13 buildInputs = if stdenv.isDarwin then [ Carbon IOKit ] else [ acl libcap ];
14
15 postPatch = ''
16 sed "/\.mk3/d" -i libschily/Targets.man
17 substituteInPlace man/Makefile --replace "man4" ""
18 substituteInPlace RULES/rules.prg --replace "/bin/" ""
19 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
20 ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-cc.rul
21 ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-clang.rul
22 ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-clang64.rul
23 '';
24
25 dontConfigure = true;
26
27 makeFlags = [ "GMAKE_NOWARN=true" "INS_BASE=/" "INS_RBASE=/" "DESTDIR=${placeholder "out"}" ];
28
29 enableParallelBuilding = false; # parallel building fails on some linux machines
30
31 meta = with lib; {
32 homepage = "https://cdrtools.sourceforge.net/private/cdrecord.html";
33 description = "Highly portable CD/DVD/BluRay command line recording software";
34 license = with licenses; [ cddl gpl2 lgpl21 ];
35 platforms = with platforms; linux ++ darwin;
36 # Licensing issues: This package contains code licensed under CDDL, GPL2
37 # and LGPL2. There is a debate regarding the legality of distributing this
38 # package in binary form.
39 hydraPlatforms = [];
40 };
41}