about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/timidity
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/timidity')
-rw-r--r--nixpkgs/pkgs/tools/misc/timidity/configure-compat.patch33
-rw-r--r--nixpkgs/pkgs/tools/misc/timidity/default.nix32
2 files changed, 60 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/tools/misc/timidity/configure-compat.patch b/nixpkgs/pkgs/tools/misc/timidity/configure-compat.patch
new file mode 100644
index 000000000000..4368f389e0f8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/misc/timidity/configure-compat.patch
@@ -0,0 +1,33 @@
+--- a/configure	2018-08-28 19:33:39.000000000 -0400
++++ b/configure	2023-09-05 19:44:27.311279263 -0400
+@@ -6874,6 +6874,7 @@
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ #include <ctype.h>
++#include <stdlib.h>
+ #if ((' ' & 0x0FF) == 0x020)
+ # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+ # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+@@ -7731,6 +7732,7 @@
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h.  */
+ #include <ctype.h>
++#include <stdlib.h>
+ #if ((' ' & 0x0FF) == 0x020)
+ # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+ # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+@@ -10311,8 +10313,13 @@
+   if test "$cross_compiling" = yes; then
+   ac_cv_func_fork_works=cross
+ else
+-  cat >conftest.$ac_ext <<_ACEOF
++   cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++   cat confdefs.h >>conftest.$ac_ext
++   cat >>conftest.$ac_ext <<_ACEOF
+ /* By Ruediger Kuhlmann. */
++      #include <stdlib.h>
+       #include <sys/types.h>
+       #if HAVE_UNISTD_H
+       # include <unistd.h>
diff --git a/nixpkgs/pkgs/tools/misc/timidity/default.nix b/nixpkgs/pkgs/tools/misc/timidity/default.nix
index d9750b438256..e88ba3fea352 100644
--- a/nixpkgs/pkgs/tools/misc/timidity/default.nix
+++ b/nixpkgs/pkgs/tools/misc/timidity/default.nix
@@ -1,6 +1,14 @@
-{ lib, stdenv, fetchurl
-, pkg-config, buildPackages
-, CoreAudio, alsa-lib, libjack2, ncurses
+{ lib
+, stdenv
+, fetchurl
+, pkg-config
+, memstreamHook
+, CoreAudio
+, libobjc
+, libjack2
+, ncurses
+, alsa-lib
+, buildPackages
 }:
 
 stdenv.mkDerivation rec {
@@ -12,9 +20,15 @@ stdenv.mkDerivation rec {
     sha256 = "1xf8n6dqzvi6nr2asags12ijbj1lwk1hgl3s27vm2szib8ww07qn";
   };
 
-  patches = [ ./timidity-iA-Oj.patch ];
+  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 ];
+  nativeBuildInputs = [ pkg-config ]
+    ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ];
   buildInputs = [
     libjack2
     ncurses
@@ -22,6 +36,7 @@ stdenv.mkDerivation rec {
     alsa-lib
   ] ++ lib.optionals stdenv.isDarwin [
     CoreAudio
+    libobjc
   ];
 
   configureFlags = [
@@ -36,6 +51,13 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals stdenv.isDarwin [
     "--enable-audio=darwin,jack"
     "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"
   ];
 
   makeFlags = [