146 touch $TMPDIR/abort
147 fi
148 ) | tee -a $mail_msg_file >> $LOGFILE
149
150 if [ -f $TMPDIR/abort ]; then
151 build_ok=n
152 echo "\nAborting at request of $HOOKNAME" |
153 tee -a $mail_msg_file >> $LOGFILE
154 exit 1
155 fi
156 fi
157 }
158
159 #
160 # usage: filelist DESTDIR PATTERN
161 #
162 function filelist {
163 DEST=$1
164 PATTERN=$2
165 cd ${DEST}
166
167 OBJFILES=${ORIG_SRC}/xmod/obj_files
168 if [ ! -f ${OBJFILES} ]; then
169 return;
170 fi
171 for i in `grep -v '^#' ${OBJFILES} | \
172 grep ${PATTERN} | cut -d: -f2 | tr -d ' \t'`
173 do
174 # wildcard expansion
175 for j in $i
176 do
177 if [ -f "$j" ]; then
178 echo $j
179 fi
180 if [ -d "$j" ]; then
181 echo $j
182 fi
183 done
184 done | sort | uniq
185 }
186
187 # function to save off binaries after a full build for later
188 # restoration
189 function save_binaries {
190 # save off list of binaries
191 echo "\n==== Saving binaries from build at `date` ====\n" | \
192 tee -a $mail_msg_file >> $LOGFILE
193 rm -f ${BINARCHIVE}
194 cd ${CODEMGR_WS}
195 filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE
196 filelist ${CODEMGR_WS} '^preserve:' | \
197 cpio -ocB 2>/dev/null | compress \
198 > ${BINARCHIVE}
199 }
200
201 # delete files
202 # usage: hybridize_files DESTDIR MAKE_TARGET
203 function hybridize_files {
204 DEST=$1
398 tee -a $mail_msg_file >> $LOGFILE
399 build_ok=n
400 return
401 fi
402
403 SRC=${DEST}/usr/src
404
405 cd $SRC
406 rm -f ${MAKETARG}.out
407 echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE
408 /bin/time $MAKE -e ${MAKETARG} 2>&1 | \
409 tee -a $SRC/${MAKETARG}.out >> $LOGFILE
410 echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file
411 egrep ":" $SRC/${MAKETARG}.out | \
412 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
413 egrep -v "Ignoring unknown host" | \
414 egrep -v "warning" >> $mail_msg_file
415
416 echo "clearing state files." >> $LOGFILE
417 find . -name '.make*' -exec rm -f {} \;
418
419 cd ${DEST}
420 if [ "${MAKETARG}" = "CRYPT_SRC" ]; then
421 rm -f ${CODEMGR_WS}/crypt_files.cpio.Z
422 echo "\n==== xmod/cry_files that don't exist ====\n" | \
423 tee -a $mail_msg_file >> $LOGFILE
424 CRYPT_FILES=${WS}/usr/src/xmod/cry_files
425 for i in `cat ${CRYPT_FILES}`
426 do
427 # make sure the files exist
428 if [ -f "$i" ]; then
429 continue
430 fi
431 if [ -d "$i" ]; then
432 continue
433 fi
434 echo "$i" | tee -a $mail_msg_file >> $LOGFILE
435 done
436 find `cat ${CRYPT_FILES}` -print 2>/dev/null | \
437 cpio -ocB 2>/dev/null | \
438 compress > ${CODEMGR_WS}/crypt_files.cpio.Z
439 fi
440
441 if [ "${MAKETARG}" = "EXPORT_SRC" ]; then
442 # rename first, since we might restore a file
443 # of the same name (mapfiles)
444 rename_files ${EXPORT_SRC} EXPORT_SRC
445 if [ "$SH_FLAG" = "y" ]; then
446 hybridize_files ${EXPORT_SRC} EXPORT_SRC
447 fi
448 fi
449
450 # save the cleartext
451 echo "\n==== Creating ${MAKETARG}.cpio.Z ====\n" | \
452 tee -a $mail_msg_file >> $LOGFILE
453 cd ${DEST}
454 rm -f ${MAKETARG}.cpio.Z
455 find usr -depth -print | \
456 grep -v usr/src/${MAKETARG}.out | \
457 cpio -ocB 2>/dev/null | \
458 compress > ${CODEMGR_WS}/${MAKETARG}.cpio.Z
459 if [ "${MAKETARG}" = "EXPORT_SRC" ]; then
460 restore_binaries ${EXPORT_SRC} EXPORT_SRC
461 fi
462
463 if [ "${MAKETARG}" = "CRYPT_SRC" ]; then
464 restore_binaries ${CRYPT_SRC} CRYPT_SRC
465 fi
466
467 }
468
469 # Return library search directive as function of given root.
470 function myldlibs {
471 echo "-L$1/lib -L$1/usr/lib"
472 }
473
474 # Return header search directive as function of given root.
475 function myheaders {
476 echo "-I$1/usr/include"
477 }
478
479 #
480 # Function to do the build, including package generation.
481 # usage: build LABEL SUFFIX ND MULTIPROTO
482 # - LABEL is used to tag build output.
483 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
484 # open-only vs full tree).
485 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
486 # - If MULTIPROTO is "yes", it means to name the proto area according to
1081 -l do "make lint" in $LINTDIRS (default: $SRC y)
1082 -m send mail to $MAILTO at end of build
1083 -n do not do a bringover
1084 -o build using root privileges to set OWNER/GROUP (old style)
1085 -p create packages
1086 -r check ELF runtime attributes in the proto area
1087 -t build and use the tools in $SRC/tools (default setting)
1088 +t Use the build tools in $ONBLD_TOOLS/bin
1089 -u update proto_list_$MACH and friends in the parent workspace;
1090 when used with -f, also build an unrefmaster.out in the parent
1091 -w report on differences between previous and current proto areas
1092 -z compress cpio archives with gzip
1093 -W Do not report warnings (freeware gate ONLY)
1094 -S Build a variant of the source product
1095 E - build exportable source
1096 D - build domestic source (exportable + crypt)
1097 H - build hybrid source (binaries + deleted source)
1098 O - build (only) open source
1099 '
1100 #
1101 # -x less public handling of xmod source for the source product
1102 #
1103 # A log file will be generated under the name $LOGFILE
1104 # for partially completed build and log.`date '+%F'`
1105 # in the same directory for fully completed builds.
1106 #
1107
1108 # default values for low-level FLAGS; G I R are group FLAGS
1109 A_FLAG=n
1110 C_FLAG=n
1111 D_FLAG=n
1112 F_FLAG=n
1113 f_FLAG=n
1114 i_FLAG=n; i_CMD_LINE_FLAG=n
1115 l_FLAG=n
1116 M_FLAG=n
1117 m_FLAG=n
1118 N_FLAG=n
1119 n_FLAG=n
1120 O_FLAG=n
1121 o_FLAG=n
1122 P_FLAG=n
|
146 touch $TMPDIR/abort
147 fi
148 ) | tee -a $mail_msg_file >> $LOGFILE
149
150 if [ -f $TMPDIR/abort ]; then
151 build_ok=n
152 echo "\nAborting at request of $HOOKNAME" |
153 tee -a $mail_msg_file >> $LOGFILE
154 exit 1
155 fi
156 fi
157 }
158
159 #
160 # usage: filelist DESTDIR PATTERN
161 #
162 function filelist {
163 DEST=$1
164 PATTERN=$2
165 cd ${DEST}
166 }
167
168 # function to save off binaries after a full build for later
169 # restoration
170 function save_binaries {
171 # save off list of binaries
172 echo "\n==== Saving binaries from build at `date` ====\n" | \
173 tee -a $mail_msg_file >> $LOGFILE
174 rm -f ${BINARCHIVE}
175 cd ${CODEMGR_WS}
176 filelist ${CODEMGR_WS} '^preserve:' >> $LOGFILE
177 filelist ${CODEMGR_WS} '^preserve:' | \
178 cpio -ocB 2>/dev/null | compress \
179 > ${BINARCHIVE}
180 }
181
182 # delete files
183 # usage: hybridize_files DESTDIR MAKE_TARGET
184 function hybridize_files {
185 DEST=$1
379 tee -a $mail_msg_file >> $LOGFILE
380 build_ok=n
381 return
382 fi
383
384 SRC=${DEST}/usr/src
385
386 cd $SRC
387 rm -f ${MAKETARG}.out
388 echo "making ${MAKETARG} in ${SRC}." >> $LOGFILE
389 /bin/time $MAKE -e ${MAKETARG} 2>&1 | \
390 tee -a $SRC/${MAKETARG}.out >> $LOGFILE
391 echo "\n==== ${MAKETARG} build errors ====\n" >> $mail_msg_file
392 egrep ":" $SRC/${MAKETARG}.out | \
393 egrep -e "(^${MAKE}:|[ ]error[: \n])" | \
394 egrep -v "Ignoring unknown host" | \
395 egrep -v "warning" >> $mail_msg_file
396
397 echo "clearing state files." >> $LOGFILE
398 find . -name '.make*' -exec rm -f {} \;
399 }
400
401 # Return library search directive as function of given root.
402 function myldlibs {
403 echo "-L$1/lib -L$1/usr/lib"
404 }
405
406 # Return header search directive as function of given root.
407 function myheaders {
408 echo "-I$1/usr/include"
409 }
410
411 #
412 # Function to do the build, including package generation.
413 # usage: build LABEL SUFFIX ND MULTIPROTO
414 # - LABEL is used to tag build output.
415 # - SUFFIX is used to distinguish files (e.g., DEBUG vs non-DEBUG,
416 # open-only vs full tree).
417 # - ND is "-nd" (non-DEBUG builds) or "" (DEBUG builds).
418 # - If MULTIPROTO is "yes", it means to name the proto area according to
1013 -l do "make lint" in $LINTDIRS (default: $SRC y)
1014 -m send mail to $MAILTO at end of build
1015 -n do not do a bringover
1016 -o build using root privileges to set OWNER/GROUP (old style)
1017 -p create packages
1018 -r check ELF runtime attributes in the proto area
1019 -t build and use the tools in $SRC/tools (default setting)
1020 +t Use the build tools in $ONBLD_TOOLS/bin
1021 -u update proto_list_$MACH and friends in the parent workspace;
1022 when used with -f, also build an unrefmaster.out in the parent
1023 -w report on differences between previous and current proto areas
1024 -z compress cpio archives with gzip
1025 -W Do not report warnings (freeware gate ONLY)
1026 -S Build a variant of the source product
1027 E - build exportable source
1028 D - build domestic source (exportable + crypt)
1029 H - build hybrid source (binaries + deleted source)
1030 O - build (only) open source
1031 '
1032 #
1033 # A log file will be generated under the name $LOGFILE
1034 # for partially completed build and log.`date '+%F'`
1035 # in the same directory for fully completed builds.
1036 #
1037
1038 # default values for low-level FLAGS; G I R are group FLAGS
1039 A_FLAG=n
1040 C_FLAG=n
1041 D_FLAG=n
1042 F_FLAG=n
1043 f_FLAG=n
1044 i_FLAG=n; i_CMD_LINE_FLAG=n
1045 l_FLAG=n
1046 M_FLAG=n
1047 m_FLAG=n
1048 N_FLAG=n
1049 n_FLAG=n
1050 O_FLAG=n
1051 o_FLAG=n
1052 P_FLAG=n
|