diff --git a/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch b/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch new file mode 100644 index 000000000000..35f4c8252e5e --- /dev/null +++ b/pkgs/applications/audio/fire/0001-Remove-FetchContent-usage.patch @@ -0,0 +1,62 @@ +From fbf2ddd872db6a3640bc7d693356b99be9dd70f5 Mon Sep 17 00:00:00 2001 +From: OPNA2608 +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 + diff --git a/pkgs/applications/audio/fire/default.nix b/pkgs/applications/audio/fire/default.nix new file mode 100644 index 000000000000..54d5bba44661 --- /dev/null +++ b/pkgs/applications/audio/fire/default.nix @@ -0,0 +1,117 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, catch2 +, libX11 +, libXrandr +, libXinerama +, libXext +, libXcursor +, freetype +, alsa-lib +, 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; + sha256 = "sha256-X3pzTrNd0G6BouCDkr3dukQTFDzZ7qblIYxFQActKGE="; + }; + + patches = [ + ./0001-Remove-FetchContent-usage.patch + ]; + + postPatch = '' + # 1. Remove hardcoded LTO flags: needs extra setup on Linux, + # possibly broken on Darwin + # https://github.com/NixOS/nixpkgs/issues/19098 + # 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 [ + 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 + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 57b4773d5c22..934d48e6242a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28038,6 +28038,11 @@ with pkgs; filezilla = callPackage ../applications/networking/ftp/filezilla { }; + fire = darwin.apple_sdk_11_0.callPackage ../applications/audio/fire { + inherit (darwin.apple_sdk_11_0.frameworks) 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) {}; firefoxPackages = recurseIntoAttrs (callPackage ../applications/networking/browsers/firefox/packages.nix {});