1{ lib, stdenv, fetchurl, fetchpatch, libcddb, pkg-config, ncurses, help2man, libiconv, Carbon, IOKit }:
2
3stdenv.mkDerivation rec {
4 pname = "libcdio";
5 version = "2.1.0";
6
7 src = fetchurl {
8 url = "mirror://gnu/libcdio/libcdio-${version}.tar.bz2";
9 sha256 = "0avi6apv5ydjy6b9c3z9a46rvp5i57qyr09vr7x4nndxkmcfjl45";
10 };
11
12 patches = [
13 # Fixes test failure of realpath test with glibc-2.36
14 (fetchpatch {
15 url = "https://src.fedoraproject.org/rpms/libcdio/raw/d49ccdd9c8b4e9d57c01539f4c8948f28ce82bca/f/realpath-test-fix.patch";
16 sha256 = "sha256-ldAGlcf79uQ8QAt4Au8Iv6jsI6ICZXtXOKZBpyELtN8=";
17 })
18
19 # pull pending upstream patch to fix build on ncurses-6.3:
20 # https://savannah.gnu.org/patch/index.php?10130
21 (fetchpatch {
22 name = "ncurses-6.3.patch";
23 url = "https://savannah.gnu.org/patch/download.php?file_id=52179";
24 sha256 = "1v15gxhpi4bgcr12pb3d9c3hiwj0drvc832vic7sham34lhjmcbb";
25 })
26 ];
27
28 postPatch = ''
29 patchShebangs .
30 '';
31
32 nativeBuildInputs = [ pkg-config help2man ];
33 buildInputs = [ libcddb libiconv ncurses ]
34 ++ lib.optionals stdenv.isDarwin [ Carbon IOKit ];
35
36 enableParallelBuilding = true;
37
38 doCheck = !stdenv.isDarwin;
39
40 meta = with lib; {
41 description = "A library for OS-independent CD-ROM and CD image access";
42 longDescription = ''
43 GNU libcdio is a library for OS-independent CD-ROM and
44 CD image access. It includes a library for working with
45 ISO-9660 filesystems (libiso9660), as well as utility
46 programs such as an audio CD player and an extractor.
47 '';
48 homepage = "https://www.gnu.org/software/libcdio/";
49 license = licenses.gpl2Plus;
50 platforms = platforms.unix;
51 };
52}