1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 nix-update-script,
6 autoreconfHook,
7 testers,
8 texinfo,
9 libcddb,
10 pkg-config,
11 ncurses,
12 help2man,
13 libiconv,
14 withMan ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "libcdio";
19 version = "2.2.0";
20
21 src = fetchFromGitHub {
22 owner = "libcdio";
23 repo = "libcdio";
24 tag = finalAttrs.version;
25 hash = "sha256-izjZk2kz9PkLm9+INUdl1e7jMz3nUsQKdplKI9Io+CM=";
26 };
27
28 env = lib.optionalAttrs stdenv.hostPlatform.is32bit {
29 NIX_CFLAGS_COMPILE = "-D_LARGEFILE64_SOURCE";
30 };
31
32 postPatch = ''
33 patchShebangs .
34 echo "
35 @set UPDATED 1 January 1970
36 @set UPDATED-MONTH January 1970
37 @set EDITION ${finalAttrs.version}
38 @set VERSION ${finalAttrs.version}
39 " > doc/version.texi
40 ''
41 + lib.optionalString (!withMan) ''
42 substituteInPlace src/Makefile.am \
43 --replace-fail 'man_cd_drive = cd-drive.1' "" \
44 --replace-fail 'man_cd_info = cd-info.1' "" \
45 --replace-fail 'man_cd_read = cd-read.1' "" \
46 --replace-fail 'man_iso_info = iso-info.1' "" \
47 --replace-fail 'man_iso_read = iso-read.1' ""
48 '';
49
50 configureFlags = [
51 (lib.enableFeature withMan "maintainer-mode")
52 ];
53
54 nativeBuildInputs = [
55 pkg-config
56 autoreconfHook
57 texinfo
58 ]
59 ++ lib.optionals withMan [
60 help2man
61 ];
62
63 buildInputs = [
64 libcddb
65 libiconv
66 ncurses
67 ];
68
69 enableParallelBuilding = true;
70
71 doCheck = !stdenv.hostPlatform.isDarwin;
72
73 outputs = [
74 "out"
75 "lib"
76 "dev"
77 "info"
78 ]
79 ++ lib.optionals withMan [
80 "man"
81 ];
82
83 passthru = {
84 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
85 updateScript = nix-update-script { };
86 };
87
88 meta = {
89 description = "Library for OS-independent CD-ROM and CD image access";
90 longDescription = ''
91 GNU libcdio is a library for OS-independent CD-ROM and
92 CD image access. It includes a library for working with
93 ISO-9660 filesystems (libiso9660), as well as utility
94 programs such as an audio CD player and an extractor.
95 '';
96 homepage = "https://www.gnu.org/software/libcdio/";
97 license = lib.licenses.gpl2Plus;
98 pkgConfigModules = [
99 "libcdio"
100 "libcdio++"
101 "libiso9660"
102 "libiso9660++"
103 "libudf"
104 ];
105 platforms = lib.platforms.unix;
106 };
107})