about summary refs log tree commit diff
path: root/pkgs/tools/cd-dvd
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-08-04 12:12:59 +0200
committerGitHub <noreply@github.com>2023-08-04 12:12:59 +0200
commit7774391040a4a7b4bbca8a797278d8594e3d3653 (patch)
tree035f4d8fc41d7db3a57ce5b70e1ccd2ae50e7055 /pkgs/tools/cd-dvd
parent4f5308922f99987cabb1821b675da86948af00b4 (diff)
parent8d08ce1f93bfec78965195851b874abf904f8cc9 (diff)
downloadnixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar.gz
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar.bz2
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar.lz
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar.xz
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.tar.zst
nixlib-7774391040a4a7b4bbca8a797278d8594e3d3653.zip
Merge pull request #247063 from emilazy/cdrdao-fixes
{cdrdao,whipper}: support Darwin and add patch
Diffstat (limited to 'pkgs/tools/cd-dvd')
-rw-r--r--pkgs/tools/cd-dvd/cdrdao/default.nix57
1 files changed, 48 insertions, 9 deletions
diff --git a/pkgs/tools/cd-dvd/cdrdao/default.nix b/pkgs/tools/cd-dvd/cdrdao/default.nix
index 527d70e7a90d..959899d3b3f3 100644
--- a/pkgs/tools/cd-dvd/cdrdao/default.nix
+++ b/pkgs/tools/cd-dvd/cdrdao/default.nix
@@ -1,21 +1,60 @@
-{lib, stdenv, fetchurl, libvorbis, libmad, pkg-config, libao}:
+{
+  lib,
+  stdenv,
+  fetchurl,
+  fetchpatch,
+  pkg-config,
+  libiconv,
+  libvorbis,
+  libmad,
+  libao,
+  CoreServices,
+  IOKit,
+}:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "cdrdao";
   version = "1.2.5";
 
   src = fetchurl {
-    url = "mirror://sourceforge/cdrdao/cdrdao-${version}.tar.bz2";
+    url = "mirror://sourceforge/cdrdao/cdrdao-${finalAttrs.version}.tar.bz2";
     hash = "sha256-0ZtnyFPF26JAavqrbNeI53817r5jTKxGeVKEd8e+AbY=";
   };
 
   makeFlags = [ "RM=rm" "LN=ln" "MV=mv" ];
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ libvorbis libmad libao ];
+  nativeBuildInputs = [
+    pkg-config
+  ];
+
+  buildInputs = [
+    libiconv
+    libvorbis
+    libmad
+    libao
+  ] ++ lib.optionals stdenv.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 = ''
@@ -25,10 +64,10 @@ stdenv.mkDerivation rec {
   # Needed on gcc >= 6.
   env.NIX_CFLAGS_COMPILE = "-Wno-narrowing";
 
-  meta = with lib; {
+  meta = {
     description = "A tool for recording audio or data CD-Rs in disk-at-once (DAO) mode";
     homepage = "https://cdrdao.sourceforge.net/";
-    platforms = platforms.linux;
-    license = licenses.gpl2;
+    platforms = lib.platforms.unix;
+    license = lib.licenses.gpl2;
   };
-}
+})