15 ## Additional optional output modes
20 stdenv.mkDerivation rec {
25 url = "mirror://sourceforge/timidity/TiMidity++-${version}.tar.bz2";
26 sha256 = "1xf8n6dqzvi6nr2asags12ijbj1lwk1hgl3s27vm2szib8ww07qn";
30 ./timidity-iA-Oj.patch
31 # Fixes misdetection of features by clang 16. The configure script itself is patched because
32 # it is old and does not work nicely with autoreconfHook.
33 ./configure-compat.patch
38 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ memstreamHook ];
45 ++ lib.optionals stdenv.hostPlatform.isLinux [
48 ++ lib.optionals stdenv.hostPlatform.isDarwin [
52 ++ lib.optionals enableVorbis [
60 ++ lib.optionals stdenv.hostPlatform.isLinux [
64 ++ lib.optionals stdenv.hostPlatform.isDarwin [
67 ++ lib.optionals enableVorbis [
74 ("--enable-audio=" + builtins.concatStringsSep "," enabledOutputModes)
76 "lib_cv___va_copy=yes"
78 ++ lib.optionals stdenv.hostPlatform.isLinux [
80 "--with-default-output=alsa"
81 "lib_cv_va_val_copy=yes"
83 ++ lib.optionals stdenv.hostPlatform.isDarwin [
84 "lib_cv_va_val_copy=no"
85 "timidity_cv_ccoption_rdynamic=yes"
86 # These configure tests fail because of incompatible function pointer conversions.
87 "ac_cv_func_vprintf=yes"
88 "ac_cv_func_popen=yes"
89 "ac_cv_func_vsnprintf=yes"
90 "ac_cv_func_snprintf=yes"
91 "ac_cv_func_open_memstream=yes"
95 "AR=${stdenv.cc.targetPrefix}ar"
98 instruments = fetchurl {
99 url = "http://www.csee.umbc.edu/pub/midia/instruments.tar.gz";
100 sha256 = "0lsh9l8l5h46z0y8ybsjd4pf6c22n33jsjvapfv3rjlfnasnqw67";
104 # calcnewt has to be built with the host compiler.
105 ${buildPackages.stdenv.cc}/bin/cc -o timidity/calcnewt -lm timidity/calcnewt.c
106 # Remove dependencies of calcnewt so it doesn't try to remake it.
107 sed -i 's/^\(calcnewt\$(EXEEXT):\).*/\1/g' timidity/Makefile
110 # the instruments could be compressed (?)
112 mkdir -p $out/share/timidity/;
113 cp ${./timidity.cfg} $out/share/timidity/timidity.cfg
114 substituteAllInPlace $out/share/timidity/timidity.cfg
115 tar --strip-components=1 -xf $instruments -C $out/share/timidity/
117 # This fixup step is unnecessary and fails on Darwin
118 dontRewriteSymlinks = stdenv.hostPlatform.isDarwin;
120 passthru.tests = nixosTests.timidity;
123 homepage = "https://sourceforge.net/projects/timidity/";
124 license = licenses.gpl2Plus;
125 description = "Software MIDI renderer";
126 maintainers = [ maintainers.marcweber ];
127 platforms = platforms.unix;
128 mainProgram = "timidity";