diff options
author | Brad King <brad.king@kitware.com> | 2002-07-15 14:08:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-07-15 14:08:25 (GMT) |
commit | 77bb1f793b4da36627001a63f0f0f135b63b1b66 (patch) | |
tree | e092ed2a9b3c280e795d1263d009b8c2025282fa /Utilities | |
parent | df29ea087f5baf48ac065f39ed84472ef437edc2 (diff) | |
download | CMake-77bb1f793b4da36627001a63f0f0f135b63b1b66.zip CMake-77bb1f793b4da36627001a63f0f0f135b63b1b66.tar.gz CMake-77bb1f793b4da36627001a63f0f0f135b63b1b66.tar.bz2 |
ENH: Protoype unix release script.
Diffstat (limited to 'Utilities')
-rwxr-xr-x | Utilities/cmake_release_unix.sh | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/Utilities/cmake_release_unix.sh b/Utilities/cmake_release_unix.sh new file mode 100755 index 0000000..71c5683 --- /dev/null +++ b/Utilities/cmake_release_unix.sh @@ -0,0 +1,166 @@ +#!/bin/sh +# +# CMake UNIX Release Script. +# +# Run this in an empty directory. Your ~/.cvspass file should already +# have an entry for the CVSROOT used below. +# + +# Check the command line arguments. +CONFIG_FILE=$1 +if test "x$1" = "x"; then + echo "Usage:" + echo " $0 <configuration-file>" + echo "" + echo "Sample configuration file:" + echo " RELEASE_TAG=\"Release-1-4\"" + echo " VERSION=\"1.4\"" + echo " PLATFORM=\"x86-linux\"" + exit 1 +fi + +# Set some defaults here. They can be changed by the configuration +# file. +CVSROOT=":pserver:anonymous@www.cmake.org:/cvsroot/CMake" +CURSES_LIBRARY="/usr/lib/libcurses.a" +FORM_LIBRARY="/usr/lib/libform.a" +STATIC_LINK_FLAGS="-static" +RELEASE_ROOT=`pwd` +CREATE_SOURCE_TARBALL="no" +CMAKE="cmake" +GZIP="gzip" +COMPRESS="compress" +TAR="tar" +CAT="cat" +MAKE="make" +FIND="find" +CVS="cvs" +CC="gcc" +CXX="c++" +CFLAGS="" +CXXFLAGS="" + +#----------------------------------------------------------------------------- +# Configuration options (could be in separate file) +echo "Reading configuration from ${CONFIG_FILE}..." +if . `pwd`/${CONFIG_FILE} ; then : ; else + echo "Error reading configuration." + exit 1 +fi +#----------------------------------------------------------------------------- + +export CC CXX CFLAGS CXXFLAGS + +# Select directories. +INSTALL_DIR="${RELEASE_ROOT}/Install" +TARBALL_DIR="${RELEASE_ROOT}/Tarballs" +BUILD_DIR="${RELEASE_ROOT}/CMake-$VERSION-static" +LOG_DIR="${RELEASE_ROOT}/Logs" + +# Cleanup from possible previous run. +rm -rf ${LOG_DIR} ${BUILD_DIR} ${INSTALL_DIR} ${TARBALL_DIR} +mkdir -p ${LOG_DIR} ${BUILD_DIR} ${INSTALL_DIR} ${TARBALL_DIR} + +# Make sure the source is exported from CVS. +SOURCE_DIR="${RELEASE_ROOT}/CMake-$VERSION" +if test ! -d ${SOURCE_DIR} ; then + cd ${RELEASE_ROOT} + rm -rf CMake + echo "Exporing CMake from CVS..." + if ${CVS} -z3 -d ${CVSROOT} export -r ${RELEASE_TAG} \ + CMake > ${LOG_DIR}/cvs.log 2>&1 ; then : ; else + echo "Error, see ${LOG_DIR}/cvs.log" + exit 1 + fi + mv CMake CMake-$VERSION +fi + +# Make the source tarball if requested. +if test "${CREATE_SOURCE_TARBALL}" = "yes" ; then + TARBALL="${TARBALL_DIR}/CMake$VERSION-src-unix.tar" + echo "Creating CMake$VERSION-src-unix.tar" + if ${TAR} cvf $TARBALL CMake-$VERSION \ + > ${LOG_DIR}/CMake$VERSION-src-unix.log 2>&1 ; then : ; else + "Error, see ${LOG_DIR}/CMake$VERSION-src-unix.log" + exit 1 + fi + if test "x${GZIP}" != "x" ; then + echo "Creating $TARBALL.gz" + ${GZIP} -c $TARBALL > $TARBALL.gz + fi + if test "x${COMPRESS}" != "x" ; then + echo "Creating $TARBALL.Z" + ${COMPRESS} $TARBALL + fi +fi + +# Build the release. +cd ${BUILD_DIR} +echo "Writing CMakeCache.txt..." +${CAT} >> CMakeCache.txt <<EOF +BUILD_TESTING:BOOL=OFF +CMAKE_CXX_SHLIB_LINK_FLAGS:STRING=${STATIC_LINK_FLAGS} +CMAKE_CXX_SHLIB_BUILD_FLAGS:STRING= +CMAKE_CXX_SHLIB_RUNTIME_FLAG:STRING= +CMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR} +CURSES_LIBRARY:FILEPATH=${CURSES_LIBRARY} +FORM_LIBRARY:FILEPATH=${FORM_LIBRARY} +EOF + +echo "Running CMake..." +if ${CMAKE} ${SOURCE_DIR} > ${LOG_DIR}/cmake.log 2>&1 ; then : ; else + echo "Error, see ${LOG_DIR}/cmake.log" + exit 1 +fi + +echo "Running make..." +if ${MAKE} > ${LOG_DIR}/make.log 2>&1 ; then : ; else + echo "Error, see ${LOG_DIR}/make.log" + exit 1 +fi + +echo "Running make install..." +if ${MAKE} install > ${LOG_DIR}/make_install.log 2>&1 ; then : ; else + echo "Error, see ${LOG_DIR}/make_install.log" + exit 1 +fi + +# Create the release tarballs. +cd ${INSTALL_DIR} +echo "Creating cmake-$VERSION-$PLATFORM.tar" + +if ${TAR} cvf cmake-$VERSION-$PLATFORM.tar bin share \ + > ${LOG_DIR}/cmake-$VERSION-$PLATFORM.log 2>&1 ; then : ; else + echo "Error, see ${LOG_DIR}/cmake-$VERSION-$PLATFORM.log" + exit 1 +fi + +echo "Writing README" +FILES=`${FIND} bin share -type f |sed 's/^\.\///'` +${CAT} >> README <<EOF +CMake $VERSION binary for $PLATFORM - statically linked + +Extract the file "cmake-$VERSION-$PLATFORM.tar" into your destination directory. +The following files will be extracted: + +${FILES} + +EOF + +TARBALL="${TARBALL_DIR}/CMake$VERSION-$PLATFORM-static.tar" +echo "Creating CMake$VERSION-$PLATFORM-static.tar" +if ${TAR} cvf $TARBALL README cmake-$VERSION-$PLATFORM.tar \ + > ${LOG_DIR}/CMake$VERSION-$PLATFORM-static.log 2>&1 ; then : ; else + "Error, see ${LOG_DIR}/CMake$VERSION-$PLATFORM-static.log" + exit 1 +fi + +if test "x${GZIP}" != "x" ; then + echo "Creating $TARBALL.gz" + ${GZIP} -c $TARBALL > $TARBALL.gz +fi + +if test "x${COMPRESS}" != "x" ; then + echo "Creating $TARBALL.Z" + ${COMPRESS} $TARBALL +fi |