* 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;
|
||||
|
||||
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}
|
||||
'';
|
||||
|
||||
|
@ -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 @@ cmakeConfigurePhase()
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user