1{ stdenv
2, lib
3, fetchFromGitHub
4, makeFontsConf
5, nix-update-script
6, autoreconfHook
7, pkg-config
8, perl
9, unittest-cpp
10, xa
11, libgcrypt
12, libexsid
13, docSupport ? true
14, doxygen
15, graphviz
16}:
17
18stdenv.mkDerivation rec {
19 pname = "libsidplayfp";
20 version = "2.5.0";
21
22 src = fetchFromGitHub {
23 owner = "libsidplayfp";
24 repo = "libsidplayfp";
25 rev = "v${version}";
26 fetchSubmodules = true;
27 sha256 = "sha256-KCp/8UjVl8e3+4s1FD4GvHP7AUAS+eIB7RWhmgm5GIA=";
28 };
29
30 postPatch = ''
31 patchShebangs .
32 '';
33
34 strictDeps = true;
35
36 nativeBuildInputs = [ autoreconfHook pkg-config perl xa ]
37 ++ lib.optionals docSupport [ doxygen graphviz ];
38
39 buildInputs = [ libgcrypt libexsid ];
40
41 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
42
43 checkInputs = [ unittest-cpp ];
44
45 enableParallelBuilding = true;
46
47 installTargets = [ "install" ]
48 ++ lib.optionals docSupport [ "doc" ];
49
50 outputs = [ "out" ]
51 ++ lib.optionals docSupport [ "doc" ];
52
53 configureFlags = [
54 "--enable-hardsid"
55 "--with-gcrypt"
56 "--with-exsid"
57 ]
58 ++ lib.optional doCheck "--enable-tests";
59
60 FONTCONFIG_FILE = lib.optionalString docSupport (makeFontsConf { fontDirectories = [ ]; });
61
62 preBuild = ''
63 # Reduce noise from fontconfig during doc building
64 export XDG_CACHE_HOME=$TMPDIR
65 '';
66
67 postInstall = lib.optionalString docSupport ''
68 mkdir -p $doc/share/doc/libsidplayfp
69 mv docs/html $doc/share/doc/libsidplayfp/
70 '';
71
72 passthru = {
73 updateScript = nix-update-script { };
74 };
75
76 meta = with lib; {
77 description = "A library to play Commodore 64 music derived from libsidplay2";
78 longDescription = ''
79 libsidplayfp is a C64 music player library which integrates
80 the reSID SID chip emulation into a cycle-based emulator
81 environment, constantly aiming to improve emulation of the
82 C64 system and the SID chips.
83 '';
84 homepage = "https://github.com/libsidplayfp/libsidplayfp";
85 license = with licenses; [ gpl2Plus ];
86 maintainers = with maintainers; [ ramkromberg OPNA2608 ];
87 platforms = platforms.all;
88 };
89}