summary refs log tree commit diff
path: root/pkgs/applications/audio/faust
diff options
context:
space:
mode:
authorBart Brouns <bart@magnetophon.nl>2023-04-03 16:04:07 +0200
committerBart Brouns <bart@magnetophon.nl>2023-05-18 15:22:02 +0200
commitd58c684ecfcfab0dfd2c4a499c3ffe76b92809f8 (patch)
tree20271a217119c8f0fa6f7068ce2510e5dcb03d1d /pkgs/applications/audio/faust
parente40b5250ab10f98a5343d78e2c6c83db6a6c4bec (diff)
faust: replace qt4 with qt5
Diffstat (limited to 'pkgs/applications/audio/faust')
-rw-r--r--pkgs/applications/audio/faust/faust2alqt.nix32
-rw-r--r--pkgs/applications/audio/faust/faust2jaqt.nix33
-rw-r--r--pkgs/applications/audio/faust/faust2lv2.nix10
3 files changed, 66 insertions, 9 deletions
diff --git a/pkgs/applications/audio/faust/faust2alqt.nix b/pkgs/applications/audio/faust/faust2alqt.nix
index 111d1c9e55744..1d86cc3f6c3f2 100644
--- a/pkgs/applications/audio/faust/faust2alqt.nix
+++ b/pkgs/applications/audio/faust/faust2alqt.nix
@@ -1,15 +1,41 @@
 { faust
 , alsa-lib
-, qt4
+, qtbase
+, writeText
+, makeWrapper
 }:
-
+let
+  # Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
+  wrapBinary = writeText "wrapBinary" ''
+    source ${makeWrapper}/nix-support/setup-hook
+    for p in $FILES; do
+      workpath=$PWD
+      cd -- "$(dirname "$p")"
+      binary=$(basename --suffix=.dsp "$p")
+      rm -f .$binary-wrapped
+      wrapProgram $binary --set QT_PLUGIN_PATH "${qtbase}/${qtbase.qtPluginPrefix}"
+      sed -i $binary -e 's@exec@cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" \&\& exec@g'
+      cd $workpath
+    done
+  '';
+in
 faust.wrapWithBuildEnv {
 
   baseName = "faust2alqt";
 
   propagatedBuildInputs = [
     alsa-lib
-    qt4
+    qtbase
   ];
 
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    for script in "$out"/bin/*; do
+      # append the wrapping code to the compilation script
+      cat ${wrapBinary} >> $script
+      # prevent the qmake error when running the script
+      sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" $script
+    done
+  '';
 }
diff --git a/pkgs/applications/audio/faust/faust2jaqt.nix b/pkgs/applications/audio/faust/faust2jaqt.nix
index 6bebd97ddd246..90498c9e3e3a7 100644
--- a/pkgs/applications/audio/faust/faust2jaqt.nix
+++ b/pkgs/applications/audio/faust/faust2jaqt.nix
@@ -1,11 +1,27 @@
 { faust
 , jack2
-, qt4
+, qtbase
 , libsndfile
 , alsa-lib
+, writeText
+, makeWrapper
 , which
 }:
-
+let
+  # Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
+  wrapBinary = writeText "wrapBinary" ''
+    source ${makeWrapper}/nix-support/setup-hook
+    for p in $FILES; do
+      workpath=$PWD
+      cd -- "$(dirname "$p")"
+      binary=$(basename --suffix=.dsp "$p")
+      rm -f .$binary-wrapped
+      wrapProgram $binary --set QT_PLUGIN_PATH "${qtbase}/${qtbase.qtPluginPrefix}"
+      sed -i $binary -e 's@exec@cd "$(dirname "$(readlink -f "''${BASH_SOURCE[0]}")")" \&\& exec@g'
+      cd $workpath
+    done
+  '';
+in
 faust.wrapWithBuildEnv {
 
   baseName = "faust2jaqt";
@@ -17,10 +33,21 @@ faust.wrapWithBuildEnv {
 
   propagatedBuildInputs = [
     jack2
-    qt4
+    qtbase
     libsndfile
     alsa-lib
     which
   ];
 
+
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    for script in "$out"/bin/*; do
+      # append the wrapping code to the compilation script
+      cat ${wrapBinary} >> $script
+      # prevent the qmake error when running the script
+      sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" $script
+    done
+  '';
 }
diff --git a/pkgs/applications/audio/faust/faust2lv2.nix b/pkgs/applications/audio/faust/faust2lv2.nix
index 51d956b140364..b7e9ffb488c43 100644
--- a/pkgs/applications/audio/faust/faust2lv2.nix
+++ b/pkgs/applications/audio/faust/faust2lv2.nix
@@ -1,15 +1,19 @@
 { boost
 , faust
 , lv2
-, qt4
+, qtbase
 , which
-
 }:
 
 faust.wrapWithBuildEnv {
 
   baseName = "faust2lv2";
 
-  propagatedBuildInputs = [ boost lv2 qt4 which ];
+  propagatedBuildInputs = [ boost lv2 qtbase ];
+
+  dontWrapQtApps = true;
 
+  preFixup = ''
+    sed -i "/QMAKE=/c\ QMAKE="${qtbase.dev}/bin/qmake"" "$out"/bin/faust2lv2;
+  '';
 }