1{
2 config,
3 lib,
4 stdenv,
5 fetchurl,
6 zlib,
7 pkg-config,
8 mpg123,
9 libogg,
10 libvorbis,
11 portaudio,
12 libsndfile,
13 flac,
14 usePulseAudio ? config.pulseaudio or stdenv.hostPlatform.isLinux,
15 libpulseaudio,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "libopenmpt";
20 version = "0.8.0";
21
22 outputs = [
23 "out"
24 "dev"
25 "bin"
26 ];
27
28 src = fetchurl {
29 url = "https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-${version}+release.autotools.tar.gz";
30 hash = "sha256-VT7pxjxLPLybZk1bwx2LxO6zRfrYgJ8Dy/kxR6EIqzI=";
31 };
32
33 enableParallelBuilding = true;
34
35 nativeBuildInputs = [
36 pkg-config
37 ];
38
39 buildInputs = [
40 zlib
41 mpg123
42 libogg
43 libvorbis
44 portaudio
45 libsndfile
46 flac
47 ]
48 ++ lib.optionals usePulseAudio [
49 libpulseaudio
50 ];
51
52 configureFlags = [
53 (lib.strings.withFeature usePulseAudio "pulseaudio")
54 ];
55
56 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
57
58 postFixup = ''
59 moveToOutput share/doc $dev
60 '';
61
62 passthru.updateScript = ./update.sh;
63
64 meta = with lib; {
65 description = "Cross-platform C++ and C library to decode tracked music files into a raw PCM audio stream";
66 mainProgram = "openmpt123";
67 longDescription = ''
68 libopenmpt is a cross-platform C++ and C library to decode tracked music files (modules) into a raw PCM audio stream.
69 openmpt123 is a cross-platform command-line or terminal based module file player.
70 libopenmpt is based on the player code of the OpenMPT project.
71 '';
72 homepage = "https://lib.openmpt.org/libopenmpt/";
73 license = licenses.bsd3;
74 maintainers = with maintainers; [ OPNA2608 ];
75 platforms = platforms.unix;
76 };
77}