1{ stdenv
2, lib
3, fetchFromGitHub
4, makeFontsConf
5, nix-update-script
6, testers
7, autoreconfHook
8, docSupport ? true
9, doxygen
10, graphviz
11, libexsid
12, libgcrypt
13, perl
14, pkg-config
15, unittest-cpp
16, xa
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "libsidplayfp";
21 version = "2.8.0";
22
23 src = fetchFromGitHub {
24 owner = "libsidplayfp";
25 repo = "libsidplayfp";
26 rev = "v${finalAttrs.version}";
27 fetchSubmodules = true;
28 hash = "sha256-qZharhEZ16q3Vd2PwVsKQaP/b6bT/okwEPKKwvRl5D8=";
29 };
30
31 outputs = [
32 "out"
33 ] ++ lib.optionals docSupport [
34 "doc"
35 ];
36
37 postPatch = ''
38 patchShebangs .
39 '';
40
41 strictDeps = true;
42
43 nativeBuildInputs = [
44 autoreconfHook
45 perl
46 pkg-config
47 xa
48 ] ++ lib.optionals docSupport [
49 doxygen
50 graphviz
51 ];
52
53 buildInputs = [
54 libexsid
55 libgcrypt
56 ];
57
58 checkInputs = [
59 unittest-cpp
60 ];
61
62 enableParallelBuilding = true;
63
64 configureFlags = [
65 (lib.strings.enableFeature true "hardsid")
66 (lib.strings.withFeature true "gcrypt")
67 (lib.strings.withFeature true "exsid")
68 (lib.strings.enableFeature finalAttrs.finalPackage.doCheck "tests")
69 ];
70
71 # Make Doxygen happy with the setup, reduce log noise
72 FONTCONFIG_FILE = lib.optionalString docSupport (makeFontsConf { fontDirectories = [ ]; });
73
74 preBuild = ''
75 # Reduce noise from fontconfig during doc building
76 export XDG_CACHE_HOME=$TMPDIR
77 '';
78
79 buildFlags = [
80 "all"
81 ] ++ lib.optionals docSupport [
82 "doc"
83 ];
84
85 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
86
87 postInstall = lib.optionalString docSupport ''
88 mkdir -p $doc/share/doc/libsidplayfp
89 mv docs/html $doc/share/doc/libsidplayfp/
90 '';
91
92 passthru = {
93 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
94 updateScript = nix-update-script { };
95 };
96
97 meta = with lib; {
98 description = "Library to play Commodore 64 music derived from libsidplay2";
99 longDescription = ''
100 libsidplayfp is a C64 music player library which integrates
101 the reSID SID chip emulation into a cycle-based emulator
102 environment, constantly aiming to improve emulation of the
103 C64 system and the SID chips.
104 '';
105 homepage = "https://github.com/libsidplayfp/libsidplayfp";
106 license = with licenses; [ gpl2Plus ];
107 maintainers = with maintainers; [ ramkromberg OPNA2608 ];
108 platforms = platforms.all;
109 pkgConfigModules = [
110 "libsidplayfp"
111 "libstilview"
112 ];
113 };
114})