From da415351f2e6c7c36abb795820d05095879b24eb Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Thu, 2 Jan 2025 22:40:29 +0100 Subject: [PATCH 1/4] faust2: fix cross / strictDeps build --- pkgs/applications/audio/faust/faust2.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/audio/faust/faust2.nix b/pkgs/applications/audio/faust/faust2.nix index a178dac8b47f..3588f2cc639b 100644 --- a/pkgs/applications/audio/faust/faust2.nix +++ b/pkgs/applications/audio/faust/faust2.nix @@ -78,12 +78,24 @@ let passthru = { inherit wrap wrapWithBuildEnv faust2ApplBase; }; preConfigure = '' + # include llvm-config in path + export PATH="${lib.getDev llvm_18}/bin:$PATH" cd build - sed -i 's@LIBNCURSES_PATH ?= .*@LIBNCURSES_PATH ?= ${ncurses_static}/lib/libncurses.a@' Make.llvm.static substituteInPlace Make.llvm.static \ --replace 'mkdir -p $@ && cd $@ && ar -x ../../$<' 'mkdir -p $@ && cd $@ && ar -x ../source/build/lib/libfaust.a && cd ../source/build/' substituteInPlace Make.llvm.static \ - --replace 'rm -rf $(TMP)' ' ' + --replace 'rm -rf $(TMP)' ' ' \ + --replace-fail "ar" "${stdenv.cc.targetPrefix}ar" + sed -i 's@LIBNCURSES_PATH ?= .*@LIBNCURSES_PATH ?= ${ncurses_static}/lib/libncurses.a@' Make.llvm.static + cd .. + shopt -s globstar + for f in **/Makefile **/Makefile.library **/CMakeLists.txt build/Make.llvm.static embedded/faustjava/faust2engine architecture/autodiff/autodiff.sh source/tools/faust2appls/* **/llvm.cmake tools/benchmark/faust2object; do + echo $f "llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" + substituteInPlace $f \ + --replace-quiet "llvm-config" "llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}" + done + shopt -u globstar + cd build ''; cmakeFlags = [ From 546620819efe0188e97ea2375816d5577e8eb5e8 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Thu, 2 Jan 2025 22:40:29 +0100 Subject: [PATCH 2/4] faust2jaqt: fix strictDeps build --- pkgs/applications/audio/faust/faust2jaqt.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/audio/faust/faust2jaqt.nix b/pkgs/applications/audio/faust/faust2jaqt.nix index 2fe663431aac..5429d1bfb45a 100644 --- a/pkgs/applications/audio/faust/faust2jaqt.nix +++ b/pkgs/applications/audio/faust/faust2jaqt.nix @@ -1,4 +1,5 @@ { + bash, faust, jack2, qtbase, @@ -32,6 +33,10 @@ faust.wrapWithBuildEnv { "faust2jackserver" ]; + buildInputs = [ + bash + ]; + propagatedBuildInputs = [ jack2 qtbase From 249322d5a40474f47c78d49488ed3b6932bed6f7 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Thu, 2 Jan 2025 22:40:29 +0100 Subject: [PATCH 3/4] faust2lv2: fix cross / strictDeps build --- pkgs/applications/audio/faust/faust2lv2.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/audio/faust/faust2lv2.nix b/pkgs/applications/audio/faust/faust2lv2.nix index 92c2e9df9423..4a310440ad8a 100644 --- a/pkgs/applications/audio/faust/faust2lv2.nix +++ b/pkgs/applications/audio/faust/faust2lv2.nix @@ -1,4 +1,5 @@ { + bash, boost, faust, lv2, @@ -9,6 +10,10 @@ faust.wrapWithBuildEnv { baseName = "faust2lv2"; + buildInputs = [ + bash + ]; + propagatedBuildInputs = [ boost lv2 From 787fa53e45a7757821b4744511e7b422323931c1 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Thu, 2 Jan 2025 21:08:35 +0100 Subject: [PATCH 4/4] faustPhysicalModeling: fix strictDeps build, disable PIE --- .../fa/faustPhysicalModeling/package.nix | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/fa/faustPhysicalModeling/package.nix b/pkgs/by-name/fa/faustPhysicalModeling/package.nix index 09ce68b451c9..572a04b492f4 100644 --- a/pkgs/by-name/fa/faustPhysicalModeling/package.nix +++ b/pkgs/by-name/fa/faustPhysicalModeling/package.nix @@ -1,6 +1,7 @@ { stdenv, lib, + bash, fetchFromGitHub, faust2jaqt, faust2lv2, @@ -16,28 +17,45 @@ stdenv.mkDerivation rec { sha256 = "sha256-j5Qg/H7aMBZ6A8gh6v6+ICxmCZ7ya2tVF2FjueVtvHo="; }; - buildInputs = [ + nativeBuildInputs = [ faust2jaqt faust2lv2 ]; + buildInputs = [ + bash + ]; + + # ld: /nix/store/*-gcc-14-20241116/lib/gcc/x86_64-unknown-linux-gnu/14.2.1/crtbegin.o: + # relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a PIE object + hardeningDisable = [ "pie" ]; + dontWrapQtApps = true; buildPhase = '' + runHook preBuild + cd examples/physicalModeling for f in *MIDI.dsp; do faust2jaqt -time -vec -double -midi -nvoices 16 -t 99999 $f faust2lv2 -time -vec -double -gui -nvoices 16 -t 99999 $f done + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out/lib/lv2 $out/bin mv *.lv2/ $out/lib/lv2 for f in $(find . -executable -type f); do cp $f $out/bin/ done + patchShebangs --host $out/bin + + runHook postInstall ''; meta = with lib; { @@ -46,5 +64,7 @@ stdenv.mkDerivation rec { license = licenses.mit; platforms = platforms.linux; maintainers = with maintainers; [ magnetophon ]; + # compiles stuff for the build platform, difficult to do properly + broken = stdenv.hostPlatform != stdenv.buildPlatform; }; }