* Don't replace /opt if it's followed by something other than

whitespace or a /, otherwise strings such as /foo/opticaldrive.c
  will be broken.

svn path=/nixpkgs/branches/stdenv-updates/; revision=31793
This commit is contained in:
Eelco Dolstra 2012-01-23 13:16:51 +00:00
parent 3cf71dcfd1
commit 1e886749b5

View File

@ -3,10 +3,11 @@ addCMakeParams() {
}
fixCmakeFiles() {
# Replace occurences of /usr and /opt by /var/empty.
echo "fixing cmake files..."
find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print |
while read fn; do
sed -e 's|/usr|/var/empty|g' -e 's|/opt|/var/empty|g' < "$fn" > "$fn.tmp"
sed -e 's^/usr\([ /]\|$\)^/var/empty\1^g' -e 's^/opt\([ /]\|$\)^/var/empty\1^g' < "$fn" > "$fn.tmp"
mv "$fn.tmp" "$fn"
done
}