diff options
Diffstat (limited to 'pkgs/build-support/wrapper-common/utils.bash')
-rw-r--r-- | pkgs/build-support/wrapper-common/utils.bash | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash index f773270f7de..cb3552ebc54 100644 --- a/pkgs/build-support/wrapper-common/utils.bash +++ b/pkgs/build-support/wrapper-common/utils.bash @@ -129,3 +129,38 @@ expandResponseParams() { fi done } + +checkLinkType() { + local arg mode + type="dynamic" + for arg in "$@"; do + if [[ "$arg" = -static ]]; then + type="static" + elif [[ "$arg" = -static-pie ]]; then + type="static-pie" + fi + done + echo "$type" +} + +# When building static-pie executables we cannot have rpath +# set. At least glibc requires rpath to be empty +filterRpathFlags() { + local linkType=$1 ret="" i + shift + + if [[ "$linkType" == "static-pie" ]]; then + while [[ "$#" -gt 0 ]]; do + i="$1"; shift 1 + if [[ "$i" == -rpath ]]; then + # also skip its argument + shift + else + ret+="$i " + fi + done + else + ret=$@ + fi + echo $ret +} |