Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / sl / slimserver / package.nix
blob1a9a2207ac053e4cc7831863dd0ce3fb0e864059
2   faad2,
3   fetchFromGitHub,
4   flac,
5   lame,
6   lib,
7   makeWrapper,
8   monkeysAudio,
9   nixosTests,
10   perlPackages,
11   sox,
12   stdenv,
13   wavpack,
14   zlib,
15   enableUnfreeFirmware ? false,
18 let
19   binPath = lib.makeBinPath (
20     [
21       lame
22       flac
23       faad2
24       sox
25       wavpack
26     ]
27     ++ (lib.optional stdenv.isLinux monkeysAudio)
28   );
29   libPath = lib.makeLibraryPath [
30     zlib
31     stdenv.cc.cc.lib
32   ];
34 perlPackages.buildPerlPackage rec {
35   pname = "slimserver";
36   version = "8.5.2";
38   src = fetchFromGitHub {
39     owner = "LMS-Community";
40     repo = "slimserver";
41     rev = version;
42     hash = "sha256-262SHaxt5ow3nJtNVk10sbiPUfDb/U+Ab97DRjkJZFI=";
43   };
45   nativeBuildInputs = [ makeWrapper ];
47   buildInputs =
48     with perlPackages;
49     [
50       AnyEvent
51       ArchiveZip
52       AsyncUtil
53       AudioScan
54       CarpClan
55       CGI
56       ClassAccessor
57       ClassAccessorChained
58       ClassC3
59       # ClassC3Componentised # Error: DBIx::Class::Row::throw_exception(): DBIx::Class::Relationship::BelongsTo::belongs_to(): Can't infer join condition for track
60       ClassDataInheritable
61       ClassInspector
62       ClassISA
63       ClassMember
64       ClassSingleton
65       ClassVirtual
66       ClassXSAccessor
67       CompressRawZlib
68       CryptOpenSSLRSA
69       DataDump
70       DataPage
71       DataURIEncode
72       DBDSQLite
73       DBI
74       # DBIxClass # https://github.com/LMS-Community/slimserver/issues/138
75       DigestSHA1
76       EncodeDetect
77       EV
78       ExporterLite
79       FileBOM
80       FileCopyRecursive
81       FileNext
82       FileReadBackwards
83       FileSlurp
84       FileWhich
85       HTMLParser
86       HTTPCookies
87       HTTPDaemon
88       HTTPMessage
89       ImageScale
90       IOAIO
91       IOInterface
92       IOSocketSSL
93       IOString
94       JSONXS
95       JSONXSVersionOneAndTwo
96       # LogLog4perl # Internal error: Root Logger not initialized.
97       LWP
98       LWPProtocolHttps
99       MP3CutGapless
100       NetHTTP
101       NetHTTPSNB
102       PathClass
103       ProcBackground
104       # SQLAbstract # DBI Exception: DBD::SQLite::db prepare_cached failed: no such function: ARRAY
105       SQLAbstractLimit
106       SubName
107       TemplateToolkit
108       TextUnidecode
109       TieCacheLRU
110       TieCacheLRUExpires
111       TieRegexpHash
112       TimeDate
113       URI
114       URIFind
115       UUIDTiny
116       XMLParser
117       XMLSimple
118       YAMLLibYAML
119     ]
120     # ++ (lib.optional stdenv.isDarwin perlPackages.MacFSEvents)
121     ++ (lib.optional stdenv.isLinux perlPackages.LinuxInotify2);
123   prePatch = ''
124     # remove vendored binaries
125     rm -rf Bin
127     # remove most vendored modules, keeping necessary ones
128     mkdir -p CPAN_used/Class/C3/ CPAN_used/SQL
129     rm -r CPAN/SQL/Abstract/Limit.pm
130     cp -rv CPAN/Class/C3/Componentised.pm CPAN_used/Class/C3/
131     cp -rv CPAN/DBIx CPAN_used/
132     cp -rv CPAN/Log CPAN_used/
133     cp -rv CPAN/SQL/* CPAN_used/SQL/
134     rm -r CPAN
135     mv CPAN_used CPAN
137     # another set of vendored/modified modules exist in lib, more selectively cleaned for now
138     rm -rf lib/Audio
140     ${lib.optionalString (!enableUnfreeFirmware) ''
141       # remove unfree firmware
142       rm -rf Firmware
143     ''}
145     touch Makefile.PL
146   '';
148   doCheck = false;
150   installPhase = ''
151     cp -r . $out
152     wrapProgram $out/slimserver.pl --prefix LD_LIBRARY_PATH : "${libPath}" --prefix PATH : "${binPath}"
153     wrapProgram $out/scanner.pl --prefix LD_LIBRARY_PATH : "${libPath}" --prefix PATH : "${binPath}"
154     mkdir $out/bin
155     ln -s $out/slimserver.pl $out/bin/slimserver
156   '';
158   outputs = [ "out" ];
160   passthru = {
161     tests = {
162       inherit (nixosTests) slimserver;
163     };
165     updateScript = ./update.nu;
166   };
168   meta = with lib; {
169     homepage = "https://lyrion.org/";
170     changelog = "https://github.com/LMS-Community/slimserver/blob/${version}/Changelog${lib.versions.major version}.html";
171     description = "Lyrion Music Server (formerly Logitech Media Server) is open-source server software which controls a wide range of Squeezebox audio players";
172     # the firmware is not under a free license, so we do not include firmware in the default package
173     # https://github.com/LMS-Community/slimserver/blob/public/8.3/License.txt
174     license = if enableUnfreeFirmware then licenses.unfree else licenses.gpl2Only;
175     mainProgram = "slimserver";
176     maintainers = with maintainers; [
177       adamcstephens
178       jecaro
179     ];
180     platforms = platforms.unix;
181     broken = stdenv.isDarwin;
182   };