Author: eelco
Date: Fri Jan 20 15:10:28 2012
New Revision: 31736
URL: https://nixos.org/websvn/nix/?rev=31736&sc=1

Log:
* cmake: don't use replace-literal.

Modified:
   
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/default.nix
   
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/setup-hook.sh

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/default.nix
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/default.nix
     Fri Jan 20 12:29:13 2012        (r31735)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/default.nix
     Fri Jan 20 15:10:28 2012        (r31736)
@@ -39,15 +39,12 @@
 
   setupHook = ./setup-hook.sh;
 
-  postUnpack =
-    ''
-      dontUseCmakeConfigure=1
-      source $setupHook
-      fixCmakeFiles $sourceRoot
-    '';
+  dontUseCmakeConfigure = true;
 
   preConfigure = optionalString (stdenv ? glibc)
     ''
+      source $setupHook
+      fixCmakeFiles .
       substituteInPlace Modules/Platform/UnixPaths.cmake --subst-var-by glibc 
${stdenv.glibc}
     '';
 

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/setup-hook.sh
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/setup-hook.sh
   Fri Jan 20 12:29:13 2012        (r31735)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/development/tools/build-managers/cmake/setup-hook.sh
   Fri Jan 20 15:10:28 2012        (r31736)
@@ -1,36 +1,34 @@
-addCMakeParams()
-{
+addCMakeParams() {
     addToSearchPath CMAKE_PREFIX_PATH $1
 }
 
-fixCmakeFiles()
-{
-    local replaceArgs
-    echo "fixing cmake files"
-    replaceArgs="-e -f -L -T /usr /var/empty -a /opt /var/empty"
-    find $1 -type f -name "*.cmake" -o -name "*.cmake.in" -o -name 
CMakeLists.txt -print0 |
-        xargs -0 replace-literal ${replaceArgs}
+fixCmakeFiles() {
+    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"
+            mv "$fn.tmp" "$fn"
+        done
 }
 
-cmakeConfigurePhase()
-{
+cmakeConfigurePhase() {
     eval "$preConfigure"
 
-    if test -z "$dontFixCmake"; then
+    if [ -z "$dontFixCmake" ]; then
         fixCmakeFiles .
     fi
 
-    if test -z "$dontUseCmakeBuildDir"; then
+    if [ -z "$dontUseCmakeBuildDir" ]; then
         mkdir -p build
         cd build
         cmakeDir=..
     fi
 
-    if test -z "$dontAddPrefix"; then
+    if [ -z "$dontAddPrefix" ]; then
         cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
     fi
 
-    if test -n "$crossConfig"; then
+    if [ -n "$crossConfig" ]; then
         # By now it supports linux builds only. We should set the proper
         # CMAKE_SYSTEM_NAME otherwise.
         # http://www.cmake.org/Wiki/CMake_Cross_Compiling
@@ -47,11 +45,11 @@
     eval "$postConfigure"
 }
 
-if test -z "$dontUseCmakeConfigure"; then
+if [ -z "$dontUseCmakeConfigure" ]; then
     configurePhase=cmakeConfigurePhase
 fi
 
-if test -n "$crossConfig"; then
+if [ -n "$crossConfig" ]; then
     crossEnvHooks+=(addCMakeParams)
 else
     envHooks+=(addCMakeParams)
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to