1 set(CVSROOT ":pserver:anonymous@www.cmake.org:/cvsroot/CMake")
2 get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
4 # default to self extracting tgz, tgz, and tar.Z
5 if(NOT DEFINED CPACK_BINARY_GENERATORS)
6 set(CPACK_BINARY_GENERATORS "STGZ TGZ TZ")
7 endif(NOT DEFINED CPACK_BINARY_GENERATORS)
10 endif(DEFINED EXTRA_COPY)
11 if(NOT DEFINED CMAKE_RELEASE_DIRECTORY)
12 set(CMAKE_RELEASE_DIRECTORY "~/CMakeReleaseDirectory")
13 endif(NOT DEFINED CMAKE_RELEASE_DIRECTORY)
14 if(NOT DEFINED SCRIPT_NAME)
15 set(SCRIPT_NAME "${HOST}")
16 endif(NOT DEFINED SCRIPT_NAME)
17 if(NOT DEFINED MAKE_PROGRAM)
18 message(FATAL_ERROR "MAKE_PROGRAM must be set")
19 endif(NOT DEFINED MAKE_PROGRAM)
21 set(MAKE "${MAKE_PROGRAM}")
22 endif(NOT DEFINED MAKE)
23 if(NOT DEFINED RUN_SHELL)
24 set(RUN_SHELL "/bin/sh")
25 endif(NOT DEFINED RUN_SHELL)
26 if(NOT DEFINED PROCESSORS)
28 endif(NOT DEFINED PROCESSORS)
29 if(NOT DEFINED CMAKE_CREATE_VERSION)
30 message(FATAL_ERROR "CMAKE_CREATE_VERSION not defined")
31 endif(NOT DEFINED CMAKE_CREATE_VERSION)
32 if(NOT DEFINED CVS_COMMAND)
34 endif(NOT DEFINED CVS_COMMAND)
36 if("${CMAKE_CREATE_VERSION}" STREQUAL "CVS")
37 set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -D now ")
38 set( CMAKE_CREATE_VERSION "CurrentCVS")
39 else("${CMAKE_CREATE_VERSION}" STREQUAL "CVS")
40 set( CMAKE_CHECKOUT "${CVS_COMMAND} -q -z3 -d ${CVSROOT} export -r ${CMAKE_CREATE_VERSION} ")
41 endif("${CMAKE_CREATE_VERSION}" STREQUAL "CVS")
43 if(NOT DEFINED FINAL_PATH )
44 set(FINAL_PATH ${CMAKE_RELEASE_DIRECTORY}/${CMAKE_CREATE_VERSION}-build)
45 endif(NOT DEFINED FINAL_PATH )
48 message(FATAL_ERROR "HOST must be specified with -DHOST=host")
51 message(FATAL_ERROR "MAKE must be specified with -DMAKE=\"make -j2\"")
52 endif(NOT DEFINED MAKE)
54 message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel = ${PROCESSORS}")
56 # define a macro to run a remote command
57 macro(remote_command comment command)
60 message("ssh ${HOST} ${EXTRA_HOP} ${command}")
61 execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2})
62 else(${ARGC} GREATER 2)
63 message("ssh ${HOST} ${EXTRA_HOP} ${command}")
64 execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result)
65 endif(${ARGC} GREATER 2)
66 if(${result} GREATER 0)
67 message(FATAL_ERROR "Error running command: ${command}, return value = ${result}")
68 endif(${result} GREATER 0)
69 endmacro(remote_command)
71 # set this so configure file will work from script mode
72 set(CMAKE_BACKWARDS_COMPATIBILITY 2.4)
73 # create the script specific for the given host
74 set(SCRIPT_FILE release_cmake-${SCRIPT_NAME}.sh)
75 configure_file(${SCRIPT_PATH}/release_cmake.sh.in ${SCRIPT_FILE} @ONLY)
77 # run the script by starting a shell on the remote machine
78 # then using the script file as input to the shell
80 message(FATAL_ERROR "run this command: ${RUN_SHELL} ${SCRIPT_FILE}")
82 remote_command("run release_cmake-${HOST}.sh on server"
83 "${RUN_SHELL}" ${SCRIPT_FILE})
86 # now figure out which types of packages were created
87 set(generators ${CPACK_BINARY_GENERATORS} ${CPACK_SOURCE_GENERATORS})
88 separate_arguments(generators)
89 foreach(gen ${generators})
90 if("${gen}" STREQUAL "TGZ")
91 set(SUFFIXES ${SUFFIXES} "*.tar.gz")
92 endif("${gen}" STREQUAL "TGZ")
93 if("${gen}" STREQUAL "STGZ")
94 set(SUFFIXES ${SUFFIXES} "*.sh")
95 endif("${gen}" STREQUAL "STGZ")
96 if("${gen}" STREQUAL "PackageMaker")
97 set(SUFFIXES ${SUFFIXES} "*.dmg")
98 endif("${gen}" STREQUAL "PackageMaker")
99 if("${gen}" STREQUAL "TBZ2")
100 set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
101 endif("${gen}" STREQUAL "TBZ2")
102 if("${gen}" MATCHES "Cygwin")
103 set(SUFFIXES ${SUFFIXES} "*.tar.bz2")
104 set(extra_files setup.hint)
105 endif("${gen}" MATCHES "Cygwin")
106 if("${gen}" STREQUAL "TZ")
107 set(SUFFIXES ${SUFFIXES} "*.tar.Z")
108 endif("${gen}" STREQUAL "TZ")
109 if("${gen}" STREQUAL "ZIP")
110 set(SUFFIXES ${SUFFIXES} "*.zip")
111 endif("${gen}" STREQUAL "ZIP")
112 if("${gen}" STREQUAL "NSIS")
113 set(SUFFIXES ${SUFFIXES} "*.exe")
114 endif("${gen}" STREQUAL "NSIS")
116 # copy all the files over from the remote machine
117 set(PROJECT_PREFIX cmake-)
118 foreach(suffix ${SUFFIXES})
119 message("scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .")
120 execute_process(COMMAND
121 scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .
122 RESULT_VARIABLE result)
123 if(${result} GREATER 0)
124 message("error getting file back scp ${HOST}:${FINAL_PATH}/${PROJECT_PREFIX}${suffix} .")
125 endif(${result} GREATER 0)
128 # if there are extra files to copy get them as well
130 foreach(f ${extra_files})
131 message("scp ${HOST}:${FINAL_PATH}/${f} .")
132 execute_process(COMMAND
133 scp ${HOST}:${FINAL_PATH}/${f} .
134 RESULT_VARIABLE result)
135 if(${result} GREATER 0)
136 message("error getting file back scp ${HOST}:${FINAL_PATH}/${f} .")
137 endif(${result} GREATER 0)