cdparanoia: fix build on FreeBSD

This commit is contained in:
Audrey Dutcher
2025-03-05 12:41:01 -07:00
parent bdd609bfd3
commit 3d6f190959
+88 -2
View File
@@ -5,6 +5,7 @@
fetchpatch,
updateAutotoolsGnuConfigScriptsHook,
autoreconfHook,
freebsd,
}:
stdenv.mkDerivation rec {
@@ -37,7 +38,7 @@ stdenv.mkDerivation rec {
})
]
++ [
# Has to come after darwin patches
# Has to come after darwin patches and before freebsd patches
./fix_private_keyword.patch
# Order does not matter
./configure.patch
@@ -62,13 +63,98 @@ stdenv.mkDerivation rec {
hash = "sha256-krfprwls0L3hsNfoj2j69J5k1RTKEQtzE0fLYG9EJKo=";
})
]
++ lib.optional stdenv.hostPlatform.isMusl ./utils.patch;
++ lib.optional stdenv.hostPlatform.isMusl ./utils.patch
++ [
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_low__interface.h";
hash = "sha256-bXrcRFCbU7/7/N+J8VGKGSxIB1m8XwoAlc/KTnt9wN0=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_scan__devices.c";
hash = "sha256-UD7SXeypF3bAqT7Y24UOrGZNaD8ZmpS2V7XQU+3VKXk=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<private\>/private_data/g' $out
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_cdda__interface.h";
hash = "sha256-JL4qe4LwmNp2jQFqTvyRjc6bixGqYr6BZmqsYIY9xhw=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_common__interface.c";
hash = "sha256-vw0oFM6w15YBaAK01FwVcSN+oztSfo5jL6OlGy0iWBg=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_cooked__interface.c";
hash = "sha256-g39dhxb8+K9BIb2/5cmkQ9GYjg4gDjj6sv+dXx93kQ4=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_interface.c";
hash = "sha256-LMWfbqLjbQM3L4H3orAxyyAHf1hVtFwfmZY8NmBLKzs=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<private\>/private_data/g' $out
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_scsi__interface.c";
hash = "sha256-dx6YCWW8J0e455phaYDUMiOCvp4DsfINjSEiEfnHaNI=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<private\>/private_data/g' $out
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
(fetchpatch {
url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-Makefile.in";
hash = "sha256-Wje2d58xrSWHJNktQRHcNSbh5yh6vMtpgc/3G4D1vrI=";
extraPrefix = "";
postFetch = ''
sed -E -i -e 's/\<Linux\>/__linux__/g' $out
'';
})
];
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
autoreconfHook
];
propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isFreeBSD [
# cdparanoia shipped headers have #include <libcam.h>
# (it is part of the freebsd base system so this is reasonable
# but we want to keep the default freebsd libs, freebsd.libc, small)
freebsd.libcam
];
env =
lib.optionalAttrs stdenv.hostPlatform.isFreeBSD {
NIX_LDFLAGS = "-lcam";
}
// {
BSD_INSTALL_PROGRAM = "install";
BSD_INSTALL_LIB = "install";
};
# Build system reuses the same object file names for shared and static
# library. Occasionally fails in the middle:
# gcc -O2 -fsigned-char -g -O2 -c scan_devices.c