Skip to content

Commit

Permalink
fluidsynth: Fix CMake config
Browse files Browse the repository at this point in the history
Upstream is concatenating CMAKE_INSTALL_LIBDIR onto CMAKE_INSTALL_PREFIX to get
a directory to use for the install_name on Darwin. This is not the right way of
making CMAKE_INSTALL_LIBDIR absolute.

The config was first set up for breakage when the CMAKE_INSTALL_LIBDIR was made relative,
in order to work around the wrong concatenation. This caused the _IMPORT_PREFIX to be
computed by walking up the directory tree from the config file, instead of using
the absolute CMAKE_INSTALL_LIBDIR.

Then outputs were introduced to the derivation and the config was moved to a different
output. Now the prefix it walks up to is the wrong prefix, and the config is busted.

Fix by reverting the original workaround so we have an absolute CMAKE_INSTALL_LIBDIR,
and pulling a patch that fixes the bad concatenation.
  • Loading branch information
OPNA2608 committed Jul 10, 2023
1 parent 29f96cc commit f43a46f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkgs/applications/audio/fluidsynth/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, buildPackages, pkg-config, cmake
{ stdenv, lib, fetchFromGitHub, fetchpatch, buildPackages, pkg-config, cmake
, alsa-lib, glib, libjack2, libsndfile, libpulseaudio
, AppKit, AudioUnit, CoreAudio, CoreMIDI, CoreServices
}:
Expand All @@ -14,6 +14,16 @@ stdenv.mkDerivation rec {
sha256 = "sha256-BSJu3jB7b5G2ThXBUHUNnBGl55EXe3nIzdBdgfOWDSM=";
};

patches = [
# Fixes bad CMAKE_INSTALL_PREFIX + CMAKE_INSTALL_LIBDIR concatenation for Darwin install name dir
# Remove when PR merged & in release
(fetchpatch {
name = "0001-Fix-incorrect-way-of-turning-CMAKE_INSTALL_LIBDIR-absolute.patch";
url = "https://github.com/FluidSynth/fluidsynth/pull/1261/commits/03cd38dd909fc24aa39553d869afbb4024416de8.patch";
hash = "sha256-nV+MbFttnbNBO4zWnPLpnnEuoiESkV9BGFlUS9tQQfk=";
})
];

outputs = [ "out" "dev" "man" ];

nativeBuildInputs = [ buildPackages.stdenv.cc pkg-config cmake ];
Expand All @@ -24,8 +34,6 @@ stdenv.mkDerivation rec {

cmakeFlags = [
"-Denable-framework=off"
# set CMAKE_INSTALL_NAME_DIR to correct value on darwin
"-DCMAKE_INSTALL_LIBDIR=lib"
];

meta = with lib; {
Expand Down

0 comments on commit f43a46f

Please sign in to comment.