From d58c684ecfcfab0dfd2c4a499c3ffe76b92809f8 Mon Sep 17 00:00:00 2001 From: Bart Brouns Date: Mon, 3 Apr 2023 16:04:07 +0200 Subject: [PATCH] faust: replace qt4 with qt5 --- pkgs/applications/audio/faust/faust2alqt.nix | 32 +++++++++++++++++-- pkgs/applications/audio/faust/faust2jaqt.nix | 33 ++++++++++++++++++-- pkgs/applications/audio/faust/faust2lv2.nix | 10 ++++-- pkgs/top-level/all-packages.nix | 6 ++-- 4 files changed, 69 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/audio/faust/faust2alqt.nix b/pkgs/applications/audio/faust/faust2alqt.nix index 111d1c9e5574..1d86cc3f6c3f 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 6bebd97ddd24..90498c9e3e3a 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 51d956b14036..b7e9ffb488c4 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; + ''; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 930a9c58276d..ca5be7eda6bb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37850,7 +37850,7 @@ with pkgs; faust2 = callPackage ../applications/audio/faust/faust2.nix { }; - faust2alqt = callPackage ../applications/audio/faust/faust2alqt.nix { }; + faust2alqt = libsForQt5.callPackage ../applications/audio/faust/faust2alqt.nix { }; faust2alsa = callPackage ../applications/audio/faust/faust2alsa.nix { }; @@ -37862,11 +37862,11 @@ with pkgs; faust2jackrust = callPackage ../applications/audio/faust/faust2jackrust.nix { }; - faust2jaqt = callPackage ../applications/audio/faust/faust2jaqt.nix { }; + faust2jaqt = libsForQt5.callPackage ../applications/audio/faust/faust2jaqt.nix { }; faust2ladspa = callPackage ../applications/audio/faust/faust2ladspa.nix { }; - faust2lv2 = callPackage ../applications/audio/faust/faust2lv2.nix { }; + faust2lv2 = libsForQt5.callPackage ../applications/audio/faust/faust2lv2.nix { }; faustlive = callPackage ../applications/audio/faust/faustlive.nix { };