2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
|
|
|
, pkg-config, buildPackages
|
|
|
|
, CoreAudio, alsa-lib, libjack2, ncurses
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "timidity";
|
|
|
|
version = "2.15.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-09-18 10:52:07 +00:00
|
|
|
url = "mirror://sourceforge/timidity/TiMidity++-${version}.tar.bz2";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "1xf8n6dqzvi6nr2asags12ijbj1lwk1hgl3s27vm2szib8ww07qn";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./timidity-iA-Oj.patch ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [
|
|
|
|
libjack2
|
|
|
|
ncurses
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
CoreAudio
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-ncurses"
|
|
|
|
"lib_cv_va_copy=yes"
|
|
|
|
"lib_cv___va_copy=yes"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--enable-audio=oss,alsa,jack"
|
|
|
|
"--enable-alsaseq"
|
|
|
|
"--with-default-output=alsa"
|
|
|
|
"lib_cv_va_val_copy=yes"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"--enable-audio=darwin,jack"
|
|
|
|
"lib_cv_va_val_copy=no"
|
|
|
|
];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"AR=${stdenv.cc.targetPrefix}ar"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
NIX_LDFLAGS = "-ljack -L${libjack2}/lib";
|
|
|
|
|
|
|
|
instruments = fetchurl {
|
|
|
|
url = "http://www.csee.umbc.edu/pub/midia/instruments.tar.gz";
|
|
|
|
sha256 = "0lsh9l8l5h46z0y8ybsjd4pf6c22n33jsjvapfv3rjlfnasnqw67";
|
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
preBuild = ''
|
|
|
|
# calcnewt has to be built with the host compiler.
|
|
|
|
${buildPackages.stdenv.cc}/bin/cc -o timidity/calcnewt -lm timidity/calcnewt.c
|
|
|
|
# Remove dependencies of calcnewt so it doesn't try to remake it.
|
|
|
|
sed -i 's/^\(calcnewt\$(EXEEXT):\).*/\1/g' timidity/Makefile
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# the instruments could be compressed (?)
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/timidity/;
|
|
|
|
cp ${./timidity.cfg} $out/share/timidity/timidity.cfg
|
|
|
|
tar --strip-components=1 -xf $instruments -C $out/share/timidity/
|
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
# This fixup step is unnecessary and fails on Darwin
|
|
|
|
dontRewriteSymlinks = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://sourceforge.net/projects/timidity/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
description = "A software MIDI renderer";
|
|
|
|
maintainers = [ maintainers.marcweber ];
|
2021-12-06 16:07:01 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|