From 04de2db1d16fe2967227c21acca230ee5fa20a0d Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Sat, 14 Jul 2018 10:39:25 -0400 Subject: [PATCH] opengl: Disable pipefail to allow early out Prior operator || and putting builtins subshells workaround didn't work with in all build shells. --- pkgs/opengl/auto-virtualgl.sh | 22 ++++++++-------------- pkgs/opengl/default.nix | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/pkgs/opengl/auto-virtualgl.sh b/pkgs/opengl/auto-virtualgl.sh index 12d7acf..18bd597 100755 --- a/pkgs/opengl/auto-virtualgl.sh +++ b/pkgs/opengl/auto-virtualgl.sh @@ -1,6 +1,3 @@ -#!/bin/bash - - # Stream producers # # These produce a stream of escaped new-line separated items @@ -9,22 +6,14 @@ # Stream the given arguments # VGL_sourceS() { - ( printf '%q\n' "$@" ) || (( $? == 141 )) -} - - -# Stream the results of the given command -# -VGL_systemS() { - declare -a command=("$@") - ( eval $(printf '%q ' "${command[@]}") ) || (( $? == 141 )) + printf '%q\n' "$@" } # Stream the results of find (correctly escapes all filenames) # VGL_findS() { declare -a options=("$@") file - VGL_systemS find "${options[@]}" -print0 | + find "${options[@]}" -print0 | while read -d '' -r file; do VGL_sourceS "$file" done @@ -34,7 +23,7 @@ VGL_findS() { # VGL_elfLibsS() { declare file=$1 line - VGL_systemS ldd "$file" | + ldd "$file" | while read line; do line=${line#$'\t'} case "$line" in @@ -136,6 +125,9 @@ VGL_isLibGL() { # Find all executables that depend on libGL and add a libvglfaker.so dependency # VGL_autoAddVGL() { + declare opts=$(shopt -p) output + set +o pipefail + echo "Inserting VirtualGL into OpenGL executables in $prefix..." >&2 for output in $outputs; do @@ -155,6 +147,8 @@ VGL_autoAddVGL() { done } done + + eval "$opts" } postFixupHooks+=(VGL_autoAddVGL) diff --git a/pkgs/opengl/default.nix b/pkgs/opengl/default.nix index 99cbde3..1774a22 100644 --- a/pkgs/opengl/default.nix +++ b/pkgs/opengl/default.nix @@ -3,7 +3,7 @@ # Add a setup hook to the mesa_noglu package that automatically adds # a libvglfaker.so dependency to executables that depend on libGL.so. -{ super, lib, buildEnv, makeSetupHook, file }: +{ super, lib, buildEnv, makeSetupHook, file, bash }: let autoVirtualGLHook =