forked from mirrors/nixpkgs
* Quick attempt at fixing stdenv-mingw.
svn path=/nixpkgs/trunk/; revision=7519
This commit is contained in:
parent
6547796515
commit
a26e70c2af
|
@ -4,7 +4,6 @@ origShell=$SHELL
|
|||
origGcc=$GCC
|
||||
|
||||
source $STDENV/setup
|
||||
source $SUBSTITUTE
|
||||
|
||||
mkdir $OUT
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue