treewide: juce_recommended_lto_flags -> ffat-lto-objects

This commit is contained in:
Bart Brouns
2026-01-07 13:05:18 +01:00
parent 6dc9b7737e
commit ee5b3e0592
12 changed files with 123 additions and 49 deletions
+11 -2
View File
@@ -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 = ''
+11 -5
View File
@@ -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 =
+11 -5
View File
@@ -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
+7 -1
View File
@@ -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"
];
+10 -4
View File
@@ -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
+11 -6
View File
@@ -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
+10 -4
View File
@@ -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
+11 -3
View File
@@ -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
'';
+11 -4
View File
@@ -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";
+10 -5
View File
@@ -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
+10 -5
View File
@@ -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
+10 -5
View File
@@ -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