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