Unverified Commit 6943a9a6 authored by Randy Eckenrode's avatar Randy Eckenrode
Browse files

timidity: fix build with clang 16

* Work around failing configure tests. Specify the expected value
  explictly except when that doesn’t work. Otherwise, patch the
  configure script to perform the test correctly with clang 16;
* Add libobjc on Darwin; and
* Use memstreamHook on x86_64-darwin;
parent dba6d77a
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
--- 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>
+27 −5
Original line number Diff line number Diff line
{ 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 = [
+1 −0
Original line number Diff line number Diff line
@@ -35993,6 +35993,7 @@ with pkgs;
  timidity = callPackage ../tools/misc/timidity {
    inherit (darwin.apple_sdk.frameworks) CoreAudio;
    inherit (darwin) libobjc;
  };
  tint2 = callPackage ../applications/misc/tint2 { };