ENH: added some release support

This commit is contained in:
Ken Martin 2005-06-28 10:56:29 -04:00
parent 03e78aae60
commit 35affa053c
5 changed files with 1225 additions and 0 deletions

View File

@ -164,3 +164,6 @@ CONFIGURE_FILE(
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# include support for making the release
INCLUDE (${CMake_SOURCE_DIR}/Utilities/Release/Release.cmake)

View File

@ -0,0 +1,381 @@
; CMake install script designed for a nmake build
;--------------------------------
; You must define these values
!define VERSION "@CMake_VERSION@"
!define PATCH "@CMake_VERSION_PATCH@"
!define INST_DIR "@CMake_INSTALL_TOP@"
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;General
;Name and file
Name "CMake ${VERSION}"
OutFile "cmake-${VERSION}.${PATCH}-win32.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\CMake ${VERSION}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Kitware\CMake ${VERSION}" ""
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
;--------------------------------
; path functions
!verbose 3
!include "WinMessages.NSH"
!verbose 4
; AddToPath - Adds the given dir to the search path.
; Input - head of the stack
; Note - Win9x systems requires reboot
Function AddToPath
Exch $0
Push $1
Push $2
Push $3
# don't add if the path doesn't exist
IfFileExists "$0\*.*" "" AddToPath_done
ReadEnvStr $1 PATH
Push "$1;"
Push "$0;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$0\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
GetFullPathName /SHORT $3 $0
Push "$1;"
Push "$3;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$3\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Call IsNT
Pop $1
StrCmp $1 1 AddToPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" a
FileSeek $1 -1 END
FileReadByte $1 $2
IntCmp $2 26 0 +2 +2 # DOS EOF
FileSeek $1 -1 END # write over EOF
FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
FileClose $1
SetRebootFlag true
Goto AddToPath_done
AddToPath_NT:
ReadRegStr $1 HKCU "Environment" "PATH"
StrCpy $2 $1 1 -1 # copy last char
StrCmp $2 ";" 0 +2 # if last char == ;
StrCpy $1 $1 -1 # remove last char
StrCmp $1 "" AddToPath_NTdoIt
StrCpy $0 "$1;$0"
AddToPath_NTdoIt:
WriteRegExpandStr HKCU "Environment" "PATH" $0
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
AddToPath_done:
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
; RemoveFromPath - Remove a given dir from the path
; Input: head of the stack
Function un.RemoveFromPath
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
IntFmt $6 "%c" 26 # DOS EOF
Call un.IsNT
Pop $1
StrCmp $1 1 unRemoveFromPath_NT
; Not on NT
StrCpy $1 $WINDIR 2
FileOpen $1 "$1\autoexec.bat" r
GetTempFileName $4
FileOpen $2 $4 w
GetFullPathName /SHORT $0 $0
StrCpy $0 "SET PATH=%PATH%;$0"
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoop:
FileRead $1 $3
StrCpy $5 $3 1 -1 # read last char
StrCmp $5 $6 0 +2 # if DOS EOF
StrCpy $3 $3 -1 # remove DOS EOF so we can compare
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
FileWrite $2 $3
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopRemoveLine:
SetRebootFlag true
Goto unRemoveFromPath_dosLoop
unRemoveFromPath_dosLoopEnd:
FileClose $2
FileClose $1
StrCpy $1 $WINDIR 2
Delete "$1\autoexec.bat"
CopyFiles /SILENT $4 "$1\autoexec.bat"
Delete $4
Goto unRemoveFromPath_done
unRemoveFromPath_NT:
ReadRegStr $1 HKCU "Environment" "PATH"
StrCpy $5 $1 1 -1 # copy last char
StrCmp $5 ";" +2 # if last char != ;
StrCpy $1 "$1;" # append ;
Push $1
Push "$0;"
Call un.StrStr ; Find `$0;` in $1
Pop $2 ; pos of our dir
StrCmp $2 "" unRemoveFromPath_done
; else, it is in path
# $0 - path to add
# $1 - path var
StrLen $3 "$0;"
StrLen $4 $2
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
StrCpy $3 $5$6
StrCpy $5 $3 1 -1 # copy last char
StrCmp $5 ";" 0 +2 # if last char == ;
StrCpy $3 $3 -1 # remove last char
WriteRegExpandStr HKCU "Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
unRemoveFromPath_done:
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
###########################################
# Utility Functions #
###########################################
; IsNT
; no input
; output, top of the stack = 1 if NT or 0 if not
;
; Usage:
; Call IsNT
; Pop $R0
; ($R0 at this point is 1 or 0)
!macro IsNT un
Function ${un}IsNT
Push $0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 IsNT_yes
; we are not NT.
Pop $0
Push 0
Return
IsNT_yes:
; NT!!!
Pop $0
Push 1
FunctionEnd
!macroend
!insertmacro IsNT ""
!insertmacro IsNT "un."
; StrStr
; input, top of stack = string to search for
; top of stack-1 = string to search in
; output, top of stack (replaces with the portion of the string remaining)
; modifies no other variables.
;
; Usage:
; Push "this is a long ass string"
; Push "ass"
; Call StrStr
; Pop $R0
; ($R0 at this point is "ass string")
!macro StrStr un
Function ${un}StrStr
Exch $R1 ; st=haystack,old$R1, $R1=needle
Exch ; st=old$R1,haystack
Exch $R2 ; st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrCpy $R4 0
; $R1=needle
; $R2=haystack
; $R3=len(needle)
; $R4=cnt
; $R5=tmp
loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 done
StrCmp $R5 "" done
IntOp $R4 $R4 + 1
Goto loop
done:
StrCpy $R1 $R2 "" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
FunctionEnd
!macroend
!insertmacro StrStr ""
!insertmacro StrStr "un."
;--------------------------------
;Pages
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Kitware\CMake ${VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Add to path"
Push $INSTDIR\bin
Call AddToPath
SectionEnd
Section "Dummy Section" SecDummy
;Use the entire tree produced by the INSTALL target. Keep the
;list of directories here in sync with the RMDir commands below.
SetOutPath "$INSTDIR"
File /r "${INST_DIR}\bin"
File /r "${INST_DIR}\doc"
File /r "${INST_DIR}\share"
@NSIS_EXTRA_COMMANDS@
;Store installation folder
WriteRegStr HKCU "Software\Kitware\CMake ${VERSION}" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\cmake.lnk" "$INSTDIR\bin\CMakeSetup.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Remove directories we installed.
;Keep the list of directories here in sync with the File commands above.
RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\doc"
RMDir /r "$INSTDIR\share"
;Remove the uninstaller itself.
Delete "$INSTDIR\Uninstall.exe"
;Remove the installation directory if it is empty.
RMDir "$INSTDIR"
; Remove the registry entries.
DeleteRegKey HKCU "Software\Kitware\CMake ${VERSION}"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\cmake.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\Kitware\CMake ${VERSION}"
Push $INSTDIR\bin
Call un.RemoveFromPath
SectionEnd

View File

@ -0,0 +1,61 @@
#########################################################################
# Setup release scripts.
# Search for system runtime libraries based on the platform. This is
# not complete because it is used only for the release process by the
# developers.
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
STRING(REGEX REPLACE "\\\\" "/" SYSTEMROOT "$ENV{SYSTEMROOT}")
FOREACH(lib
"${SYSTEMROOT}/system32/msvcp71.dll"
"${SYSTEMROOT}/system32/msvcr71.dll"
)
IF(EXISTS ${lib})
SET(CMake_INSTALL_SYSTEM_RUNTIME_LIBS
${CMake_INSTALL_SYSTEM_RUNTIME_LIBS} ${lib})
ENDIF(EXISTS ${lib})
ENDFOREACH(lib)
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
# Include system runtime libraries in the installation if any are
# specified by CMake_INSTALL_SYSTEM_RUNTIME_LIBS.
IF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS)
IF(WIN32)
INSTALL_PROGRAMS(${CMake_INSTALL_BIN_DIR}
${CMake_INSTALL_SYSTEM_RUNTIME_LIBS})
ELSE(WIN32)
INSTALL_PROGRAMS(${CMake_INSTALL_LIB_DIR}
${CMake_INSTALL_SYSTEM_RUNTIME_LIBS})
ENDIF(WIN32)
ENDIF(CMake_INSTALL_SYSTEM_RUNTIME_LIBS)
IF(WIN32)
FIND_PROGRAM(NSIS_MAKENSIS NAMES makensis
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
DOC "Where is makensis.exe located"
)
MARK_AS_ADVANCED(NSIS_MAKENSIS)
FIND_PROGRAM(WINZIP_WZZIP NAMES wzzip
PATHS "C:/Program Files/WinZip"
DOC "Where is makensis.exe located"
)
MARK_AS_ADVANCED(WINZIP_WZZIP)
STRING(REGEX REPLACE "/" "\\\\" CMake_INSTALL_TOP "${CMAKE_INSTALL_PREFIX}")
SET(NSIS_EXTRA_COMMANDS ";Include system runtime libraries.\n SetOutPath \"$INSTDIR\\bin\"\n")
FOREACH(lib ${CMake_INSTALL_SYSTEM_RUNTIME_LIBS})
STRING(REGEX REPLACE "/" "\\\\" LIB "${lib}")
SET(NSIS_EXTRA_COMMANDS "${NSIS_EXTRA_COMMANDS} File \"${LIB}\"\n")
ENDFOREACH(lib)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/Utilities/Release/${PROJECT_NAME}.nsi.in
${PROJECT_BINARY_DIR}/Utilities/Release/${PROJECT_NAME}.nsi
IMMEDIATE @ONLY)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/Utilities/Release/Win32Release.sh.in
${PROJECT_BINARY_DIR}/Utilities/Release/Win32Release.sh
IMMEDIATE @ONLY)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/Utilities/Release/cmake_release.sh.in
${PROJECT_BINARY_DIR}/Utilities/Release/cmake_release.sh
IMMEDIATE @ONLY)
ENDIF(WIN32)

View File

@ -0,0 +1,30 @@
# this script is designed to be run from a UNIX like shell under Windows
# and has some hard coded assumptions. Do not just randomly run this script
# without looking it over first.
# Release version number.
TAG="CMake-@CMake_VERSION_MAJOR@-@CMake_VERSION_MINOR@-@CMake_VERSION_PATCH@"
VERSION="@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@"
SCPID="kitware@public.kitware.com"
# CVSROOT setting used to check out Cmake.
CVSROOT=":pserver:anoncvs@www.cmake.org:/cvsroot/CMake"
# build the NSI
"@NSIS_MAKENSIS@" "@PROJECT_BINARY_DIR@/Utilities/Release/@PROJECT_NAME@.nsi"
#scp cmake-${VERSION}-win32.exe ${SCPID}:/projects/FTP/pub/cmake/v@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@
# tag the tree
#cd "@PROJECT_SOURCE_DIR@"
#cvs tag -F ${TAG}
# build the winzip src file
#cd C:
#rm -rf @PROJECT_NAME@
#cvs -d ${CVSROOT} export -r ${TAG} @PROJECT_NAME@
#cd @PROJECT_NAME@
#"@WINZIP_WZZIP@" -r -P cmake-${VERSION}.zip
#scp cmake-${VERSION}.zip ${SCPID}:/projects/FTP/pub/cmake/v@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@

View File

@ -0,0 +1,750 @@
#!/bin/sh
#=============================================================================
#
# Program: CMake - Cross-Platform Makefile Generator
# Module: $RCSfile$
# Language: C++
# Date: $Date$
# Version: $Revision$
#
# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notices for more information.
#
#=============================================================================
#
# CMake UNIX Release Script.
#
# Run with no arguments for documentation.
#
# Release version number.
TAG="ParaView-@CMake_VERSION_MAJOR@-@CMake_VERSION_MINOR@-@CMake_VERSION_PATCH@"
VERSION="@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@"
CMAKE_VERSION="@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@"
RELEASE="1"
PREVIOUS_VERSION="2.0.6"
PREVIOUS_RELEASE="1"
# CVSROOT setting used to check out CMake.
CVSROOT=":pserver:anonymous@www.cmake.org:/cvsroot/CMake"
CVSROOT_GREP=":pserver:anonymous@www.cmake.org:[0-9]*/cvsroot/CMake"
# CMake release root directory.
RELEASE_ROOT_NAME="CMakeReleaseRoot"
RELEASE_ROOT="${HOME}/${RELEASE_ROOT_NAME}"
INSTALL_DIR="Install"
# Installation prefix used during tarball creation. Tarballs are
# relative to the installation prefix and do not include this in their
# paths.
PREFIX="/usr/local"
# Directory relative to PREFIX where documentation should be placed.
DOC_DIR="/doc/cmake"
# No default compiler. The config file must provide it.
CC=""
CXX=""
CFLAGS=""
CXXFLAGS=""
# Provide a default make and build flags.
MAKE="make"
BUILD_FLAGS=""
BOOTSTRAP_FLAGS=""
# Details of remote invocation.
[ -z "$REMOTE" ] && SELF="$0"
#-----------------------------------------------------------------------------
usage()
{
cat <<EOF
CMake Release Script Usage:
$0 [command]
Typical usage:
Cleanup remote host release directory:
$0 remote <host> clean
Create binary release tarball:
$0 remote_binary <host>
Create source release tarball:
$0 remote_source <host>
Upload tarballs:
$0 upload
Create and upload cygwin package:
$0 cygwin_package
$0 cygwin_upload
Available commands:
EOF
cat "$0" | awk '
/^#--*$/ { doc=1; text="" }
/(^#$|^#[^-].*$)/ {
if(doc)
{
if(text != "") { text = sprintf("%s %s\n", text, $0) }
else { text = sprintf(" %s\n", $0) }
}
}
/^[A-Za-z0-9_]*\(\)$/ {
doc=0;
if(text != "") { printf("%s:\n%s\n", $0, text) }
}
'
}
#-----------------------------------------------------------------------------
error_log()
{
echo "An error has been logged to $1:" &&
cat "$1" &&
return 1
}
#-----------------------------------------------------------------------------
check_host()
{
HOST="$1"
if [ -z "$HOST" ]; then
echo "Must specify host."
return 1
fi
}
#-----------------------------------------------------------------------------
# Run a command on the specified remote host.
#
# remote <host> [command]
#
# Only one level of remote invocation is allowed. The <host>
# specification must be a valid ssh destination with public
# key authentication and no password.
remote()
{
if [ ! -z "$REMOTE" ]; then
echo "Cannot do recursive remote calls."
return 1
fi
check_host "$1" || return 1
shift
RTASK="'$1'"; shift; for i in "$@"; do RTASK="${RTASK} '$i'"; done
RESULT=0
echo "------- Running remote task on $HOST. -------" &&
(echo "REMOTE=\"1\"" &&
(echo TASK=\"`(eval echo '${RTASK}') | (sed 's/"/\\\\"/g')`\") &&
cat $SELF) | ssh -e none "$HOST" /bin/sh || RESULT=1
echo "-------- Remote task on $HOST done. --------" &&
return $RESULT
}
#-----------------------------------------------------------------------------
# Copy tarballs from the specified host.
#
# remote_copy <host> [EXPR]
#
# The <host> specification must be a valid ssh destination
# with public key authentication and no password. Only
# files matching the given expression are copied. If
# no expression is given, "*" is used.
remote_copy()
{
check_host "$1" || return 1
EXPR="$2"
[ ! -z "$EXPR" ] || EXPR="*"
echo "------- Copying tarballs from $HOST. -------" &&
scp "$HOST:${RELEASE_ROOT_NAME}/Tarballs/${EXPR}" . &&
echo "---- Done copying tarballs from $HOST. -----"
}
#-----------------------------------------------------------------------------
remote_copy_source()
{
check_host "$1" || return 1
remote_copy "$HOST" "cmake-${VERSION}.tar*"
}
#-----------------------------------------------------------------------------
remote_copy_binary()
{
check_host "$1" || return 1
remote_copy "$HOST" "cmake-${VERSION}-*"
}
#-----------------------------------------------------------------------------
# Create source tarballs on the specified host and copy them locally.
#
# remote_source <host>
#
# The <host> specification must be a valid ssh destination
# with public key authentication and no password.
remote_source()
{
check_host "$1" || return 1
remote "$HOST" source_tarball &&
remote_copy_source "$HOST"
}
#-----------------------------------------------------------------------------
# Create binary tarballs on the specified host and copy them locally.
#
# remote_binary <host>
#
# The <host> specification must be a valid ssh destination
# with public key authentication and no password.
remote_binary()
{
check_host "$1" || return 1
remote "$HOST" binary_tarball &&
remote_copy_binary "$HOST"
}
#-----------------------------------------------------------------------------
# Upload any tarballs in the current directory to the CMake FTP site.
#
# upload
#
# The user must be able to ssh to kitware@www.cmake.org with public
# key authentication and no password.
upload()
{
echo "------- Copying tarballs to www.cmake.org. -------"
scp cmake-${VERSION}*tar.* kitware@www.cmake.org:/projects/FTP/pub/cmake/v${CMAKE_VERSION}
echo "---- Done copying tarballs to www.cmake.org. -----"
}
#-----------------------------------------------------------------------------
setup()
{
[ -z "${DONE_setup}" ] || return 0 ; DONE_setup="yes"
mkdir -p ${RELEASE_ROOT}/Logs &&
echo "Entering ${RELEASE_ROOT}" &&
cd ${RELEASE_ROOT}
}
#-----------------------------------------------------------------------------
# Remove the release root directory.
#
# clean
#
clean()
{
cd "${HOME}" &&
echo "Cleaning up ${RELEASE_ROOT}" &&
rm -rf "${RELEASE_ROOT_NAME}"
}
#-----------------------------------------------------------------------------
cvs_login()
{
[ -z "${DONE_cvs_login}" ] || return 0 ; DONE_cvs_login="yes"
setup || return 1
(
if [ -f "${HOME}/.cvspass" ]; then
CVSPASS="${HOME}/.cvspass"
else
CVSPASS=""
fi
if [ -z "`grep \"$CVSROOT_GREP\" ${CVSPASS} /dev/null`" ]; then
echo "cmake" | cvs -q -z3 -d $CVSROOT login
else
echo "Already logged in."
fi
) >Logs/cvs_login.log 2>&1 || error_log Logs/cvs_login.log
}
#-----------------------------------------------------------------------------
utilities()
{
[ -z "${DONE_utilities}" ] || return 0 ; DONE_utilities="yes"
cvs_login || return 1
(
if [ -d "ReleaseUtilities/CVS" ]; then
cd ReleaseUtilities && cvs -z3 -q update -dAP -r ${TAG}
else
rm -rf CheckoutTemp &&
mkdir CheckoutTemp &&
cd CheckoutTemp &&
cvs -q -z3 -d $CVSROOT co -r ${TAG} CMake/Utilities/Release &&
mv CMake/Utilities/Release ../ReleaseUtilities &&
cd .. &&
rm -rf CheckoutTemp
fi
) >Logs/utilities.log 2>&1 || error_log Logs/utilities.log
}
#-----------------------------------------------------------------------------
config()
{
[ -z "${DONE_config}" ] || return 0 ; DONE_config="yes"
utilities || return 1
CONFIG_FILE="config_`uname`"
echo "Loading ${CONFIG_FILE} ..."
. "${RELEASE_ROOT}/ReleaseUtilities/${CONFIG_FILE}" >Logs/config.log 2>&1 || error_log Logs/config.log
if [ -z "${CC}" ] || [ -z "${CXX}" ] || [ -z "${PLATFORM}" ]; then
echo "${CONFIG_FILE} should specify CC, CXX, and PLATFORM." &&
return 1
fi
export CC CXX CFLAGS CXXFLAGS LDFLAGS PATH LD_LIBRARY_PATH MAKE
}
#-----------------------------------------------------------------------------
checkout()
{
[ -z "${DONE_checkout}" ] || return 0 ; DONE_checkout="yes"
config || return 1
echo "Exporting cmake from cvs ..." &&
(
rm -rf cmake-${VERSION} &&
rm -rf CheckoutTemp &&
mkdir CheckoutTemp &&
cd CheckoutTemp &&
cvs -q -z3 -d $CVSROOT export -r ${TAG} CMake &&
mv CMake ../cmake-${VERSION} &&
cd .. &&
rm -rf CheckoutTemp
) >Logs/checkout.log 2>&1 || error_log Logs/checkout.log
}
#-----------------------------------------------------------------------------
# Create source tarballs for CMake.
#
# source_tarball
#
source_tarball()
{
[ -z "${DONE_source_tarball}" ] || return 0 ; DONE_source_tarball="yes"
config || return 1
[ -d "cmake-${VERSION}" ] || checkout || return 1
echo "Creating source tarballs ..." &&
(
mkdir -p Tarballs &&
rm -rf Tarballs/cmake-${VERSION}.tar* &&
tar cvf Tarballs/cmake-${VERSION}.tar cmake-${VERSION} &&
gzip -c Tarballs/cmake-${VERSION}.tar >Tarballs/cmake-${VERSION}.tar.gz &&
compress Tarballs/cmake-${VERSION}.tar
) >Logs/source_tarball.log 2>&1 || error_log Logs/source_tarball.log
}
#-----------------------------------------------------------------------------
write_cache()
{
write_standard_cache
}
#-----------------------------------------------------------------------------
write_standard_cache()
{
cat > CMakeCache.txt <<EOF
BUILD_TESTING:BOOL=ON
CMAKE_SKIP_RPATH:BOOL=1
CMAKE_VERBOSE_MAKEFILE:BOOL=1
HAVE_LIBDL:INTERNAL=0
HAVE_DLOPEN:INTERNAL=0
HAVE_GETHOSTBYADDR_R:INTERNAL=0
HAVE_GETHOSTBYADDR_R_5:INTERNAL=0
HAVE_GETHOSTBYADDR_R_5_REENTRANT:INTERNAL=0
HAVE_GETHOSTBYADDR_R_7:INTERNAL=0
HAVE_GETHOSTBYADDR_R_7_REENTRANT:INTERNAL=0
HAVE_GETHOSTBYADDR_R_8:INTERNAL=0
HAVE_GETHOSTBYADDR_R_8_REENTRANT:INTERNAL=0
HAVE_GETHOSTBYNAME_R:INTERNAL=0
HAVE_GETHOSTBYNAME_R_3:INTERNAL=0
HAVE_GETHOSTBYNAME_R_3_REENTRANT:INTERNAL=0
HAVE_GETHOSTBYNAME_R_5:INTERNAL=0
HAVE_GETHOSTBYNAME_R_5_REENTRANT:INTERNAL=0
HAVE_GETHOSTBYNAME_R_6:INTERNAL=0
HAVE_GETHOSTBYNAME_R_6_REENTRANT:INTERNAL=0
HAVE_GETPASS_R:INTERNAL=0
HAVE_GMTIME_R:INTERNAL=0
HAVE_INET_NTOA_R:INTERNAL=0
HAVE_INET_NTOA_R_DECL:INTERNAL=0
HAVE_INET_NTOA_R_DECL_REENTRANT:INTERNAL=0
HAVE_LOCALTIME_R:INTERNAL=0
HAVE_STRTOK_R:INTERNAL=0
EOF
}
#-----------------------------------------------------------------------------
cache()
{
[ -z "${DONE_cache}" ] || return 0 ; DONE_cache="yes"
config || return 1
echo "Writing CMakeCache.txt ..." &&
(
rm -rf "cmake-${VERSION}-${PLATFORM}" &&
mkdir -p "cmake-${VERSION}-${PLATFORM}" &&
cd "cmake-${VERSION}-${PLATFORM}" &&
write_cache
) >Logs/cache.log 2>&1 || error_log Logs/cache.log
}
#-----------------------------------------------------------------------------
configure()
{
[ -z "${DONE_configure}" ] || return 0 ; DONE_configure="yes"
config || return 1
[ -d "cmake-${VERSION}" ] || checkout || return 1
cache || return 1
echo "Running bootstrap ..." &&
(
cd "cmake-${VERSION}-${PLATFORM}" &&
../cmake-${VERSION}/bootstrap --prefix=${PREFIX} ${BOOTSTRAP_FLAGS}
) >Logs/configure.log 2>&1 || error_log Logs/configure.log
}
#-----------------------------------------------------------------------------
build()
{
[ -z "${DONE_build}" ] || return 0 ; DONE_build="yes"
config || return 1
if [ ! -d "cmake-${VERSION}-${PLATFORM}/Bootstrap" ]; then
configure || return 1
fi
echo "Running make ..." &&
(
cd "cmake-${VERSION}-${PLATFORM}" &&
${MAKE} ${BUILD_FLAGS}
) >Logs/build.log 2>&1 || error_log Logs/build.log
}
#-----------------------------------------------------------------------------
tests()
{
[ -z "${DONE_tests}" ] || return 0 ; DONE_tests="yes"
config || return 1
[ -f "cmake-${VERSION}-${PLATFORM}/bin/ccmake" ] || build || return 1
echo "Running tests ..." &&
(
cd "cmake-${VERSION}-${PLATFORM}" &&
rm -rf Tests &&
./bin/ctest -V
) >Logs/tests.log 2>&1 || error_log Logs/tests.log
}
#-----------------------------------------------------------------------------
install()
{
[ -z "${DONE_install}" ] || return 0 ; DONE_install="yes"
config || return 1
[ -d "cmake-${VERSION}-${PLATFORM}/Tests/Simple" ] || tests || return 1
echo "Running make install ..." &&
(
rm -rf ${INSTALL_DIR} &&
cd "cmake-${VERSION}-${PLATFORM}" &&
${MAKE} install DESTDIR="${RELEASE_ROOT}/${INSTALL_DIR}"
) >Logs/install.log 2>&1 || error_log Logs/install.log
}
#-----------------------------------------------------------------------------
strip()
{
[ -z "${DONE_strip}" ] || return 0 ; DONE_strip="yes"
config || return 1
[ -f "${INSTALL_DIR}/usr/local/bin/ccmake" ] || install || return 1
echo "Stripping executables ..." &&
(
strip ${INSTALL_DIR}${PREFIX}/bin/*
) >Logs/strip.log 2>&1 || error_log Logs/strip.log
}
#-----------------------------------------------------------------------------
manifest()
{
[ -z "${DONE_manifest}" ] || return 0 ; DONE_manifest="yes"
config || return 1
[ -f "${INSTALL_DIR}/usr/local/bin/ccmake" ] || install || return 1
echo "Writing MANIFEST ..." &&
(
mkdir -p ${INSTALL_DIR}${PREFIX}${DOC_DIR} &&
rm -rf ${INSTALL_DIR}${PREFIX}${DOC_DIR}/MANIFEST &&
touch ${INSTALL_DIR}${PREFIX}${DOC_DIR}/MANIFEST &&
cd ${INSTALL_DIR}${PREFIX} &&
FILES=`find . -type f |sed 's/^\.\///'` &&
cd ${RELEASE_ROOT} &&
(cat >> ${INSTALL_DIR}${PREFIX}${DOC_DIR}/MANIFEST <<EOF
${FILES}
EOF
) &&
rm -rf ${INSTALL_DIR}/README &&
(cat > ${INSTALL_DIR}/README <<EOF
CMake $VERSION binary for $PLATFORM
Extract the file "cmake-${VERSION}-${PLATFORM}-files.tar" into your
destination directory (typically /usr/local). The following files will
be extracted:
${FILES}
EOF
)
) >Logs/manifest.log 2>&1 || error_log Logs/manifest.log
}
#-----------------------------------------------------------------------------
# Create binary tarballs for CMake.
#
# binary_tarball
#
binary_tarball()
{
[ -z "${DONE_binary_tarball}" ] || return 0 ; DONE_binary_tarball="yes"
config || return 1
strip || return 1
manifest || return 1
echo "Creating binary tarballs ..." &&
(
mkdir -p Tarballs &&
rm -rf ${INSTALL_DIR}/cmake-${VERSION}-${PLATFORM}-files.tar &&
(
cd ${INSTALL_DIR}${PREFIX} &&
tar cvf ${RELEASE_ROOT}/${INSTALL_DIR}/cmake-${VERSION}-${PLATFORM}-files.tar *
) &&
rm -rf Tarballs/cmake-${VERSION}-${PLATFORM}.tar* &&
(
cd ${INSTALL_DIR} &&
tar cvf ${RELEASE_ROOT}/Tarballs/cmake-${VERSION}-${PLATFORM}.tar cmake-${VERSION}-${PLATFORM}-files.tar README
) &&
(
cd Tarballs &&
gzip -c cmake-${VERSION}-${PLATFORM}.tar >cmake-${VERSION}-${PLATFORM}.tar.gz &&
compress cmake-${VERSION}-${PLATFORM}.tar
)
) >Logs/binary_tarball.log 2>&1 || error_log Logs/binary_tarball.log
}
#-----------------------------------------------------------------------------
cygwin_source_tarball()
{
[ -z "${DONE_cygwin_source_tarball}" ] || return 0 ; DONE_cygwin_source_tarball="yes"
config || return 1
[ -d "cmake-${VERSION}" ] || checkout || return 1
echo "Creating cygwin source tarball ..." &&
(
mkdir -p Cygwin &&
rm -rf Cygwin/cmake-${VERSION}.tar.bz2 &&
tar cvjf Cygwin/cmake-${VERSION}.tar.bz2 cmake-${VERSION}
) >Logs/cygwin_source_tarball.log 2>&1 || error_log Logs/cygwin_source_tarball.log
}
#-----------------------------------------------------------------------------
cygwin_source_patch()
{
[ -z "${DONE_cygwin_source_patch}" ] || return 0 ; DONE_cygwin_source_patch="yes"
config || return 1
[ -d "cmake-${VERSION}" ] || checkout || return 1
echo "Creating source patch for cygwin ..." &&
(
mkdir -p Cygwin &&
rm -rf Cygwin/Patched &&
mkdir -p Cygwin/Patched &&
(tar c cmake-${VERSION} | (cd Cygwin/Patched; tar x)) &&
cd Cygwin/Patched &&
mkdir -p cmake-${VERSION}/CYGWIN-PATCHES &&
(
CYGVERSION=`uname -r`
cat > cmake-${VERSION}/CYGWIN-PATCHES/cmake.README <<EOF
cmake
--------------------------------------
Runtime requirements:
cygwin-${CYGVERSION} or newer
Build requirements
cygwin-${CYGVERSION} or newer
make
Canonical homepage:
http://www.cmake.org
Canonical download:
ftp://www.cmake.org/pub/cmake/
------------------------------------
Build instructions:
unpack cmake-${VERSION}-${RELEASE}-src.tar.bz2
if you use setup to install this src package, it will be
unpacked under /usr/src automatically
cd /usr/src
./cmake-${VERSION}-${RELEASE}.sh all
This will create:
/usr/src/cmake-${VERSION}-${RELEASE}.tar.bz2
/usr/src/cmake-${VERSION}-${RELEASE}-src.tar.bz2
-------------------------------------------
Port Notes:
<none>
------------------
Cygwin port maintained by: CMake Developers <cmake@www.cmake.org>
EOF
) &&
(
cat > cmake-${VERSION}/CYGWIN-PATCHES/setup.hint <<EOF
# CMake setup.hint file for cygwin setup.exe program
category: Devel
requires: libncurses6 cygwin
sdesc: "A cross platform build manger"
ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files."
prev: ${PREVIOUS_VERSION}-${PREVIOUS_RELEASE}
curr: ${VERSION}-${RELEASE}
EOF
) &&
dos2unix cmake-${VERSION}/CYGWIN-PATCHES/setup.hint &&
cp cmake-${VERSION}/CYGWIN-PATCHES/setup.hint ../setup.hint &&
(diff -urN "../../cmake-${VERSION}" "cmake-${VERSION}" > "../cmake-${VERSION}-${RELEASE}.patch"; [ "$?" = "1" ])
) >Logs/cygwin_source_patch.log 2>&1 || error_log Logs/cygwin_source_patch.log
}
#-----------------------------------------------------------------------------
cygwin_package_script()
{
[ -z "${DONE_cygwin_package_script}" ] || return 0 ; DONE_cygwin_package_script="yes"
utilities || return 1
echo "Creating cygwin packaging script ..." &&
(
mkdir -p Cygwin &&
cp ReleaseUtilities/cygwin-package.sh.in Cygwin/cmake-${VERSION}-${RELEASE}.sh &&
chmod u+x Cygwin/cmake-${VERSION}-${RELEASE}.sh
) >Logs/cygwin_package_script.log 2>&1 || error_log Logs/cygwin_package_script.log
}
#-----------------------------------------------------------------------------
# Create the CMake cygwin package files.
#
# cygwin_package
#
# This command should be run from a cygwin prompt.
cygwin_package()
{
[ -z "${DONE_cygwin_package}" ] || return 0 ; DONE_cygwin_package="yes"
config || return 1
[ -f "Cygwin/cmake-${VERSION}.tar.bz2" ] || cygwin_source_tarball || return 1
[ -f "Cygwin/cmake-${VERSION}-${RELEASE}.patch" ] || cygwin_source_patch || return 1
[ -f "Cygwin/cmake-${VERSION}-${RELEASE}.sh" ] || cygwin_package_script || return 1
echo "Running cygwin packaging script ..." &&
(
rm -rf Cygwin/Package &&
mkdir -p Cygwin/Package &&
cd Cygwin/Package &&
cp ../setup.hint . &&
cp ../cmake-${VERSION}.tar.bz2 . &&
cp ../cmake-${VERSION}-${RELEASE}.patch . &&
cp ../cmake-${VERSION}-${RELEASE}.sh . &&
./cmake-${VERSION}-${RELEASE}.sh all
) >Logs/cygwin_package.log 2>&1 || error_log Logs/cygwin_package.log
}
#-----------------------------------------------------------------------------
# Upload the CMake cygwin package files.
#
# cygwin_upload
#
# This should be run after "cygwin_package".
cygwin_upload()
{
setup || return 1
echo "------- Copying cywgin packages to www.cmake.org. -------"
scp Cygwin/Package/cmake-${VERSION}-${RELEASE}-src.tar.bz2 \
Cygwin/Package/cmake-${VERSION}-${RELEASE}.tar.bz2 \
Cygwin/Package/setup.hint \
kitware@www.cmake.org:/projects/FTP/pub/cmake/cygwin
echo "---- Done copying cygwin packages to www.cmake.org. -----"
}
#-----------------------------------------------------------------------------
win32_zipfile()
{
setup || return 1
echo "Creating windows non-admin install zip file ..." &&
(
mkdir -p Win32 &&
cd "c:/Program Files" &&
rm -rf cmake-${VERSION}-x86-win.zip &&
zip -r cmake-${VERSION}-x86-win.zip CMake \
-x CMake/INSTALL.LOG -x CMake/UNWISE.EXE -x CMake/WiseUpdt.exe &&
mv cmake-${VERSION}-x86-win.zip ${RELEASE_ROOT}/Win32
) >Logs/win32_zipfile.log 2>&1 || error_log Logs/win32_zipfile.log
}
#-----------------------------------------------------------------------------
win32_upload()
{
setup || return 1
echo "------- Copying windows zip file to www.cmake.org. -------"
scp Win32/cmake-${VERSION}-x86-win.zip \
kitware@www.cmake.org:/projects/FTP/pub/cmake/v${CMAKE_VERSION}
echo "---- Done copying windows zip file to www.cmake.org. -----"
}
#-----------------------------------------------------------------------------
# Install CMake into the OSX package directory structure.
#
# osx_install
#
# This will build CMake if it is not already built.
osx_install()
{
[ -z "${DONE_osx_install}" ] || return 0 ; DONE_osx_install="yes"
config || return 1
[ -f "cmake-${VERSION}-${PLATFORM}/bin/ccmake" ] || build || return 1
if [ -z "${WX_RESOURCES}" ]; then
echo "${CONFIG_FILE} should specify WX_RESOURCES."
return 1
fi
echo "Running make install for OSX package ..." &&
(
rm -rf OSX &&
mkdir -p OSX/Package_Root/Applications &&
mkdir -p OSX/Resources/PreFlight &&
mkdir -p OSX/Resources/PostFlight &&
(
cd "cmake-${VERSION}-${PLATFORM}" &&
${MAKE} install DESTDIR="${RELEASE_ROOT}/OSX/Package_Root"
) &&
cp cmake-${VERSION}/Copyright.txt OSX/Resources/License.txt &&
cp -r cmake-${VERSION}-${PLATFORM}/bin/CMake.app OSX/Package_Root/Applications &&
echo "APPL????" > OSX/Package_Root/Applications/CMake.app/Contents/PkgInfo &&
cp "${WX_RESOURCES}" OSX/Package_Root/Applications/CMake.app/Contents/Resources/wxCMakeSetup.rsrc
) >Logs/osx_install.log 2>&1 || error_log Logs/osx_install.log
}
#-----------------------------------------------------------------------------
run()
{
CMD="'$1'"; shift; for i in "$@"; do CMD="${CMD} '$i'"; done
eval "$CMD"
}
# Determine task and evaluate it.
if [ -z "$TASK" ] && [ -z "$REMOTE" ] ; then
if [ -z "$1" ]; then
usage
else
run "$@"
fi
else
[ -z "$TASK" ] || eval run "$TASK"
fi