CMake/Utilities/Release/release_cmake.sh.in

155 lines
Bash
Raw Normal View History

2006-05-05 06:58:49 +04:00
#!/bin/sh
2006-05-09 20:23:19 +04:00
echo "Start release"
date
echo ""
2006-05-05 23:51:13 +04:00
echo "remove and create working directory @CMAKE_RELEASE_DIRECTORY@"
rm -rf @CMAKE_RELEASE_DIRECTORY@
2006-05-05 23:51:13 +04:00
mkdir @CMAKE_RELEASE_DIRECTORY@
2006-05-05 06:58:49 +04:00
check_exit_value()
{
VALUE="$1"
2006-05-05 20:14:32 +04:00
if [ "$VALUE" != "0" ]; then
2006-05-05 06:58:49 +04:00
echo "error in $2"
exit 1
fi
2006-05-05 06:58:49 +04:00
}
if [ ! -z "@CC@" ]; then
2006-05-05 22:53:50 +04:00
export CC="@CC@"
check_exit_value $? "set CC compiler env var" || exit 1
fi
2006-10-16 20:47:07 +04:00
if [ ! -z "@FC@" ]; then
export FC="@FC@"
check_exit_value $? "set FC compiler env var" || exit 1
fi
if [ ! -z "@CXX@" ]; then
2006-05-05 22:53:50 +04:00
export CXX="@CXX@"
check_exit_value $? "set CC compiler env var" || exit 1
fi
2006-05-09 21:48:36 +04:00
if [ ! -z "@LDFLAGS@" ]; then
2006-05-05 22:53:50 +04:00
export LDFLAGS="@LDFLAGS@"
2006-05-09 21:48:36 +04:00
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
2006-05-09 21:48:36 +04:00
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
2006-05-05 20:14:32 +04:00
if [ ! -z "@USER_MAKE_RULE_FILE_CONTENTS@" ]; then
2006-05-05 06:58:49 +04:00
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
2006-05-05 06:58:49 +04:00
check_exit_value $? "Remove build tree" || exit 1
mkdir @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build
2006-05-05 06:58:49 +04:00
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"
2006-05-05 06:58:49 +04:00
exit -1
fi
echo "Create initial cache"
echo "@INITIAL_CACHE@" > @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build/CMakeCache.txt
2006-05-05 06:58:49 +04:00
check_exit_value $? "Create initial cache" || exit 1
2010-04-20 23:03:20 +04:00
# 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
2006-05-05 06:58:49 +04:00
cd @CMAKE_RELEASE_DIRECTORY@/@CMAKE_CREATE_VERSION@-build
2006-05-10 22:03:51 +04:00
if [ ! -z "@CONFIGURE_WITH_CMAKE@" ]; then
2006-05-10 22:03:51 +04:00
echo "Run cmake to configure cmake"
@CMAKE_CONFIGURE_PATH@ ../@CMAKE_CREATE_VERSION@
2006-05-10 22:03:51 +04:00
check_exit_value $? "Configure cmake" || exit 1
else
2008-03-07 22:03:31 +03:00
if [ -z "@INSTALL_PREFIX@" ]; then
echo "Run cmake bootstrap --parallel=@PROCESSORS@"
../@CMAKE_CREATE_VERSION@/bootstrap --parallel=@PROCESSORS@
2008-03-07 22:03:31 +03:00
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@
2008-03-07 22:03:31 +03:00
check_exit_value $? "Bootstrap cmake" || exit 1
fi
2006-05-10 22:03:51 +04:00
fi
2006-05-05 06:58:49 +04:00
echo "Build cmake with @MAKE@"
2006-05-05 06:58:49 +04:00
@MAKE@
check_exit_value $? "Build cmake" || exit 1
2006-05-09 00:36:51 +04:00
if [ -z "@SKIP_TESTS@" ]; then
echo "Run cmake tests"
./bin/ctest --output-on-failure -j @PROCESSORS@ @EXTRA_CTEST_ARGS@
2006-05-09 00:36:51 +04:00
check_exit_value $? "Test cmake" || exit 1
fi
2006-05-05 06:58:49 +04:00
# loop over binary generators
2006-05-12 00:07:42 +04:00
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
2006-05-12 00:07:42 +04:00
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
2006-05-05 06:58:49 +04:00
2006-05-05 20:25:28 +04:00
2006-05-06 06:04:55 +04:00
# 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
2006-05-09 20:23:19 +04:00
echo "End release"
date
echo ""
2006-05-05 20:25:28 +04:00
exit 0