nixpkgs/pkgs/applications/audio/faust/faust2alqt.nix
Artturin 88b60b61b9 treewide: fix cross makeWrapper eval
fix `error: makeWrapper/makeShellWrapper must be in nativeBuildInputs`

The `faust.faust2ApplBase` in used in `faust2sc` + more, requires
changes because it puts all the callPackage arguments in the
`mkDerivation` call and thus causes a eval fail

`nix-eval-jobs --flake ".#legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform" --workers 2 2>/dev/null --impure | jq 'select(.error?) | select(.error | match ("makeWrapper/makeShellWrapper"))'
2023-08-15 01:20:56 +03:00

41 lines
1 KiB
Nix

{ faust
, alsa-lib
, qtbase
, writeText
, buildPackages
}:
let
# Wrap the binary coming out of the the compilation script, so it knows QT_PLUGIN_PATH
wrapBinary = writeText "wrapBinary" ''
source ${buildPackages.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
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
'';
}