nixpkgs/pkgs/tools/misc/timidity/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
2.6 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
, pkg-config
, memstreamHook
, CoreAudio
, libobjc
, libjack2
, ncurses
, alsa-lib
, buildPackages
2021-11-01 09:48:59 +00:00
}:
stdenv.mkDerivation rec {
pname = "timidity";
version = "2.15.0";
src = fetchurl {
url = "mirror://sourceforge/timidity/TiMidity++-${version}.tar.bz2";
2018-11-23 06:54:46 +00:00
sha256 = "1xf8n6dqzvi6nr2asags12ijbj1lwk1hgl3s27vm2szib8ww07qn";
};
patches = [
./timidity-iA-Oj.patch
# Fixes misdetection of features by clang 16. The configure script itself is patched because
# it is old and does not work nicely with autoreconfHook.
./configure-compat.patch
];
nativeBuildInputs = [ pkg-config ]
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ];
2021-11-07 01:33:07 +00:00
buildInputs = [
libjack2
ncurses
] ++ lib.optionals stdenv.isLinux [
alsa-lib
] ++ lib.optionals stdenv.isDarwin [
CoreAudio
libobjc
2021-11-07 01:33:07 +00:00
];
configureFlags = [
"--enable-ncurses"
2021-11-01 09:48:59 +00:00
"lib_cv_va_copy=yes"
"lib_cv___va_copy=yes"
2021-11-07 01:33:07 +00:00
] ++ lib.optionals stdenv.isLinux [
"--enable-audio=oss,alsa,jack"
"--enable-alsaseq"
"--with-default-output=alsa"
2021-11-01 09:48:59 +00:00
"lib_cv_va_val_copy=yes"
2021-11-07 01:33:07 +00:00
] ++ lib.optionals stdenv.isDarwin [
"--enable-audio=darwin,jack"
2021-11-01 09:48:59 +00:00
"lib_cv_va_val_copy=no"
"timidity_cv_ccoption_rdynamic=yes"
# These configure tests fail because of incompatible function pointer conversions.
"ac_cv_func_vprintf=yes"
"ac_cv_func_popen=yes"
"ac_cv_func_vsnprintf=yes"
"ac_cv_func_snprintf=yes"
"ac_cv_func_open_memstream=yes"
2021-11-01 09:48:59 +00:00
];
makeFlags = [
"AR=${stdenv.cc.targetPrefix}ar"
2021-11-07 01:33:07 +00:00
];
instruments = fetchurl {
url = "http://www.csee.umbc.edu/pub/midia/instruments.tar.gz";
sha256 = "0lsh9l8l5h46z0y8ybsjd4pf6c22n33jsjvapfv3rjlfnasnqw67";
};
2021-11-01 09:48:59 +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
'';
# the instruments could be compressed (?)
postInstall = ''
mkdir -p $out/share/timidity/;
cp ${./timidity.cfg} $out/share/timidity/timidity.cfg
2022-08-15 11:35:23 +00:00
substituteAllInPlace $out/share/timidity/timidity.cfg
tar --strip-components=1 -xf $instruments -C $out/share/timidity/
'';
2021-11-07 01:33:07 +00:00
# This fixup step is unnecessary and fails on Darwin
dontRewriteSymlinks = stdenv.isDarwin;
meta = with lib; {
homepage = "https://sourceforge.net/projects/timidity/";
2014-12-19 10:25:35 +00:00
license = licenses.gpl2;
description = "A software MIDI renderer";
2014-12-19 10:25:35 +00:00
maintainers = [ maintainers.marcweber ];
2021-11-07 01:33:07 +00:00
platforms = platforms.unix;
2023-11-27 01:17:53 +00:00
mainProgram = "timidity";
};
}