nixpkgs/pkgs/tools/cd-dvd/cdrtools/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

45 lines
1.6 KiB
Nix

{ lib, stdenv, fetchurl, m4, acl, libcap, Carbon, IOKit }:
stdenv.mkDerivation rec {
pname = "cdrtools";
version = "3.02a09";
src = fetchurl {
url = "mirror://sourceforge/cdrtools/${pname}-${version}.tar.bz2";
sha256 = "10ayj48jax2pvsv6j5gybwfsx7b74zdjj84znwag7wwf8n7l6a5a";
};
nativeBuildInputs = [ m4 ];
buildInputs = if stdenv.hostPlatform.isDarwin then [ Carbon IOKit ] else [ acl libcap ];
postPatch = ''
sed "/\.mk3/d" -i libschily/Targets.man
substituteInPlace man/Makefile --replace "man4" ""
substituteInPlace RULES/rules.prg --replace "/bin/" ""
ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-cc.rul
ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-clang.rul
ln -sv i386-darwin-clang64.rul RULES/arm64-darwin-clang64.rul
ln -sv i586-linux-cc.rul RULES/riscv64-linux-cc.rul
'';
dontConfigure = true;
makeFlags = [ "GMAKE_NOWARN=true" "INS_BASE=/" "INS_RBASE=/" "DESTDIR=${placeholder "out"}" ];
enableParallelBuilding = false; # parallel building fails on some linux machines
hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "fortify";
meta = with lib; {
homepage = "https://cdrtools.sourceforge.net/private/cdrecord.html";
description = "Highly portable CD/DVD/BluRay command line recording software";
license = with licenses; [ cddl gpl2Plus lgpl21 ];
platforms = with platforms; linux ++ darwin;
# Licensing issues: This package contains code licensed under CDDL, GPL2
# and LGPL2. There is a debate regarding the legality of distributing this
# package in binary form.
hydraPlatforms = [];
};
}