* cmake: don't use replace-literal.
svn path=/nixpkgs/branches/stdenv-updates/; revision=31736
This commit is contained in:
parent
14aab94aef
commit
28780d27d1
@ -39,15 +39,12 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
postUnpack =
|
dontUseCmakeConfigure = true;
|
||||||
''
|
|
||||||
dontUseCmakeConfigure=1
|
|
||||||
source $setupHook
|
|
||||||
fixCmakeFiles $sourceRoot
|
|
||||||
'';
|
|
||||||
|
|
||||||
preConfigure = optionalString (stdenv ? glibc)
|
preConfigure = optionalString (stdenv ? glibc)
|
||||||
''
|
''
|
||||||
|
source $setupHook
|
||||||
|
fixCmakeFiles .
|
||||||
substituteInPlace Modules/Platform/UnixPaths.cmake --subst-var-by glibc ${stdenv.glibc}
|
substituteInPlace Modules/Platform/UnixPaths.cmake --subst-var-by glibc ${stdenv.glibc}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -1,36 +1,34 @@
|
|||||||
addCMakeParams()
|
addCMakeParams() {
|
||||||
{
|
|
||||||
addToSearchPath CMAKE_PREFIX_PATH $1
|
addToSearchPath CMAKE_PREFIX_PATH $1
|
||||||
}
|
}
|
||||||
|
|
||||||
fixCmakeFiles()
|
fixCmakeFiles() {
|
||||||
{
|
echo "fixing cmake files..."
|
||||||
local replaceArgs
|
find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print |
|
||||||
echo "fixing cmake files"
|
while read fn; do
|
||||||
replaceArgs="-e -f -L -T /usr /var/empty -a /opt /var/empty"
|
sed -e 's|/usr|/var/empty|g' -e 's|/opt|/var/empty|g' < "$fn" > "$fn.tmp"
|
||||||
find $1 -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt -print0 |
|
mv "$fn.tmp" "$fn"
|
||||||
xargs -0 replace-literal ${replaceArgs}
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
cmakeConfigurePhase()
|
cmakeConfigurePhase() {
|
||||||
{
|
|
||||||
eval "$preConfigure"
|
eval "$preConfigure"
|
||||||
|
|
||||||
if test -z "$dontFixCmake"; then
|
if [ -z "$dontFixCmake" ]; then
|
||||||
fixCmakeFiles .
|
fixCmakeFiles .
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dontUseCmakeBuildDir"; then
|
if [ -z "$dontUseCmakeBuildDir" ]; then
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
cmakeDir=..
|
cmakeDir=..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$dontAddPrefix"; then
|
if [ -z "$dontAddPrefix" ]; then
|
||||||
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
|
cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$crossConfig"; then
|
if [ -n "$crossConfig" ]; then
|
||||||
# By now it supports linux builds only. We should set the proper
|
# By now it supports linux builds only. We should set the proper
|
||||||
# CMAKE_SYSTEM_NAME otherwise.
|
# CMAKE_SYSTEM_NAME otherwise.
|
||||||
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
|
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
|
||||||
@ -47,11 +45,11 @@ cmakeConfigurePhase()
|
|||||||
eval "$postConfigure"
|
eval "$postConfigure"
|
||||||
}
|
}
|
||||||
|
|
||||||
if test -z "$dontUseCmakeConfigure"; then
|
if [ -z "$dontUseCmakeConfigure" ]; then
|
||||||
configurePhase=cmakeConfigurePhase
|
configurePhase=cmakeConfigurePhase
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$crossConfig"; then
|
if [ -n "$crossConfig" ]; then
|
||||||
crossEnvHooks+=(addCMakeParams)
|
crossEnvHooks+=(addCMakeParams)
|
||||||
else
|
else
|
||||||
envHooks+=(addCMakeParams)
|
envHooks+=(addCMakeParams)
|
||||||
|
Loading…
Reference in New Issue
Block a user