3
0
Fork 0
forked from mirrors/nixpkgs

* Quick attempt at fixing stdenv-mingw.

svn path=/nixpkgs/trunk/; revision=7519
This commit is contained in:
Eelco Dolstra 2006-12-31 19:07:33 +00:00
parent 6547796515
commit a26e70c2af
2 changed files with 46 additions and 1 deletions

View file

@ -4,7 +4,6 @@ origShell=$SHELL
origGcc=$GCC
source $STDENV/setup
source $SUBSTITUTE
mkdir $OUT

View file

@ -29,6 +29,52 @@ header() {
stopNest() {
echo "Nothing to do"
}
# !!! Awful copy&paste.
substitute() {
local input="\$1"
local output="\$2"
local -a params=("\$@")
local sedScript=\$NIX_BUILD_TOP/.sedargs
rm -f \$sedScript
touch \$sedScript
local n p pattern replacement varName
for ((n = 2; n < \${#params[*]}; n += 1)); do
p=\${params[\$n]}
if test "\$p" = "--replace"; then
pattern=\${params[\$((n + 1))]}
replacement=\${params[\$((n + 2))]}
n=\$((n + 2))
echo "s^\$pattern^\$replacement^g" >> \$sedScript
sedArgs=("\${sedArgs[@]}" "-e" )
fi
if test "\$p" = "--subst-var"; then
varName=\${params[\$((n + 1))]}
n=\$((n + 1))
echo "s^@\${varName}@^\${!varName}^g" >> \$sedScript
fi
if test "\$p" = "--subst-var-by"; then
varName=\${params[\$((n + 1))]}
replacement=\${params[\$((n + 2))]}
n=\$((n + 2))
echo "s^@\${varName}@^\$replacement^g" >> \$sedScript
fi
done
sed -f \$sedScript < "\$input" > "\$output".tmp
if test -x "\$output"; then
chmod +x "\$output".tmp
fi
mv -f "\$output".tmp "\$output"
}
EOF
chmod +x $out/setup