5 if [ -n "$LOG_FILE" ]; then
6 echo "$0 $(date): $@" >> $LOG_FILE
10 if [ ! -f ./,,conf ]; then
12 # --*-shell-script-*--
14 # The path to the SXEmacs source
15 SOURCE=/path/to/sxemacs
17 # Hammer value when doing autogen.sh [Check it for more details
20 # Autogen command [leave empty in order to skip it]
21 AUTOGEN="./autogen.sh"
23 # The command line arguments to pass to the make command
24 MAKE_ARGS="time-build-report"
26 # File to log progress to
27 LOG_FILE=",,build.log"
29 # Make a ++TAGS directory
32 # Remove the build directory when build is successful
33 # (and after reporting...) ?
37 # Report the build status with an email?
39 # Failures or F (Failures only)
40 # Success or S (Successes only)
41 # Anything else - No reports at all
44 # Send success email to this address instead of sxemacs-devel@sxemacs.org
47 # Send failure email to this address instead of sxemacs-devel@sxemacs.org
50 # The email should come from this email address
51 # [ $USER@$(hostname -f 2> /dev/null || (hostname ; domainname)) will be used otherwise
54 echo "Please review the generated ,,conf file and rerun."
58 if [ -z "${SOURCE}" -o ! -d "${SOURCE}" -o ! -f ${SOURCE}/sxemacs.pc.in ]; then
59 echo "No SXEmacs source found at ${SOURCE}"
62 if [ -z "${MAIL_FROM}" ]; then
63 MAIL_FROM="${USER}@$(hostname -f 2> /dev/null || (hostname ; domainname))"
64 echo "WARNING: No mail from defined. Will use ${MAIL_FROM} instead."
67 if [ -n "${AUTOGEN}" ]; then
71 if [ -n "${HAMMER}" ]; then
72 echo HAMMER: ${HAMMER}
74 (export HAMMER ; ${AUTOGEN} ) || STATUS=FAIL_AUTOGEN
77 if [ -n "${STATUS}" ]; then
78 do_log "Failure: ${STATUS}"
81 if [ -n "${BUILD_TAGS}" ]; then
82 # Let's build ourselfs the tags for this source tree,
86 eval "${PREFIX}/configure" || STATUS="FAIL_CONFIGURE_$?"
87 if [ -z "${STATUS}" ]; then
88 make tags || STATUS="FAIL_TAGS_$?"
92 if [ -n "${STATUS}" ]; then
93 do_log "Failure: ${STATUS}"
97 if [ "$f" = "*.conf" ]; then
98 echo "Nothing to do - create some .conf files! "
102 CONF_OPTS="$(cat $f)"
103 build_name="$(echo ${f} |sed 's/\.conf$//')"
104 do_log "Started building ${build_name}"
105 if [ -d "./${build_name}" ]; then
106 /bin/rm -rf "./${build_name}"
108 mkdir -p "./${build_name}"
111 eval "${PREFIX}/configure ${CONF_OPTS}" || STATUS="FAIL_CONFIGURE_$?"
112 if [ "${STATUS}" = "FAIL_CONFIGURE_127" -a -f "./Installation" -a -f "./config.log" ]; then
113 if [ $(tail -1 ./config.log) = "configure: exit 0" ]; then
114 STATUS="FAIL_CONFIGURE_0"
117 if [ -z "${STATUS}" -o "${STATUS}" = "FAIL_CONFIGURE_0" ]; then
119 make ${MAKE_ARGS} || STATUS="FAIL_MAKE_$?"
120 if [ "${STATUS}" = "FAIL_MAKE_0" ]; then
123 if egrep '^make.*:.*Error' ,,beta.out; then
124 STATUS="${STATUS}_ERROR_IN_BUILD"
126 if [ -f ,,make-check.out ]; then
127 if [ ! "${STATUS}" = "Success" ]; then
129 elif [ -n "$(grep 'tests successful' ,,make-check.out | grep -v 100%)" ]; then
130 STATUS="Sucess(Some tests fail)"
137 if [ "${REPORT_STATUS}" = "Yes" -o "${REPORT_STATUS}" = "Y" ]; then
139 elif [ "${STATUS}" = "Success" -o "${STATUS}" = "Sucess(Some tests fail)" ]; then
140 if [ "${REPORT_STATUS}" = "Success" -o "${REPORT_STATUS}" = "S" ]; then
143 elif [ "${REPORT_STATUS}" = "Failures" -o "${REPORT_STATUS}" = "F" ]; then
146 if [ "${REPORT_THIS}" = "Yes" ]; then
147 if [ "${STATUS}" = "Success" -o "${STATUS}" = "Tests fail" -o "${STATUS}" = "Sucess(Some tests fail)" ]; then
148 # First test if can actually send email from SXEmacs, otherwise just give up :-)
149 CLI=" -eval \"(unless (fboundp 'mail-send-and-exit) (kill-emacs 2))\""
150 if [ -n "${MAIL_FROM}" ]; then
151 CLI="${CLI} -eval '(setq user-mail-address \"$MAIL_FROM\")'"
153 if [ -n "$MAIL_SUCCESS_TO" ]; then
154 CLI="${CLI} -eval '(setq build-rpt-email \"${MAIL_SUCCESS_TO}\")'"
156 CLI="${CLI} -eval '(if (send-build-rpt \"${STATUS}\") (kill-emacs 0) (kill-emacs 1))'"
157 eval "src/sxemacs -batch ${CLI}" || DO_REPORT_FAILURE="YES" STATUS="${STATUS}-Build-Rpt-Failed-$?"
159 DO_REPORT_FAILURE="YES"
161 if [ "${DO_REPORT_FAILURE}" = "YES" ]; then
162 ${PREFIX}/contrib/report-build-failure.sh "${MAIL_FROM}" "${MAIL_FAILURE_TO}" "${STATUS}"
166 if [ "${STATUS}" = "Success" ]; then
167 if [ "${REMOVE_ON_SUCCESS}" = "Yes" -o "${REMOVE_ON_SUCCESS}" = "Y" ]; then
168 /bin/rm -rf "./${build_name}"
171 do_log "Finished building ${build_name}: ${STATUS}"