diff --git a/pkgs/build-support/substitute/generic-substituter.sh b/pkgs/build-support/substitute/generic-substituter.sh index 085e749c3313..51db11bfa79e 100644 --- a/pkgs/build-support/substitute/generic-substituter.sh +++ b/pkgs/build-support/substitute/generic-substituter.sh @@ -3,14 +3,20 @@ source $substitute args= +target=$out +if test -n "$dir"; then + target=$out/$dir/$name + ensureDir $out/$dir +fi + # Select all environment variables that start with a lowercase character. for envVar in $(env | sed "s/^[^a-z].*//" | sed "s/^\([^=]*\)=.*/\1/"); do echo "$envVar -> ${!envVar}" args="$args --subst-var $envVar" done -substitute $src $out $args +substitute $src $target $args if test -n "$isExecutable"; then - chmod +x $out + chmod +x $target fi