nixpkgs/pkgs/tools/cd-dvd/cdrdao/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

74 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchurl,
fetchpatch,
pkg-config,
libiconv,
libvorbis,
libmad,
libao,
CoreServices,
IOKit,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "cdrdao";
version = "1.2.5";
src = fetchurl {
url = "mirror://sourceforge/cdrdao/cdrdao-${finalAttrs.version}.tar.bz2";
hash = "sha256-0ZtnyFPF26JAavqrbNeI53817r5jTKxGeVKEd8e+AbY=";
};
makeFlags = [ "RM=rm" "LN=ln" "MV=mv" ];
nativeBuildInputs = [
pkg-config
];
buildInputs = [
libiconv
libvorbis
libmad
libao
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreServices
IOKit
];
hardeningDisable = [ "format" ];
patches = [
# Fix build on macOS SDK < 12
# https://github.com/cdrdao/cdrdao/pull/19
(fetchpatch {
url = "https://github.com/cdrdao/cdrdao/commit/105d72a61f510e3c47626476f9bbc9516f824ede.patch";
hash = "sha256-NVIw59CSrc/HcslhfbYQNK/qSmD4QbfuV8hWYhWelX4=";
})
# Fix undefined behaviour caused by uninitialized variable
# https://github.com/cdrdao/cdrdao/pull/21
(fetchpatch {
url = "https://github.com/cdrdao/cdrdao/commit/251a40ab42305c412674c7c2d391374d91e91c95.patch";
hash = "sha256-+nGlWw5rgc5Ns2l+6fQ4Hp2LbhO4R/I95h9WGIh/Ebw=";
})
];
# we have glibc/include/linux as a symlink to the kernel headers,
# and the magic '..' points to kernelheaders, and not back to the glibc/include
postPatch = ''
sed -i 's,linux/../,,g' dao/sg_err.h
'';
# Needed on gcc >= 6.
env.NIX_CFLAGS_COMPILE = "-Wno-narrowing";
meta = {
description = "Tool for recording audio or data CD-Rs in disk-at-once (DAO) mode";
homepage = "https://cdrdao.sourceforge.net/";
platforms = lib.platforms.unix;
license = lib.licenses.gpl2Plus;
};
})