nixpkgs/pkgs/development/tools/build-managers/cmake/setup-hook.sh
Yury G. Kudryashov 67d41efde1 Added some parts of kde-4. It doesn't work yet, but I need version control
svn path=/nixpkgs/trunk/; revision=9049
2007-08-05 13:54:42 +00:00

55 lines
1005 B
Bash
Executable File

addCMakeParamsInclude()
{
if [ -d $1/include ]; then
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH}${CMAKE_INCLUDE_PATH:+:}$1/include"
fi
}
addCMakeParamsLibs()
{
if [ -d $1/lib ]; then
export CMAKE_LIBRARY_PATH="${CMAKE_LIBRARY_PATH}${CMAKE_LIBRARY_PATH:+:}$1/lib"
fi
}
fixCmake()
{
echo "fixing Cmake file $i"
sed -e 's@/usr@/FOO@g' -e 's@ /\(bin\|sbin\|lib\)@ /FOO@g' -i $i
}
fixCmakeFiles()
{
for i in $(find $1 -type f -name "*.cmake"); do
fixCmake $i;
done;
}
cmakePostUnpack()
{
sourceRoot=$sourceRoot/build
mkdir -v $sourceRoot
echo source root reset to $sourceRoot
if [ -z "$dontFixCmake" ]; then
fixCmakeFiles .
fi
}
cmakeTweaks()
{
postUnpack="cmakePostUnpack${postUnpack:+; }${postUnpack}"
if [ -z "$configureScript" ]; then
dontAddPrefix=1
configureScript="cmake .."
configureFlags="-DCMAKE_INSTALL_PREFIX=$out $configureFlags"
fi
}
if [ -z "$noCmakeTewaks" ]; then
cmakeTweaks
fi;
envHooks=(${envHooks[@]} addCMakeParamsInclude addCMakeParamsLibs)