1 csh=obsolete || exec sh $0 $argv:q
2 OLDEST_nmake=950509 OLDEST_pax=950509
3 csh=obsolete || exec sh $0 $argv:q
5 # software shipment installation control
7 : "this id string works around a bug introduced sometime in 1991
8 @(#)shipin (AT&T Bell Laboratories) 05/09/95
11 # ship/shipin [options] [component ...] [name=value ...]
15 # -c don't compute closure if components specified
17 # -i read in from spool but do not uncrate or build
18 # (files set up for shipout)
19 # -n show actions but do not execute
20 # -p don't run proto on uncrate
21 # -r usr usr is the shipment recipient
22 # -s dir shipment spool hierarchy copied to dir
23 # -t show component closure but do not build
24 # -u uncrate shipment source but do not build
26 # -E ignore previous tool build errors
27 # -F force (re)build (no uncrating unless -u)
28 # -L don't generate proto line syncs on uncrate
29 # -O preserve old shipments
30 # -P delete #pragma prototyped on input
31 # -X tool exclude tools from uncrating or building
33 # The component arguments cause shipin to build only on those components.
34 # All component source will be uncrated.
36 # The remaining arguments are passed as arguments to the generating
37 # makes or shell scripts -- handy for `name=value' overrides.
39 # The minimum configuration must have an $INSTALLROOT/ship subdirectory.
40 # See $INSTALLROOT/ship/README for more details.
42 # If $CC is not set then CC=$INSTALLROOT/bin/cc if it exists. This
43 # provides a workaround hook for botches in the compilation system
44 # that go beyond setting CC and CCFLAGS. Botches are so bad/ugly/temporary
45 # that we refuse to incorporate workarounds in our mainline code.
46 # Systems that currently require workarounds are:
55 *x*) set '' -x ${1+"$@"}; shift ;;
62 *) PS4='+$LINENO+ ' ;;
67 # disable the builtin wc because ksh may hang during the execution later of "wc pic.o"
71 # this script may be overwritten while it is being executed
72 # so copy it and exec from the copy
76 _command_save_=ship/SHIPin
81 *) _ship_check_=$_check_
83 cp $_command_ $_command_save_ 2>/dev/null && chmod +x $_command_save_ && exec $_command_save_ ${1+"$@"}
88 # the components in ORDER are built first
89 # OLDEST_<cmd> is the oldest version of <cmd> that can be used
97 USER=${USER-${LOGNAME-`echo $HOME | sed 's/.*\///'`}}
100 RECIPIENT=${RECIPIENT-$USER}
101 FROMSYS=`(uname -n || hostname || cat /etc/whoami) 2>/dev/null`
102 d=/lib:/usr/lib:/usr/local/lib
103 for i in LD_LIBRARY_PATH
106 "") eval $i='$'INSTALLROOT/lib ;;
107 *) eval $i='$'INSTALLROOT/lib:$v ;;
111 OPATH=/bin:/usr/bin:$PATH
112 PATH=:$PATH:$INSTALLROOT/bin
122 SHIP=$INSTALLROOT/ship
130 SHIPDATE=[0-9][0-9][0-9][0-9][0-9][0-9]
132 SHIPSLOG=$SHIP/shipslog
140 if (unalias make) 2> /dev/null
141 then unalias cp make rm
145 # check for old exit status botch
149 (set -e; false || true) && _set_=e || echo "$_command_: command errors ignored because of shell botch" >&2
150 _set_="set -x$_set_;"
158 _exclude_=" bin cmd lib src shipslog "
159 _export_="CC CCFLAGS"
178 1) set '?'; continue ;;
182 -s) _uuspool_="$_uuspool_ $2" ;;
183 -X) _exclude_="$_exclude$2 " ;;
185 _options_="$_options_ $1"
188 -c) _closure_= ORDER= ;;
190 -i) _intermediate_=1 ;;
193 -t) _total_=1 _trace_=: _components_= ;;
198 -L) _proto_default_=pr ;;
200 -P) _proto_opt_=z$_proto_opt_ ;;
201 --) _options_="$_options_ $1"; shift; break ;;
202 '?'|[-+]*) echo "Usage: $_command_ [-cinptuxEF] [-r recipient] [-s spool-dir] [-X tool] [tool ...] [name=value ...]" >&2; exit 2 ;;
203 *=*) eval `echo $1 | sed -e '/^[a-zA-Z0-9_]*=/!d' -e "s/\([^=]*\)=\(.*\)/i=\1 \1=\'\2\'/"`
204 _export_="$_export_ $i"
208 _options_="$_options_ $1"
213 # option controlled vars
218 "") case $SHIPSPOOL in
219 "") SHIPSPOOL="/usr/spool/uucppublic/$RECIPIENT/* /usr/spool/uucppublic/receive/$RECIPIENT/*" ;;
222 *) SHIPSPOOL=$_uuspool_ ;;
227 # must be in $INSTALLROOT
231 then echo "$_command_: must have \$INSTALLROOT/ship directory" >&2; exit 1
236 ?*) $_trace_ cd $SHIP ;;
241 # best guess for cc command and flags
242 # probe info cached in $_ship_probe_
246 ""|cc) test -f $INSTALLROOT/bin/cc && CC=$INSTALLROOT/bin/cc ;;
251 *) _ship_probe_=SHIPprobe
255 test -f $_ship_probe_ && . ./$_ship_probe_
256 case "+ $_ship_probe_PATH + $_ship_probe_CC +" in
258 CC="$_ship_probe_CC $_ship_probe_CCFLAGS"
259 case $_ship_probe_CCFLAGS in
260 ?*) CC="$CC $_ship_probe_CCFLAGS" ;;
263 *) _ship_probe_PATH=$PATH
265 "") echo 'main() { return 0; }' > ${_tmp_}0.c
269 #define STD_POSIX1 (1<<5)
270 #define STD_LIMITS (1<<4)
272 #define STD_POSIX2 (1<<2)
273 #define STD_XOPEN (1<<1)
274 #define STD_ALL (1<<0)
298 printf("#ccflags#%04o#%s\n", std, argv[1]);
304 set /opt/SUNWspro/bin:+:$PATH:+:/opt/gnu/bin:/usr/add-on/gnu/bin:/usr/local/bin
307 set cc 9 gcc 8 xlc 7 acc 6 apcc 5
315 +) std=1\$std; continue ;;
318 test -x \$bin/\$1 && break
326 \$cmd -o ${_tmp_}0.exe ${_tmp_}0.c && ./${_tmp_}0.exe &&
334 '-D_ANSI_SOURCE -D_POSIX_SOURCE' \
335 '-D_ANSI_SOURCE -D_XOPEN_SOURCE' \
336 '-D_ANSI_C_SOURCE -D_POSIX_SOURCE' \
337 '-D_ANSI_C_SOURCE -D_XOPEN_SOURCE' \
338 '-D_POSIX_SOURCE -D_XOPEN_SOURCE' \
339 '-D_ANSI_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE' \
340 '-D_ANSI_C_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE' \
346 *) xxx=\"\$xxx \$opt\" tie=0 ;;
348 \$xxx $_tmp_.c -o $_tmp_.exe && ./$_tmp_.exe \"\$2#\$tie# \$seq#\$xxx\"
352 done 2>/dev/null | sort +0r -1 +1 | grep '^#ccflags#' | sed -e '2,$d' -e 's/.*#//'`"
359 echo 'int x;' > $_tmp_.c
360 rm -f $_tmp_.o 2>/dev/null
361 if $CC -c $_tmp_.c >/dev/null 2>&1 && test -f $_tmp_.o
363 else echo "$_command_: must have CC=\"$CC\" to continue" >&2
373 echo "#if !defined(TEST) && (defined(__STDC__) || defined(__cplusplus))
379 #include <sys/types.h>
381 #define glue(a,b) a ## b
386 main(int argc, char** argv) { return 0; }
389 if $CC $CCFLAGS -c $_tmp_.c >/dev/null 2>&1
390 then if $CC $CCFLAGS -DTEST -c $_tmp_.c >/dev/null 2>&1
392 elif $CC -D__STDC__ $CCFLAGS -DTEST -c $_tmp_.c >/dev/null 2>&1
393 then CC="$CC -D__STDC__"
394 case $_ship_probe_CCFLAGS in
395 ?*) _ship_probe_CCFLAGS="$_ship_probe_CCFLAGS " ;;
397 _ship_probe_CCFLAGS="${_ship_probe_CCFLAGS}-D__STDC__"
400 echo "#include <sys/types.h>
401 #include <sys/socket.h>
402 #include <netinet/in.h>
403 main() { return socket(0, 0, 0); }" > $_tmp_.c
404 for i in "" "-systype bsd43"
405 do if $CC $CCFLAGS $i -o $_tmp_.exe $_tmp_.c >/dev/null 2>&1
408 case $_ship_probe_CCFLAGS in
409 ?*) _ship_probe_CCFLAGS="$_ship_probe_CCFLAGS " ;;
411 _ship_probe_CCFLAGS="${_ship_probe_CCFLAGS}$i"
419 echo _ship_probe_PATH="'$_ship_probe_PATH'"
420 echo _ship_probe_CC="'$_ship_probe_CC'"
421 echo _ship_probe_CCFLAGS="'$_ship_probe_CCFLAGS'"
436 # check the manifest and then copy from the spool area to $SHIP
442 for UUSHIP in $SHIPSPOOL
443 do if test -d $UUSHIP
446 ?*) $_trace_ cd $UUSHIP ;;
448 for f in ${SHIPDATE}*.*
449 do if test -f $f/manifest
450 then _manifest_=`cat $f/manifest`
456 *.???) p=`echo $i | sed -e 's/\....$//'` ;;
464 echo "$f: $i has not arrived yet" >&2
474 $f/unspool) _unspool_=$i ;;
477 if test "" != "$_unspool_" -a -f $_unspool_ && $_trace_ . $_unspool_
479 else echo "$f: cannot unspool shipment" >&2; continue
490 d=`echo "$d " | sed -e 's,//*[^/ ]* , ,g'`
491 $_trace_ rm -rf $f $d
496 ?*) $_trace_ cd $INSTALLROOT ;;
502 # check for shipment support update
506 # P must exist on PATH
509 _path_=`echo $PATH | sed -e 's/:/ /g' -e 's,///*,/,g'`
510 _stamp_='`sed -e /@(#)$c'\''.* (AT.T.*).* [0-9][0-9]\\/[0-9][0-9]\\/[0-9][0-9]/!d'\'' -e '\''s/.*@(#).* (.*).* \\(..\\)\\/\\(..\\)\\/\\(..\\).*/\\3\\1\\2/'\'' -e q $f 2>/dev/null`'
532 *P*) for i in $_path_
533 do if test -x $i/$_cmd_
540 do if test -x $i/$_cmd_
548 *P*) echo "$_command_: must have $_cmd_ to continue" >&2
557 eval _ship${_cmd_}_=$SHIP/ship$_cmd_
561 if test -f ship$_cmd_$_suf_
562 then f=ship$_cmd_$_suf_; eval new=$_stamp_
563 if test -f SHIP$_cmd_$_suf_
564 then f=SHIP$_cmd_$_suf_; eval old=$_stamp_
568 *M*) echo "$_command_: must have ship$_cmd_$_suf_ to continue" >&2
575 # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
576 if test "$new" -gt "${old:-0}"
578 ?*) cp ship$_cmd_$_suf_ SHIP$_cmd_$_suf_ ;;
580 elif test "$new" -lt "$old"
581 then cp SHIP$_cmd_$_suf_ ship$_cmd_$_suf_
583 _update_="$_update_ $_cmd_$_suf_"
586 ?*) f=ship$_cmd_; eval old=$_stamp_
588 .c) test -f $f && ./$f </dev/null >/dev/null 2>&1 || old=0 ;;
590 # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
591 if test "$new" -gt "${old:-0}"
594 *) cp ship$_cmd_ SHIP$_cmd_ ;;
597 .c) if $CC $CCFLAGS -o SHIPa.out ship$_cmd_$_suf_
598 then mv SHIPa.out ship$_cmd_
601 *M*) echo "$_command_: must have ship$_cmd_ to continue" >&2
611 .sh) cp ship$_cmd_$_suf_ ship$_cmd_
619 *B*) f=$BIN/$_cmd_; eval old=$_stamp_
620 # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
621 if test "$new" -gt "${old:-0}"
622 then if test ! -d $BIN
625 cp ship$_cmd_ $BIN/$_cmd_
631 "") test -x $BIN/feature || ln $BIN/iffe $BIN/feature ;;
637 case " $_update_ " in
638 *" in "*) $_trace_ exec $_command_ $_options_ ${1+"$@"} ;;
642 # intermediate unpacking from spool area done
645 case $_debug_$_intermediate_ in
650 # grab the select args
666 # handle character class botch -- it's hard to believe 9th edition
667 # did this, easier to believe BSD never added it
673 [!0]) cclasstype='!' ;;
678 # set up and verify the default directory hierarchy
681 hierarchy="src src/cmd src/lib ship/shipslog"
683 "") hierarchy="$hierarchy bin fun include lib man man/man1 man/man3 man/man8" ;;
687 then $_trace_ mkdir $d
690 if test ! -f src/Makefile
691 then case $_trace_ in
692 "") echo ":MAKE: lib - cmd" > src/Makefile ;;
693 *) $_trace_ echo ":MAKE: lib - cmd" "> src/Makefile" ;;
696 if test ! -f src/lib/Makefile
697 then case $_trace_ in
698 "") echo ':MAKE: lib[0-9]* - libast - *' > src/lib/Makefile ;;
699 *) $_trace_ echo ':MAKE: lib[0-9]* - libast - *' '> src/lib/Makefile' ;;
702 if test ! -f src/cmd/Makefile
703 then case $_trace_ in
704 "") echo ':MAKE: probe - cpp - *' > src/cmd/Makefile ;;
705 *) $_trace_ echo ':MAKE: probe - cpp - *' '> src/cmd/Makefile' ;;
710 # ignore and silent may be used by nmake generated bootstraps
713 case $_trace_$_uncrate_ in
714 "") if test ! -f bin/ignore
715 then cat > bin/ignore <<'!'
722 if test ! -f bin/silent
723 then cat > bin/silent <<'!'
737 # check if we can use nmake from the start
738 # if so then limit proto to notices only
744 do if test -f $p/nmake && test "`$p/nmake -n -f - 'error 0 \$(MAKEVERSION:@/.*\\(..\\)\\/\\(..\\)\\/\\(..\\)\$/\\3\\1\\2/)' 'nop:' nop </dev/null 2>&1`" -ge "$OLDEST_nmake" 2>/dev/null
745 then l=`echo $p | sed 's,[^/]*\$,lib,'`
746 _make_="$p/nmake MAKEPP=$l/cpp MAKERULES=$l/make/makerules"
748 _proto_default_=d$_proto_default_
752 _proto_default_=$_proto_default_$_proto_opt_
755 # some context for nohup.out
759 then _nohup_="==============================================================================="
761 id="`(uname -a) 2>/dev/null`"
763 ?*) echo "system $id" ;;
765 echo "installroot $INSTALLROOT"
768 *) echo "shipspool $SHIPSPOOL" ;;
771 $RECIPIENT) echo "by $FROMSYS!$INSTALLER" ;;
772 *) echo "by $FROMSYS!$INSTALLER for $RECIPIENT" ;;
774 echo "archive $AR_PATH $AR_DELTA"
780 echo "cc $CC $CCFLAGS"
782 ?*) echo "preroot $CCS" ;;
790 # finish up initialization
794 ?*) $_trace_ cd $SHIP ;;
799 # uncrate the archives into the source tree
802 COMPONENTS_SELECT=" "
804 do case $_exclude_ in
805 *" $NAME "*) continue ;;
807 if test -f $NAME/items
808 then # don't rebuild items under local control
809 echo "$_command_: warning: $NAME: delete ship/$NAME/items to build" >&2
815 *[${cclasstype}a-zA-Z_0-9]*)
819 '') case "`echo $NAME | grep '[^a-zA-Z_0-9]'`" in
828 *_*) eval `echo $NAME | sed 's/\([^_]*\)_\(.*\)/_system_=\1 _tool_=\2/'`
829 _root_=$INSTALLROOT/$_system_
831 then $_trace_ mkdir $_root_
836 *) if test ! -d $_root_/$d
837 then $_trace_ mkdir $_root_/$d
843 *) _root_=$INSTALLROOT
851 _source_=$_root_/src/$_type_/$_tool_
852 if test ! -d $_source_
853 then $_trace_ mkdir $_source_
857 delta= # newest delta for newest base [not in dlist]
858 dlist= # list of deltas for newest base [no delta]
859 need= # pax needed to uncrate
860 new= # delta shipments requiring new base
861 old= # first base for new chain
862 remove= # old shipments to be removed
863 type= # base|delete|delta|patch
866 "$SHIPMENT") continue ;;
868 if test -f $d/base -o -f $d/delete
869 then remove="$remove $base $dlist $delta $need $new"
878 else if test "" != "$base" -a -f $d/$base && egrep 'DELTA!!!|!PAX!D!' $d/$base >/dev/null
879 then case $AR_DELTA in
888 "") dlist="$dlist $d"
890 *) if test -f $d/$base
891 then dlist="$dlist $delta"
893 elif test "" != "$delta" -a -f $d/$delta
894 then dlist="$dlist $base"
901 else dlist="$dlist $d"
908 delete) case $NAME in
913 $_trace_ rm -rf $SHIP/$NAME $INSTALLROOT/src/$i/$NAME
918 do echo generate $NAME $i base from $old >&2
920 "") echo "generate $NAME $i base from $old [`date`]" >> $SHIP/$NAME/$LOG
922 delta) $AR_DELTA -rf $i/$old -z $old/base -wf $i/base
925 patch) mkdir /tmp/ship.$$
927 $AR_READ < $SHIP/$NAME/$old/base &&
928 $AR_READ < $SHIP/$NAME/$i/$old &&
930 $AR_LIST < $SHIP/$NAME/$old/base
931 $AR_LIST < $SHIP/$NAME/$i/$old
932 } | sort -u | $AR_WRITE > $SHIP/$NAME/$i/base
939 0) touch $i/GENERATED
941 *) echo "cannot generate $i base from $old" >&2
942 echo "cannot generate $i base from $old" >> $SHIP/$NAME/$LOG
947 *) $_trace_ $AR_DELTA -rf $SHIP/$NAME/$i/$old -z $SHIP/$NAME/$old/base -wf $i/base
948 $_trace_ touch $SHIP/$NAME/$i/GENERATED
954 "") echo "$_command_: warning: $NAME: no base archive" >&2
960 ?*) case `echo $remove $dlist` in
962 "") rm -rf $remove $dlist 2>/dev/null ;;
963 *) $_trace_ "(cd $NAME; rm -rf" $remove $dlist")" ;;
969 $_trace_ cd $_source_
971 "") _release_=$base ;;
972 *) _release_=$delta ;;
974 if test 11 = "$_force_$_uncrate_" -o ! -f $SHIP/$NAME/$_release_/UNCRATED
975 then echo uncrate $NAME $_release_ $type >&2
977 "") echo "uncrate $NAME $_release_ $type [`date`]" >> $SHIP/$NAME/$LOG ;;
980 if test -f $SHIP/$NAME/$_release_/delete
985 if test ! -f $SHIP/$NAME/$_release_/items
986 then echo "$_command_: warning: $NAME: no items file" >&2
988 _proto_options_="-${_proto_default_}c`cat $SHIP/$NAME/$_release_/copyright 2>/dev/null`"
989 if test "" = "$AAR_LIST" -o "delta" = "$type" || $OAR_LIST < $SHIP/$NAME/$base/base >/dev/null 2>&1
990 then AR_PATH=$OAR_PATH
994 else AR_PATH=$AAR_PATH
1003 base) if test ! -f $SHIP/$NAME/$_release_/GENERATED
1004 then case $_trace_ in
1006 *) $_trace_ "(cd $_source_; rm -rf *)" ;;
1013 base) _release_=$base ;;
1014 *) _release_=$delta ;;
1017 "") if $AR_READ < $SHIP/$NAME/$_release_/$_base_
1018 then case $_shipproto_ in
1019 ?*) $AR_LIST <$SHIP/$NAME/$_release_/$_base_ 2>/dev/null | grep '\.[chlyY]$' | $_shipproto_ -l - "${_proto_options_}"
1022 if test -d features && test ! -d feature
1023 then ln -s features feature 2>/dev/null
1024 elif test -d feature && test ! -d features
1025 then ln -s feature features 2>/dev/null
1027 else error="$AR_PATH $type read failed"
1030 *) $_trace_ "$AR_READ < $SHIP/$NAME/$_release_/$_base_"
1031 case $_shipproto_ in
1032 ?*) $_trace_ "$AR_LIST <$SHIP/$NAME/$_release_/$_base_ 2>/dev/null | grep '\.[chlyY]\$' | $_shipproto_ -l - ${_proto_options_}" ;;
1040 delta) if $_trace_ $AR_DELTA -rf $SHIP/$NAME/$_release_/$base -z $SHIP/$NAME/$base/base
1041 then $_trace_ touch $SHIP/$NAME/$base/UNCRATED
1042 case $_shipproto_ in
1043 ?*) case $_trace_ in
1044 "") ($AR_DELTA -f $SHIP/$NAME/$base/base '*.[chlyY]'; $AR_DELTA -f $SHIP/$NAME/$_release_/$base '*.[chlyY]') 2>/dev/null | sort -u | $_shipproto_ -l - "${_proto_options_}" ;;
1045 *) $_trace_ "($AR_DELTA -f $SHIP/$NAME/$base/base '*.[chlyY]'; $AR_DELTA -f $SHIP/$NAME/$_release_/$base '*.[chlyY]') 2>/dev/null | sort -u | $_shipproto_ -l - ${_proto_options_}" ;;
1050 "") if test -d features && test ! -d feature
1051 then ln -s features feature 2>/dev/null
1052 elif test -d feature && test ! -d features
1053 then ln -s feature features 2>/dev/null
1057 else error="$AR_DELTA $type read failed"
1064 "") $_trace_ touch $SHIP/$NAME/$_release_/UNCRATED ;;
1065 *) echo "$_command_: $NAME: $_release_: uncrate error: $error" >&2
1067 "") echo "uncrate $NAME $_release_ $type error: $error" >> $SHIP/$NAME/$LOG ;;
1074 eval STATE_$NAME=$_state_
1079 do NEED_pax="$NEED_pax $NAME/$i"
1082 *) eval RELEASE_$NAME=$_release_ SOURCE_$NAME=$_source_ TOOL_$NAME=$_tool_
1083 COMPONENTS_SELECT="$COMPONENTS_SELECT$NAME "
1090 case $COMPONENTS_SELECT in
1094 ?*) case $NEED_pax in
1095 ?*) case $STATE_pax in
1097 *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;
1106 # determine the ordered list of components to (re)build
1110 " ") COMPONENTS="$ORDER $COMPONENTS_SELECT" ;;
1112 for NAME in $COMPONENTS_SELECT
1114 *" $NAME "*) COMPONENTS="$COMPONENTS $NAME" ;;
1121 # get the component closure
1125 "") ORDER=$COMPONENTS
1128 for NAME in $COMPONENTS
1137 do # we assume ITEMS_* not in environment
1138 eval _items_='"$'ITEMS_$_item_'"'
1140 "") eval _release_='$'RELEASE_$_item_
1141 _items_=`cat $_item_/$_release_/items 2>/dev/null`" $_item_"
1142 eval ITEMS_$_item_='"$'_items_'"'
1150 do eval SEEN_$_item_=
1153 do eval seen='$'SEEN_$_item_
1155 "") eval SEEN_$_item_=1
1161 eval ITEMS_$NAME='"'$new'"'
1170 do eval seen='$'SEEN_$NAME
1172 "") eval SEEN_$NAME=1
1173 ORDER="$ORDER $NAME"
1183 do case $_exclude_ in
1184 *" $NAME "*) continue ;;
1186 eval _release_='$'RELEASE_$NAME
1187 test -f $NAME/$_release_/items || continue
1189 "") _built_=$NAME/$_release_/BUILT
1190 eval _items_='$'ITEMS_$NAME
1192 do case " $COMPONENTS " in
1193 *" $i "*) _built_=; break ;;
1197 *) eval _built_='"'$_built_ $i/'$'RELEASE_$i/BUILT'"' ;;
1201 ?*) if $_shipop_ newer $_built_
1208 $_trace_ rm -f $NAME/$_release_/BUILT
1209 if test "" != "$_force_" -o "" != "$_ignore_" -o ! -f $NAME/$_release_/ERROR
1210 then COMPONENTS="$COMPONENTS $NAME"
1211 $_trace_ rm -f $NAME/$_release_/ERROR
1212 elif test ! -f $NAME/$_release_/BYPASS
1213 then echo "$_command_: $NAME/$_release_: new shipment required" >&2
1218 # tame the environment
1222 ?*) STATE_nmake=installed ;;
1226 MAKEPP=$INSTALLROOT/lib/cpp
1227 MAKERULES=$INSTALLROOT/lib/make/makerules
1228 export MAKEPP MAKERULES
1232 COSHELL_OPTIONS=nodevfd
1234 MAKE_OPTIONS="clobber compare link=lib*.a*"
1236 PATH=:$INSTALLROOT/bin:$PATH
1238 export COSHELL_OPTIONS ENV MAKE_OPTIONS MAKEPATH PATH VPATH
1239 case $_AST_FEATURES in
1240 "") _AST_FEATURES='UNIVERSE - att PATH_RESOLVE - logical'
1241 export _AST_FEATURES
1246 # (re)build the components
1250 for NAME in $COMPONENTS
1251 do case $_exclude_ in
1252 *" $NAME "*) continue ;;
1254 eval _items_='$'ITEMS_$NAME
1256 "") for i in $_items_
1259 *) eval r='$'RELEASE_$i
1260 if test ! -f $SHIP/$i/$r/BUILT
1261 then if test -f $SHIP/$i/$r/ERROR
1262 then m="had build errors"
1263 elif test -f $SHIP/$i/$r/UNCRATED
1264 then m="was not built"
1265 else m="was not shipped"
1267 m="$NAME requires $i but $i $m"
1269 echo "$m" >> $SHIP/$NAME/$LOG
1277 eval _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME _tool_='$'TOOL_$NAME
1279 ?*) _components_="$_components_ $NAME/$_release_"
1283 echo build $NAME $_release_ >&2
1284 $_trace_ cd $_source_
1287 if test -f $_bypass_
1288 then touch $SHIP/$NAME/$_release_/BYPASS
1289 else case $STATE_nmake in
1292 nmake) $_make_ -o "ignorelock mismatch" ${1+"$@"}
1293 MAKEPP=$INSTALLROOT/lib/cpp ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
1294 MAKEPP=$INSTALLROOT/lib/cpp MAKERULES=./Makerules.mo ./nmake -o "ignorelock mismatch" install ${1+"$@"}
1296 *) $_make_ -o "ignorelock mismatch" install ${1+"$@"}
1301 *) if test -f Mamfile
1302 then # here it is -- make+state in v7 shell
1304 "") case `(echo ok | (read -r a; echo $a) 2>/dev/null)` in
1305 ok) _read_='read -r' ;;
1311 echo 'main(){return 0;}' > main.c
1312 if $CC -c main.c >/dev/null 2>&1
1313 then if $CC -L. main.o -lc >/dev/null 2>&1
1314 then $CC -L. main.o -lc > libc.a >/dev/null 2>&1 || echo "mam_cc_L=' '"
1317 echo "int f(){return(0);} main(){return(f());}" > pic.c
1318 if $CC -c pic.c >/dev/null 2>e
1321 set x -Kpic -fpic -pic +z '-G 0'
1328 $CC $1 -c pic.c >/dev/null 2>e && test -f pic.o && $CC $1 -o ./pic.exe pic.o >/dev/null 2>&1 && test -f pic.exe || continue
1334 ???*) os=\`wc pic.o\`
1338 m=\`echo " $1" | sed -e 's/^ [-+]//g' -e 's/./-& /g' -e 's/[-+] //g'\`
1340 if $CC $m -c pic.c >/dev/null 2>e && test -f pic.o && $CC $m -o ./pic.exe pic.o >/dev/null 2>&1 && test -f pic.exe
1341 then case \`wc -l e\` in
1344 *) case \`wc pic.o\` in
1350 echo "mam_cc_PIC='$1'"
1353 *) case \`wc pic.o\` in
1355 *) echo "mam_cc_PIC='$1'"
1369 "") case `(a=old; eval a=new </dev/null; echo $a) 2>/dev/null` in
1370 new) _redirect_=new ;;
1371 *) _redirect_=old ;;
1383 mv $_mam_.list.tmp $_mam_.list
1385 $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.time
1389 # some shells die with diff,next,same in vars
1391 exec 9> $_mam_.list.tmp
1392 if test -f $_mam_.list -a -f $_mam_.time
1393 then $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.sort.tmp
1394 comm -12 $_mam_.time $_mam_.sort.tmp | sed 's/ .*//' > $_mam_.same.tmp
1395 rm -f $_mam_.sort.tmp
1396 else : > $_mam_.same.tmp
1402 "read") # read strips \ -- thanks a lot
1403 # tmp file avoids char at a time read
1404 sed 's/\\/\\\\/g' Mamfile > $_mam_.read.tmp
1405 exec < $_mam_.read.tmp
1410 eval `sed -e '1,/^make /d' -e '/^setv /!d' -e 's/^setv \([^ ]*\).*/\1= /' Mamfile`
1412 do eval `echo $_data_ | sed -e 's/\"/\\\\"/g' -e 's/=/=\\"/' -e 's/\$/\\"/'`
1415 while IFS=' '; $_read_ _op_ _arg_ _val_
1420 "info") case $_arg_ in
1425 "setv") eval _data_='$'$_arg_
1426 case $_index_:$_data_ in
1429 new) eval $_arg_="$_val_" </dev/null
1431 old) exec 8<&0 0</dev/null
1432 eval $_arg_="$_val_"
1440 "make") eval _name_$_index_=$_name_
1441 eval _prev_$_index_=$_prev_
1442 eval _cmds_$_index_='"$_cmds_"'
1443 eval _attr_$_index_=$_attr_
1455 "") grep "^$_name_\$" $_mam_.same.tmp >/dev/null && _attr_= ;;
1462 *" metarule "*) _attr_=M$_attr_ ;;
1465 *u*) echo $_name_ >> $_mam_.diff.tmp ;;
1468 eval _name_$_index_=$_name_
1469 eval _prev_$_index_=$_prev_
1470 eval _cmds_$_index_=$_cmds_
1471 eval _attr_$_index_=$_attr_
1475 "prev") case $_attr_ in
1478 "") eval _arg_=$_arg_
1479 if grep "^$_arg_\$" $_mam_.diff.tmp >/dev/null
1480 then _attr_=u$_attr_
1481 elif grep "^$_arg_\$" $_mam_.same.tmp >/dev/null
1483 else _attr_=u$_attr_
1495 _) echo $_op_: missing make op >&2; continue ;;
1498 "attr") case $_arg_ in
1499 "meta"|"suff") _attr_=M ;;
1507 ?*) _arg_="$_arg_ $_val_" ;;
1519 "done") eval _arg_=$_arg_
1522 $_targ_) _main_=2 ;;
1525 $_name_)case $_attr_ in
1527 *u*) case $_cmds_ in
1532 *) eval "($_set_$_cmds_) </dev/null" ||
1538 *if*then*fi*|"||") _status_=0 ;;
1544 *) echo "*** exit code $_status_ making $_name_" >&2
1551 echo $_name_ >> $_mam_.diff.tmp
1557 eval _name_='$'_name_$_index_
1558 eval _prev_='$'_prev_$_index_
1559 eval _cmds_='$'_cmds_$_index_
1560 eval _attr_='$'_attr_$_index_
1563 *) _attr_=$_prop_$_attr_ ;;
1566 *) echo $_arg_: $_op_ $_name_ expected >&2
1575 *) echo "*** don't know how to make $_targ_" >&2 ;;
1580 elif test -f makefile
1581 then make -f makefile install ${1+"$@"}; error=$?
1582 elif test -f Makescript
1583 then ./Makescript ${1+"$@"}; error=$?
1584 elif test -f $_tool_.bs
1585 then ./$_tool_.bs ${1+"$@"}; error=$?
1586 else echo "$_command_: cannot build $NAME" >&2; error=1
1590 case $error+$NAME in
1591 0+nmake) $BIN/nmake -n -f /dev/null debug </dev/null >/dev/null 2>&1 || error=1 ;;
1594 0) touch $SHIP/$NAME/$_release_/BUILT ;;
1595 *) touch $SHIP/$NAME/$_release_/ERROR ;;
1597 fi 2>&1 | (PATH=$OPATH; tee $SHIP/$NAME/$TMP 1>&2)
1598 if test -f $SHIP/$NAME/$_release_/BUILT
1600 elif test -f $SHIP/$NAME/$_release_/BYPASS
1605 echo "build $NAME $_release_ $state [$start] [`date`]"
1607 ?*) echo preroot CCS = $CCS ;;
1609 # some egreps blow this
1616 -e '/^[a-zA-Z_][a-zA-Z_0-9]*$/d' \
1617 -e '/^[a-zA-Z_][a-zA-Z_0-9]*=/d' \
1618 -e '/[Cc]opyright/d' \
1619 -e '/: warning: assignment .* == was expected/d' \
1620 -e '/: warning: if .* no effect/d' \
1621 -e '/: warning: Symbol .* multiply defined/d' \
1623 rm -f $SHIP/$NAME/$TMP
1624 } >> $SHIP/$NAME/$LOG 2> /dev/null
1625 eval STATE_$NAME=$state
1627 *) if test -f $_source_/$_bypass_
1628 then $_trace_ "refer to $_source_/$_bypass_ to install $NAME"
1629 else case $STATE_nmake in
1632 nmake) $_trace_ $_make_ -o "ignorelock mismatch" ${1+"$@"}
1633 $_trace_ ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
1634 $_trace_ ./nmake -o "ignorelock mismatch" install ${1+"$@"}
1636 *) $_trace_ $_make_ -o "ignorelock mismatch" install ${1+"$@"}
1640 *) if test -f $_source_/Mamfile
1641 then $_trace_ "mamexec < Mamfile"
1642 elif test -f $_source_/Makescript
1643 then $_trace_ ./Makescript ${1+"$@"}
1644 elif test -f $_source_/$_tool_.bs
1645 then $_trace_ ./$_tool_.bs ${1+"$@"}
1646 else $_trace_ install $NAME
1653 $_trace_ cd $INSTALLROOT
1656 # accept stuff built before nmake to sync the state files
1661 for NAME in $COMPONENTS
1662 do eval state='$'STATE_$NAME _source_='$'SOURCE_$NAME
1664 ok) case $_trace_ in
1667 $BIN/nmake -o "accept ignorelock mismatch touch" install force_shared=1
1669 lib*) $BIN/nmake -o "accept" install ;;
1671 } 2>&1 | (PATH=$OPATH; tee $SHIP/$NAME/$TMP 1>&2)
1674 egrep -v '^([^ ]*:$| |\+ |[a-z] - |[a-zA-Z_][a-zA-Z_0-9]*=|$)' $SHIP/$NAME/$TMP
1675 rm -f $SHIP/$NAME/$TMP
1676 } 2>&1 >> $SHIP/$NAME/$LOG
1679 *) $_trace_ cd $_source_
1680 $_trace_ $BIN/nmake -o "accept ignorelock mismatch touch" install force_shared=1
1682 lib*) $_trace_ $BIN/nmake -o "accept" install ;;
1684 $_trace_ cd $INSTALLROOT
1699 ls -Cd $_components_
1702 eval ' select i in $_components_
1723 # check for installation reports
1729 for NAME in $COMPONENTS
1730 do eval state='$'STATE_$NAME _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME
1732 bypass) bypass="$bypass
1733 $_source_/$_bypass_"
1736 o=$SHIP/$NAME/$_release_/$OWNER
1738 then r=`cat $SHIP/$NAME/$_release_/$REPORT 2>/dev/null`
1742 case $r' + '$state in
1743 ?*' + '*|*' + 'error)
1745 owner=`echo $address | sed -e 's/.*\(.............\)/\1/' -e 's/^[^a-zA-Z_]/_/' -e 's/[^a-zA-Z_0-9]/_/g'`
1746 eval f='$'built_$owner
1747 eval built_$owner='"$'f $NAME'"'
1749 for f in $SHIP/$NAME/$LOG $r
1750 do case `ls -dt $f $SHIPSLOG/!$owner 2>/dev/null` in
1751 $f*) report="$report $f" ;;
1755 ?*) eval f='$'address_$owner
1757 "") owners="$owners $owner"
1758 eval address_$owner=$address
1761 eval eval report_$owner=\\\"\$report_$owner \\\[$NAME\\\] $report\\\"
1770 # check if any components required pax to uncrate
1774 ?*) AR_DELTA=$INSTALLROOT/bin/pax
1775 ($AR_DELTA -f /dev/null -z /dev/null) >/dev/null 2>&1 || STATE_pax=error
1777 ok) $_trace_ exec $_command_ $_options_ $SELECT ${1+"$@"} ;;
1778 *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;