CMake/Utilities/Release/release_cmake.sh.in
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00

155 lines
4.7 KiB
Bash
Executable File

#!/bin/sh
echo "Start release"
date
echo ""
echo "remove and create working directory @CMAKE_RELEASE_DIRECTORY@"
rm -rf @CMAKE_RELEASE_DIRECTORY@
mkdir @CMAKE_RELEASE_DIRECTORY@
check_exit_value()
{
VALUE="$1"
if [ "$VALUE" != "0" ]; then
echo "error in $2"
exit 1
fi
}
if [ ! -z "@CC@" ]; then
export CC="@CC@"
check_exit_value $? "set CC compiler env var" || exit 1
fi
if [ ! -z "@FC@" ]; then
export FC="@FC@"
check_exit_value $? "set FC compiler env var" || exit 1
fi
if [ ! -z "@CXX@" ]; then
export CXX="@CXX@"
check_exit_value $? "set CC compiler env var" || exit 1
fi
if [ ! -z "@LDFLAGS@" ]; then
export LDFLAGS="@LDFLAGS@"
check_exit_value $? "set LDFLAGS env var" || exit 1
fi
if [ ! -z "@FFLAGS@" ]; then
export FFLAGS="@FFLAGS@"
check_exit_value $? "set FFLAGS env var" || exit 1
fi
if [ ! -z "@CFLAGS@" ]; then
export CFLAGS="@CFLAGS@"
check_exit_value $? "set CFLAGS env var" || exit 1
fi
if [ ! -z "@CXXFLAGS@" ]; then
export CXXFLAGS="@CXXFLAGS@"
check_exit_value $? "setCXXFLAGS env var" || exit 1
fi
if [ ! -z "@USER_MAKE_RULE_FILE_CONTENTS@" ]; then
echo "@USER_MAKE_RULE_FILE_CONTENTS@" > "@USER_MAKE_RULE_FILE@"
check_exit_value $? "Create User Rule file" || exit 1
fi
echo "Create a directory to build in"
rm -rf @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build
check_exit_value $? "Remove build tree" || exit 1
mkdir @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build
check_exit_value $? "Create build directory" || exit 1
# make sure directory was created
if [ ! -d @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build ]; then
echo "Could not create @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build"
exit -1
fi
echo "Create initial cache"
echo "@INITIAL_CACHE@" > @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build/CMakeCache.txt
check_exit_value $? "Create initial cache" || exit 1
# create a user override file user.txt if USER_OVERRIDE is set,
# and append the cache variable to the cache
if [ ! -z "@USER_OVERRIDE@" ]; then
echo "@USER_OVERRIDE@" > @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build/user.txt
echo "CMAKE_USER_MAKE_RULES_OVERRIDE:FILEPATH=@CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build/user.txt" >> @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build/CMakeCache.txt
fi
echo "Checkout the source for @CMAKE_CREATE_VERSION@"
cd @CMAKE_RELEASE_DIRECTORY@
if [ ! -z "@GIT_COMMAND@" ]; then
# clone the repo without creating any source files in the directory
# matching the branch being built (i.e. master CMake-2-8, etc)
@GIT_COMMAND@ clone -n git://cmake.org/cmake.git @CMAKE_CREATE_VERSION@
check_exit_value $? "Checkout git cmake source" || exit 1
# go into the git directory
cd @CMAKE_CREATE_VERSION@
# run any extra commands if they exist
@GIT_EXTRA@
check_exit_value $? "git extra cmake source" || exit 1
# now checkout a copy on the local branch working
@GIT_COMMAND@ checkout -b working @GIT_BRANCH@
check_exit_value $? "git checkout" || exit 1
cd ..
else
echo GIT_COMMAND does not exist
exit 1
fi
cd @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build
if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then
echo "Run cmake to configure cmake"
@CMAKE_CONFIGURE_PATH@ ../@CMAKE_CREATE_VERSION@
check_exit_value $? "Configure cmake" || exit 1
else
if [ -z "@INSTALL_PREFIX@" ]; then
echo "Run cmake bootstrap --parallel=@PROCESSORS@"
../@CMAKE_CREATE_VERSION@/bootstrap --parallel=@PROCESSORS@
check_exit_value $? "Bootstrap cmake" || exit 1
else
echo "Run cmake bootstrap --prefix=@INSTALL_PREFIX@ --parallel=@PROCESSORS@"
../@CMAKE_CREATE_VERSION@/bootstrap --prefix=@INSTALL_PREFIX@ --parallel=@PROCESSORS@
check_exit_value $? "Bootstrap cmake" || exit 1
fi
fi
echo "Build cmake with @MAKE@"
@MAKE@
check_exit_value $? "Build cmake" || exit 1
if [ -z "@SKIP_TESTS@" ]; then
echo "Run cmake tests"
./bin/ctest --output-on-failure -j @PROCESSORS@ @EXTRA_CTEST_ARGS@
check_exit_value $? "Test cmake" || exit 1
fi
# loop over binary generators
generators="@CPACK_BINARY_GENERATORS@"
for GEN in $generators; do
echo "Create $GEN package"
./bin/cpack -D CMAKE_MAKE_PROGRAM=@MAKE_PROGRAM@ -G $GEN
check_exit_value $? "Create $GEN package" || exit 1
done
# loop over source generators
generators="@CPACK_SOURCE_GENERATORS@"
for GEN in $generators; do
echo "Create $GEN package"
./bin/cpack -D CMAKE_MAKE_PROGRAM=@MAKE_PROGRAM@ -G $GEN --config CPackSourceConfig.cmake
check_exit_value $? "Create $GEN package" || exit 1
done
# need to add an extra copy thing here
if [ ! -z "@EXTRA_COPY@" ]; then
@EXTRA_COPY@
check_exit_value $? "Extra copy step @EXTRA_COPY@" || exit 1
fi
echo "End release"
date
echo ""
exit 0