about summary refs log tree commit diff
path: root/pkgs/applications/audio/faust
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-06-14 15:14:04 +0300
committerGitHub <noreply@github.com>2023-06-14 15:14:04 +0300
commite64b8e894659bd2bc0888eea2fc0c49f20ebba30 (patch)
treece8b3f3cfc043c7e4c3c543eb5f042ecfb4785be /pkgs/applications/audio/faust
parent38616ad5740199aa4146cd17af3f2a061f99dcfc (diff)
parent7735e9b13843365cbc57e78e7d9e30a62de27f49 (diff)
Merge pull request #215561 from magnetophon/faust_QT5
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;
+  '';
 }