From 6943a9a6febe3eb9fb8310082ff420896f8fae1e Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 5 Sep 2023 19:49:10 -0400 Subject: [PATCH] timidity: fix build with clang 16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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; --- .../misc/timidity/configure-compat.patch | 33 +++++++++++++++++++ pkgs/tools/misc/timidity/default.nix | 32 +++++++++++++++--- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 pkgs/tools/misc/timidity/configure-compat.patch diff --git a/pkgs/tools/misc/timidity/configure-compat.patch b/pkgs/tools/misc/timidity/configure-compat.patch new file mode 100644 index 000000000000..4368f389e0f8 --- /dev/null +++ b/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 ++#include + #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 ++#include + #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 + #include + #if HAVE_UNISTD_H + # include diff --git a/pkgs/tools/misc/timidity/default.nix b/pkgs/tools/misc/timidity/default.nix index d9750b438256..e88ba3fea352 100644 --- a/pkgs/tools/misc/timidity/default.nix +++ b/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 = [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1ea2269aa8a6..f09519e418f5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };