fire: 1.0.0.3 -> 1.0.1-unstable-2024-10-22, modernise, fix Darwin (#358181)

This commit is contained in:
Cosima Neidahl 2024-11-28 12:07:17 +01:00 committed by GitHub
commit 201bef8a3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 129 additions and 185 deletions

View File

@ -1,62 +0,0 @@
From fbf2ddd872db6a3640bc7d693356b99be9dd70f5 Mon Sep 17 00:00:00 2001
From: OPNA2608 <christoph.neidahl@gmail.com>
Date: Thu, 18 Aug 2022 20:12:07 +0200
Subject: [PATCH] Remove FetchContent usage
---
CMakeLists.txt | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 84c66a7..5234903 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,20 +30,9 @@ project(Fire VERSION 0.9.9)
# or
# add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE
-include(FetchContent)
-FetchContent_Declare(
- JUCE
- GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
- GIT_TAG 7.0.1
-)
-FetchContent_MakeAvailable(JUCE)
-
-FetchContent_Declare(
- readerwriterqueue
- GIT_REPOSITORY https://github.com/cameron314/readerwriterqueue
- GIT_TAG v1.0.6
-)
-FetchContent_MakeAvailable(readerwriterqueue)
+add_subdirectory(JUCE EXCLUDE_FROM_ALL)
+
+add_subdirectory(readerwriterqueue EXCLUDE_FROM_ALL)
# If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your
# system. This setup should be done before calling `juce_add_plugin`.
@@ -172,13 +161,7 @@ set(TestFiles
test/CatchMain.cpp
test/PluginTest.cpp)
-# Download the tagged version of Catch2
-Include(FetchContent)
-FetchContent_Declare(
- Catch2
- GIT_REPOSITORY https://github.com/catchorg/Catch2.git
- GIT_TAG v2.13.7)
-FetchContent_MakeAvailable(Catch2)
+add_subdirectory(Catch2 EXCLUDE_FROM_ALL)
# Setup the test executable, again C++ 20 please
add_executable(Tests ${TestFiles})
@@ -199,4 +182,4 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/test PREFIX "" FILES ${TestFiles})
# We have to manually provide the source directory here for now
# https://github.com/catchorg/Catch2/issues/2026
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
-catch_discover_tests(Tests)
\ No newline at end of file
+catch_discover_tests(Tests)
--
2.36.0

View File

@ -1,118 +0,0 @@
{ stdenv
, lib
, fetchFromGitHub
, cmake
, pkg-config
, catch2
, libX11
, libXrandr
, libXinerama
, libXext
, libXcursor
, freetype
, alsa-lib
, Accelerate
, Cocoa
, WebKit
, CoreServices
, DiscRecording
, CoreAudioKit
, MetalKit
, simd
}:
let
# FetchContent replacement, check CMakeLists.txt for requested versions (Nixpkgs' Catch2 works)
readerwriterqueue = fetchFromGitHub {
owner = "cameron314";
repo = "readerwriterqueue";
rev = "v1.0.6";
sha256 = "sha256-g7NX7Ucl5GWw3u6TiUOITjhv7492ByTzACtWR0Ph2Jc=";
};
in
stdenv.mkDerivation rec {
pname = "fire";
version = "1.0.0.3";
src = fetchFromGitHub {
owner = "jerryuhoo";
repo = "Fire";
rev = "v${version}";
fetchSubmodules = true;
hash = "sha256-X3pzTrNd0G6BouCDkr3dukQTFDzZ7qblIYxFQActKGE=";
};
patches = [
./0001-Remove-FetchContent-usage.patch
];
postPatch = ''
# 1. Remove hardcoded LTO flags: needs extra setup on Linux,
# possibly broken on Darwin
# 2. Disable automatic copying of built plugins during buildPhase, it defaults
# into user home and we want to have building & installing separated.
sed -i \
-e '/juce::juce_recommended_lto_flags/d' \
-e 's/COPY_PLUGIN_AFTER_BUILD TRUE/COPY_PLUGIN_AFTER_BUILD FALSE/g' \
CMakeLists.txt
'';
preConfigure = ''
ln -s ${readerwriterqueue} readerwriterqueue
ln -s ${catch2.src} Catch2
'';
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
libX11
libXrandr
libXinerama
libXext
libXcursor
freetype
alsa-lib
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Accelerate
Cocoa
WebKit
CoreServices
DiscRecording
CoreAudioKit
MetalKit
simd
];
installPhase = let
vst3Dir = "${placeholder "out"}/${if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3"}";
auDir = "${placeholder "out"}/Library/Audio/Plug-Ins/Components";
in ''
runHook preInstall
mkdir -p ${vst3Dir}
# Exact path of the build artefact depends on used CMAKE_BUILD_TYPE
cp -R Fire_artefacts/*/VST3/* ${vst3Dir}/
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p ${auDir}
cp -R Fire_artefacts/*/AU/* ${auDir}/
'' + ''
runHook postInstall
'';
# Fails to find fp.h on its own
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/CarbonCore.framework/Versions/Current/Headers/";
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
meta = with lib; {
description = "Multi-band distortion plugin by Wings";
homepage = "https://github.com/jerryuhoo/Fire";
license = licenses.agpl3Only; # Not clarified if Only or Plus
platforms = platforms.unix;
maintainers = with maintainers; [ OPNA2608 ];
};
}

View File

@ -0,0 +1,129 @@
{
stdenv,
lib,
fetchFromGitHub,
unstableGitUpdater,
catch2_3,
cmake,
pkg-config,
libX11,
libXrandr,
libXinerama,
libXext,
libXcursor,
freetype,
alsa-lib,
apple-sdk_11,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "fire";
version = "1.0.1-unstable-2024-10-22";
src = fetchFromGitHub {
owner = "jerryuhoo";
repo = "Fire";
rev = "4c3275caa0dbd9e65c6c3d574cc5ac1c828e529a";
fetchSubmodules = true;
hash = "sha256-DyYP/uDawa+m2FtNvEvu36iRl6zfMyGNMMad5f/rX4k=";
};
postPatch =
''
# Disable automatic copying of built plugins during buildPhase, it defaults
# into user home and we want to have building & installing separated.
substituteInPlace CMakeLists.txt \
--replace-fail 'COPY_PLUGIN_AFTER_BUILD TRUE' 'COPY_PLUGIN_AFTER_BUILD FALSE'
''
+ 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' \
--replace-fail 'include(Benchmarks)' '# Not building benchmark test'
'';
strictDeps = true;
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
libX11
libXrandr
libXinerama
libXext
libXcursor
freetype
alsa-lib
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ];
cmakeFlags = [
(lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true)
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CATCH2" "${catch2_3.src}")
];
installPhase =
let
pathMappings =
[
{
from = "LV2";
to = "${placeholder "out"}/${
if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/LV2" else "lib/lv2"
}";
}
{
from = "VST3";
to = "${placeholder "out"}/${
if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/VST3" else "lib/vst3"
}";
}
# this one's a guess, don't know where ppl have agreed to put them yet
{
from = "CLAP";
to = "${placeholder "out"}/${
if stdenv.hostPlatform.isDarwin then "Library/Audio/Plug-Ins/CLAP" else "lib/clap"
}";
}
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
{
from = "AU";
to = "${placeholder "out"}/Library/Audio/Plug-Ins/Components";
}
];
in
''
runHook preInstall
''
+ lib.strings.concatMapStringsSep "\n" (entry: ''
mkdir -p ${entry.to}
# Exact path of the build artefact depends on used CMAKE_BUILD_TYPE
cp -r Fire_artefacts/*/${entry.from}/* ${entry.to}/
'') pathMappings
+ ''
runHook postInstall
'';
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; };
meta = {
description = "Multi-band distortion plugin by Wings";
homepage = "https://github.com/jerryuhoo/Fire";
license = lib.licenses.agpl3Only; # Not clarified if Only or Plus
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ OPNA2608 ];
};
})

View File

@ -13950,11 +13950,6 @@ with pkgs;
inherit (darwin.apple_sdk_11_0.frameworks) CoreServices Security;
};
fire = darwin.apple_sdk_11_0.callPackage ../applications/audio/fire {
inherit (darwin.apple_sdk_11_0.frameworks) Accelerate Cocoa WebKit CoreServices DiscRecording CoreAudioKit MetalKit;
inherit (darwin.apple_sdk_11_0.libs) simd;
};
buildMozillaMach = opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) { };
firefox-unwrapped = import ../applications/networking/browsers/firefox/packages/firefox.nix {