mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-07 23:04:00 +01:00
juce: build Projucer and add projucerHook
This commit is contained in:
parent
f490651aba
commit
edcc227d00
5 changed files with 137 additions and 2 deletions
33
doc/hooks/juce.section.md
Normal file
33
doc/hooks/juce.section.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# `juce.projucerHook` {#juce-projucer-hook}
|
||||
|
||||
[Projucer](https://juce.com/tutorials/tutorial_new_projucer_project/) is a graphical project management utility and build system for the [JUCE](https://juce.com/) audio programming framework. It is available in nixpkgs under the `juce` package.
|
||||
|
||||
The `juce.projucerHook` setup hook overrides the configure and install phases. It is only supported on Linux and requires your project's `.jucer` file to contain a `LinuxMakefile` exporter.
|
||||
|
||||
## Example {#juce-projucer-hook-example}
|
||||
|
||||
```nix
|
||||
{
|
||||
juce,
|
||||
stdenv,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
# ...
|
||||
nativeBuildInputs = [ juce.projucerHook ];
|
||||
|
||||
jucerFile = "Microbiome.jucer";
|
||||
|
||||
dontUseProjucerInstall = true;
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
## Variables controlling `juce.projucerHook` {#juce-projucer-hook-variables}
|
||||
|
||||
### `dontUseProjucerConfigure`
|
||||
|
||||
Disables `projucerConfigurePhase`
|
||||
|
||||
### `dontUseProjucerInstall`
|
||||
|
||||
Disables `projucerInstallPhase`
|
||||
14
pkgs/by-name/ju/juce/cmake_extras_projucer_only.patch
Normal file
14
pkgs/by-name/ju/juce/cmake_extras_projucer_only.patch
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt
|
||||
index 21f61d0d18..db359dbbec 100644
|
||||
--- a/extras/CMakeLists.txt
|
||||
+++ b/extras/CMakeLists.txt
|
||||
@@ -31,9 +31,4 @@
|
||||
# ==============================================================================
|
||||
|
||||
set(CMAKE_FOLDER extras)
|
||||
-add_subdirectory(AudioPerformanceTest)
|
||||
-add_subdirectory(AudioPluginHost)
|
||||
-add_subdirectory(BinaryBuilder)
|
||||
-add_subdirectory(NetworkGraphicsDemo)
|
||||
add_subdirectory(Projucer)
|
||||
-add_subdirectory(UnitTestRunner)
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
fetchFromGitHub,
|
||||
|
||||
# Native build inputs
|
||||
autoPatchelfHook,
|
||||
cmake,
|
||||
pkg-config,
|
||||
makeWrapper,
|
||||
|
||||
# Dependencies
|
||||
alsa-lib,
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
libglvnd,
|
||||
webkitgtk_4_1,
|
||||
pcre2,
|
||||
ladspa-sdk,
|
||||
libsysprof-capture,
|
||||
util-linuxMinimal,
|
||||
libselinux,
|
||||
|
|
@ -28,8 +29,17 @@
|
|||
libxtst,
|
||||
sqlite,
|
||||
fontconfig,
|
||||
|
||||
libGL,
|
||||
libx11,
|
||||
libxcursor,
|
||||
libxext,
|
||||
libxinerama,
|
||||
libxrandr,
|
||||
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
callPackage,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
|
|
@ -47,12 +57,13 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
# Adapted from https://gitlab.archlinux.org/archlinux/packaging/packages/juce/-/raw/4e6d34034b102af3cd762a983cff5dfc09e44e91/juce-6.1.2-cmake_install.patch
|
||||
# for Juce 8.0.4.
|
||||
./juce-8.0.4-cmake_install.patch
|
||||
./cmake_extras_projucer_only.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
cmake
|
||||
pkg-config
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
|
@ -60,6 +71,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
curl # libcurl.so
|
||||
(lib.getLib stdenv.cc.cc) # libstdc++.so libgcc_s.so
|
||||
pcre2 # libpcre2.pc
|
||||
ladspa-sdk
|
||||
libsysprof-capture
|
||||
libthai
|
||||
libdatrie
|
||||
|
|
@ -81,6 +93,22 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
propagatedBuildInputs = [ fontconfig ];
|
||||
|
||||
runtimeDependencies = [
|
||||
libGL
|
||||
libx11
|
||||
libxcursor
|
||||
libxext
|
||||
libxinerama
|
||||
libxrandr
|
||||
];
|
||||
|
||||
cmakeFlags = [ "-DJUCE_BUILD_EXTRAS=ON" ];
|
||||
|
||||
postInstall = ''
|
||||
cp extras/Projucer/Projucer_artefacts/Release/Projucer $out/bin/Projucer
|
||||
ln -s $out/bin/Projucer $out/bin/projucer
|
||||
'';
|
||||
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
];
|
||||
|
|
@ -90,6 +118,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
projucerHook = callPackage ./projucerHook.nix { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
|||
49
pkgs/by-name/ju/juce/projucer-hook.sh
Normal file
49
pkgs/by-name/ju/juce/projucer-hook.sh
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# shellcheck disable=SC2034
|
||||
|
||||
set -e
|
||||
|
||||
projucerConfigurePhase() {
|
||||
runHook preConfigure
|
||||
|
||||
Projucer --set-global-search-path linux defaultJuceModulePath @src@/modules
|
||||
if [ -n "${jucerUserModules-}" ]; then
|
||||
Projucer --set-global-search-path linux defaultUserModulePath "$jucerUserModules"
|
||||
fi
|
||||
Projucer --resave "${jucerFile:-$pname.jucer}"
|
||||
|
||||
runHook postConfigure
|
||||
}
|
||||
|
||||
projucerInstallPhase() {
|
||||
runHook preInstall
|
||||
|
||||
find build -maxdepth 1 -executable -type f -not -name "juce_*" | while IFS= read -r -d '' f; do
|
||||
# shellcheck disable=SC2154
|
||||
mkdir -p "$out"/bin
|
||||
cp "$f" "$out"/bin
|
||||
done
|
||||
|
||||
runHook postInstall
|
||||
}
|
||||
|
||||
projucerPreBuild() {
|
||||
# setting the makefile attribute screws up paths
|
||||
cd Builds/LinuxMakefile
|
||||
}
|
||||
|
||||
if [ -z "${dontUseProjucerConfigure-}" ] && [ -z "${configurePhase-}" ]; then
|
||||
configurePhase=projucerConfigurePhase
|
||||
preBuildHooks+=(projucerPreBuild)
|
||||
makeFlags+=(
|
||||
all
|
||||
"Config=Release"
|
||||
"JUCE_VST3DESTDIR=$out/lib/vst3"
|
||||
"JUCE_VSTDESTDIR=$out/lib/vst"
|
||||
"JUCE_LV2DESTDIR=$out/lib/lv2"
|
||||
)
|
||||
enableParallelBuilding=true
|
||||
fi
|
||||
|
||||
if [ -z "${dontUseProjucerInstall-}" ] && [ -z "${installPhase-}" ]; then
|
||||
installPhase=projucerInstallPhase
|
||||
fi
|
||||
10
pkgs/by-name/ju/juce/projucerHook.nix
Normal file
10
pkgs/by-name/ju/juce/projucerHook.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
makeSetupHook,
|
||||
lib,
|
||||
callPackage,
|
||||
}:
|
||||
makeSetupHook {
|
||||
name = "projucer-hook";
|
||||
propagatedBuildInputs = [ (callPackage ./package.nix { }) ];
|
||||
meta.platforms = lib.platforms.linux;
|
||||
} ./projucer-hook.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue