From ee5b3e0592de0b721215ce2f9f1eb77f3fc026f7 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Wed, 7 Jan 2026 00:17:26 +0100 Subject: [PATCH] treewide: juce_recommended_lto_flags -> ffat-lto-objects --- pkgs/by-name/ct/ctagdrc/package.nix | 13 +++++++++++-- pkgs/by-name/de/dexed/package.nix | 16 +++++++++++----- pkgs/by-name/fi/fire/package.nix | 16 +++++++++++----- pkgs/by-name/pr/proteus/package.nix | 8 +++++++- pkgs/by-name/qd/qdelay/package.nix | 14 ++++++++++---- pkgs/by-name/ri/ripplerx/package.nix | 17 +++++++++++------ pkgs/by-name/sg/sg-323/package.nix | 14 ++++++++++---- pkgs/by-name/so/sonobus/package.nix | 14 +++++++++++--- pkgs/by-name/va/vaporizer2/package.nix | 15 +++++++++++---- pkgs/by-name/zl/zlcompressor/package.nix | 15 ++++++++++----- pkgs/by-name/zl/zlequalizer/package.nix | 15 ++++++++++----- pkgs/by-name/zl/zlsplitter/package.nix | 15 ++++++++++----- 12 files changed, 123 insertions(+), 49 deletions(-) diff --git a/pkgs/by-name/ct/ctagdrc/package.nix b/pkgs/by-name/ct/ctagdrc/package.nix index c9cca85c6382..7099451fdaab 100644 --- a/pkgs/by-name/ct/ctagdrc/package.nix +++ b/pkgs/by-name/ct/ctagdrc/package.nix @@ -48,6 +48,17 @@ stdenv.mkDerivation (finalAttrs: { libXtst ]; + env.NIX_CFLAGS_COMPILE = toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]; + enableParallelBuilding = true; postPatch = '' @@ -55,8 +66,6 @@ stdenv.mkDerivation (finalAttrs: { --replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE' substituteInPlace CMakeLists.txt \ --replace-fail 'include(cmake-include/CPM.cmake)' '# No CPM needed' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' ''; installPhase = '' diff --git a/pkgs/by-name/de/dexed/package.nix b/pkgs/by-name/de/dexed/package.nix index 3734ee0f27f3..6a699e941963 100644 --- a/pkgs/by-name/de/dexed/package.nix +++ b/pkgs/by-name/de/dexed/package.nix @@ -33,11 +33,6 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace Source/CMakeLists.txt \ --replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE' - '' - # LTO needs special setup on Linux - + lib.optionalString stdenv.hostPlatform.isLinux '' - substituteInPlace Source/CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' ''; strictDeps = true; @@ -68,6 +63,17 @@ stdenv.mkDerivation (finalAttrs: { "-ljack" ]); + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); + installPhase = let vst3Dir = diff --git a/pkgs/by-name/fi/fire/package.nix b/pkgs/by-name/fi/fire/package.nix index 67ea01bc1c43..1c82e81a96a2 100644 --- a/pkgs/by-name/fi/fire/package.nix +++ b/pkgs/by-name/fi/fire/package.nix @@ -108,11 +108,6 @@ stdenv.mkDerivation (finalAttrs: { # Regression tests require big sound files stored in LFS, skip them rm -v tests/RegressionTests.cpp '' - + lib.optionalString stdenv.hostPlatform.isLinux '' - # Remove hardcoded LTO flags: needs extra setup on Linux - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - '' + lib.optionalString (!finalAttrs.finalPackage.doCheck) '' substituteInPlace CMakeLists.txt \ --replace-fail 'include(Tests)' '# Not building tests' \ @@ -144,6 +139,17 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "Catch2_SOURCE_DIR" "${catch2_3.src}") ]; + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); + installPhase = '' runHook preInstall diff --git a/pkgs/by-name/pr/proteus/package.nix b/pkgs/by-name/pr/proteus/package.nix index 5c967aba8760..4f3e50a1d653 100644 --- a/pkgs/by-name/pr/proteus/package.nix +++ b/pkgs/by-name/pr/proteus/package.nix @@ -50,7 +50,13 @@ stdenv.mkDerivation rec { env.NIX_CFLAGS_COMPILE = toString [ # Support JACK output in the standalone application: "-DJUCE_JACK" - # Accommodate -flto: + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. "-ffat-lto-objects" ]; diff --git a/pkgs/by-name/qd/qdelay/package.nix b/pkgs/by-name/qd/qdelay/package.nix index 50ff33fa3933..5aadb56b08f1 100644 --- a/pkgs/by-name/qd/qdelay/package.nix +++ b/pkgs/by-name/qd/qdelay/package.nix @@ -61,10 +61,16 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}" ]; - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); installPhase = '' runHook preInstall diff --git a/pkgs/by-name/ri/ripplerx/package.nix b/pkgs/by-name/ri/ripplerx/package.nix index 8b7e94b36d49..670b2cff797d 100644 --- a/pkgs/by-name/ri/ripplerx/package.nix +++ b/pkgs/by-name/ri/ripplerx/package.nix @@ -61,15 +61,20 @@ stdenv.mkDerivation (finalAttrs: { "-lXrandr" ]; + env.NIX_CFLAGS_COMPILE = toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]; + # Fontconfig error: Cannot load default config file: No such file: (null) env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf"; - # LTO needs special setup on Linux - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; - installPhase = '' runHook preInstall diff --git a/pkgs/by-name/sg/sg-323/package.nix b/pkgs/by-name/sg/sg-323/package.nix index 23c9dbc9dee2..8299ca0f9aea 100644 --- a/pkgs/by-name/sg/sg-323/package.nix +++ b/pkgs/by-name/sg/sg-323/package.nix @@ -52,10 +52,16 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; - postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; + env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); installPhase = let diff --git a/pkgs/by-name/so/sonobus/package.nix b/pkgs/by-name/so/sonobus/package.nix index ccff9bc0cb01..416359bc5717 100644 --- a/pkgs/by-name/so/sonobus/package.nix +++ b/pkgs/by-name/so/sonobus/package.nix @@ -76,10 +76,18 @@ stdenv.mkDerivation (finalAttrs: { env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-rpath ${lib.makeLibraryPath (finalAttrs.runtimeDependencies)}"; dontPatchELF = true; # needed or nix will try to optimize the binary by removing "useless" rpath + env.NIX_CFLAGS_COMPILE = toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]; + postPatch = lib.optionalString (stdenv.hostPlatform.isLinux) '' - # needs special setup on Linux, dunno if it can work on Darwin - # Also, I get issues with linking without that, not sure why - sed -i -e '/juce::juce_recommended_lto_flags/d' CMakeLists.txt patchShebangs linux/install.sh ''; diff --git a/pkgs/by-name/va/vaporizer2/package.nix b/pkgs/by-name/va/vaporizer2/package.nix index b6c4fc02fc3d..6e4a34bfc4c5 100644 --- a/pkgs/by-name/va/vaporizer2/package.nix +++ b/pkgs/by-name/va/vaporizer2/package.nix @@ -31,10 +31,6 @@ stdenv.mkDerivation (finalAttrs: { }; postPatch = '' - # LTO needs special setup on Linux - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - rm -rf clap-juce-extensions ln -s ${finalAttrs.passthru.clapJuceExtensions} clap-juce-extensions ''; @@ -65,6 +61,17 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "USE_SYSTEM_JUCE" "ON") ]; + env.NIX_CFLAGS_COMPILE = toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]; + passthru.clapJuceExtensions = fetchFromGitHub { owner = "free-audio"; repo = "clap-juce-extensions"; diff --git a/pkgs/by-name/zl/zlcompressor/package.nix b/pkgs/by-name/zl/zlcompressor/package.nix index 9f6aac97c9d7..27d13226efc9 100644 --- a/pkgs/by-name/zl/zlcompressor/package.nix +++ b/pkgs/by-name/zl/zlcompressor/package.nix @@ -75,11 +75,16 @@ clangStdenv.mkDerivation (finalAttrs: { "-lXrandr" ]); - # LTO needs special setup on Linux - postPatch = lib.optionalString clangStdenv.hostPlatform.isLinux '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; + env.NIX_CFLAGS_COMPILE = lib.optionalString clangStdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); cmakeFlags = [ # see: https://github.com/ZL-Audio/ZlEqualizer#clone-and-build diff --git a/pkgs/by-name/zl/zlequalizer/package.nix b/pkgs/by-name/zl/zlequalizer/package.nix index 6beeec3a47df..c5b40446ea20 100644 --- a/pkgs/by-name/zl/zlequalizer/package.nix +++ b/pkgs/by-name/zl/zlequalizer/package.nix @@ -75,11 +75,16 @@ clangStdenv.mkDerivation (finalAttrs: { "-lXrandr" ]); - # LTO needs special setup on Linux - postPatch = lib.optionalString clangStdenv.hostPlatform.isLinux '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; + env.NIX_CFLAGS_COMPILE = lib.optionalString clangStdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); cmakeFlags = [ # see: https://github.com/ZL-Audio/ZLEqualizer#clone-and-build diff --git a/pkgs/by-name/zl/zlsplitter/package.nix b/pkgs/by-name/zl/zlsplitter/package.nix index 8923fdd3c230..31d1be13f68a 100644 --- a/pkgs/by-name/zl/zlsplitter/package.nix +++ b/pkgs/by-name/zl/zlsplitter/package.nix @@ -75,11 +75,16 @@ clangStdenv.mkDerivation (finalAttrs: { "-lXrandr" ]); - # LTO needs special setup on Linux - postPatch = lib.optionalString clangStdenv.hostPlatform.isLinux '' - substituteInPlace CMakeLists.txt \ - --replace-fail 'juce::juce_recommended_lto_flags' '# Not forcing LTO' - ''; + env.NIX_CFLAGS_COMPILE = lib.optionalString clangStdenv.hostPlatform.isLinux (toString [ + # juce, compiled in this build as part of a Git submodule, uses `-flto` as + # a Link Time Optimization flag, and instructs the plugin compiled here to + # use this flag to. This breaks the build for us. Using _fat_ LTO allows + # successful linking while still providing LTO benefits. If our build of + # `juce` was used as a dependency, we could have patched that `-flto` line + # in our juce's source, but that is not possible because it is used as a + # Git Submodule. + "-ffat-lto-objects" + ]); cmakeFlags = [ # see: https://github.com/ZL-Audio/ZlEqualizer#clone-and-build