shipin 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787
  1. csh=obsolete || exec sh $0 $argv:q
  2. OLDEST_nmake=950509 OLDEST_pax=950509
  3. csh=obsolete || exec sh $0 $argv:q
  4. #
  5. # software shipment installation control
  6. #
  7. : "this id string works around a bug introduced sometime in 1991
  8. @(#)shipin (AT&T Bell Laboratories) 05/09/95
  9. "
  10. #
  11. # ship/shipin [options] [component ...] [name=value ...]
  12. #
  13. # options:
  14. #
  15. # -c don't compute closure if components specified
  16. # -d for debugging
  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
  25. # -x set -x
  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
  32. #
  33. # The component arguments cause shipin to build only on those components.
  34. # All component source will be uncrated.
  35. #
  36. # The remaining arguments are passed as arguments to the generating
  37. # makes or shell scripts -- handy for `name=value' overrides.
  38. #
  39. # The minimum configuration must have an $INSTALLROOT/ship subdirectory.
  40. # See $INSTALLROOT/ship/README for more details.
  41. #
  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:
  47. # NeXT
  48. # Win/NT
  49. #
  50. case $1 in
  51. -x) set -x
  52. ;;
  53. *) case $- in
  54. *x*) set '' -x ${1+"$@"}; shift ;;
  55. esac
  56. ;;
  57. esac
  58. case $- in
  59. *x*) case $PS4 in
  60. *'$LINENO'*) ;;
  61. *) PS4='+$LINENO+ ' ;;
  62. esac
  63. ;;
  64. esac
  65. # disable the builtin wc because ksh may hang during the execution later of "wc pic.o"
  66. builtin -d wc
  67. #
  68. # this script may be overwritten while it is being executed
  69. # so copy it and exec from the copy
  70. #
  71. _command_=ship/shipin
  72. _command_save_=ship/SHIPin
  73. _check_=": $* :"
  74. case $_ship_check_ in
  75. $_check_)
  76. ;;
  77. *) _ship_check_=$_check_
  78. export _ship_check_
  79. cp $_command_ $_command_save_ 2>/dev/null && chmod +x $_command_save_ && exec $_command_save_ ${1+"$@"}
  80. ;;
  81. esac
  82. #
  83. # the components in ORDER are built first
  84. # OLDEST_<cmd> is the oldest version of <cmd> that can be used
  85. #
  86. INSTALLROOT=`pwd`
  87. export INSTALLROOT
  88. ORDER="pax ksh nmake"
  89. USER=${USER-${LOGNAME-`echo $HOME | sed 's/.*\///'`}}
  90. INSTALLER=$USER
  91. export INSTALLER
  92. RECIPIENT=${RECIPIENT-$USER}
  93. FROMSYS=`(uname -n || hostname || cat /etc/whoami) 2>/dev/null`
  94. d=/lib:/usr/lib:/usr/local/lib
  95. for i in LD_LIBRARY_PATH
  96. do eval v='$'$i
  97. case $v in
  98. "") eval $i='$'INSTALLROOT/lib ;;
  99. *) eval $i='$'INSTALLROOT/lib:$v ;;
  100. esac
  101. export $i
  102. done
  103. OPATH=/bin:/usr/bin:$PATH
  104. PATH=:$PATH:$INSTALLROOT/bin
  105. export PATH
  106. case $PS4 in
  107. +\ *|+*\ )
  108. ;;
  109. *) PS4="+ $PS4"
  110. export PS4
  111. ;;
  112. esac
  113. SHIP=$INSTALLROOT/ship
  114. BIN=$INSTALLROOT/bin
  115. _bypass_=Install
  116. LOG=in.log
  117. _mail_=/bin/mail
  118. OWNER=owner
  119. _read_=
  120. REPORT=report
  121. SHIPDATE=[0-9][0-9][0-9][0-9][0-9][0-9]
  122. SHIPMENT=*$SHIPDATE
  123. SHIPSLOG=$SHIP/shipslog
  124. TMP=tmp
  125. for f in $ORDER
  126. do eval RELEASE_$f=
  127. eval STATE_$f=
  128. done
  129. if (unalias make) 2> /dev/null
  130. then unalias cp make rm
  131. fi
  132. #
  133. # check for old exit status botch
  134. #
  135. _set_=
  136. (set -e; false || true) && _set_=e || echo "$_command_: command errors ignored because of shell botch" >&2
  137. _set_="set -x$_set_;"
  138. #
  139. # gobble the options
  140. #
  141. _closure_=1
  142. _debug_=
  143. _exclude_=" bin cmd lib src shipslog "
  144. _export_="CC CCFLAGS"
  145. _force_=
  146. _ignore_=
  147. _intermediate_=
  148. _options_=
  149. _preserve_=
  150. _proto_=1
  151. _proto_default_=npr
  152. _proto_opt_=
  153. _total_=
  154. _trace_=
  155. _uncrate_=
  156. _uuspool_=
  157. while :
  158. do case $# in
  159. 0) break ;;
  160. esac
  161. case $1 in
  162. -[rsX]) case $# in
  163. 1) set '?'; continue ;;
  164. esac
  165. case $1 in
  166. -r) RECIPIENT=$2 ;;
  167. -s) _uuspool_="$_uuspool_ $2" ;;
  168. -X) _exclude_="$_exclude$2 " ;;
  169. esac
  170. _options_="$_options_ $1"
  171. shift
  172. ;;
  173. -c) _closure_= ORDER= ;;
  174. -d) _debug_=1 ;;
  175. -i) _intermediate_=1 ;;
  176. -n) _trace_=echo ;;
  177. -p) _proto_= ;;
  178. -t) _total_=1 _trace_=: _components_= ;;
  179. -u) _uncrate_=1 ;;
  180. -x) set -x ;;
  181. -E) _ignore_=1 ;;
  182. -F) _force_=1 ;;
  183. -L) _proto_default_=pr ;;
  184. -O) _preserve_=1 ;;
  185. -P) _proto_opt_=z$_proto_opt_ ;;
  186. --) _options_="$_options_ $1"; shift; break ;;
  187. '?'|[-+]*) echo "Usage: $_command_ [-cinptuxEF] [-r recipient] [-s spool-dir] [-X tool] [tool ...] [name=value ...]" >&2; exit 2 ;;
  188. *=*) eval `echo $1 | sed -e '/^[a-zA-Z0-9_]*=/!d' -e "s/\([^=]*\)=\(.*\)/i=\1 \1=\'\2\'/"`
  189. _export_="$_export_ $i"
  190. ;;
  191. *) break ;;
  192. esac
  193. _options_="$_options_ $1"
  194. shift
  195. done
  196. #
  197. # option controlled vars
  198. #
  199. export RECIPIENT
  200. case $_uuspool_ in
  201. "") case $SHIPSPOOL in
  202. "") SHIPSPOOL="/usr/spool/uucppublic/$RECIPIENT/* /usr/spool/uucppublic/receive/$RECIPIENT/*" ;;
  203. esac
  204. ;;
  205. *) SHIPSPOOL=$_uuspool_ ;;
  206. esac
  207. export SHIPSPOOL
  208. #
  209. # must be in $INSTALLROOT
  210. #
  211. if test ! -d ship
  212. then echo "$_command_: must have \$INSTALLROOT/ship directory" >&2; exit 1
  213. fi
  214. cd $SHIP
  215. case $_trace_ in
  216. ?*) $_trace_ cd $SHIP ;;
  217. esac
  218. _tmp_=SHIPtmp
  219. #
  220. # best guess for cc command and flags
  221. # probe info cached in $_ship_probe_
  222. #
  223. case $CC in
  224. ""|cc) test -f $INSTALLROOT/bin/cc && CC=$INSTALLROOT/bin/cc ;;
  225. esac
  226. case $CC in
  227. $INSTALLROOT/bin/cc)
  228. ;;
  229. *) _ship_probe_=SHIPprobe
  230. _ship_probe_PATH=
  231. _ship_probe_CC=
  232. _ship_probe_CCFLAGS=
  233. test -f $_ship_probe_ && . ./$_ship_probe_
  234. case "+ $_ship_probe_PATH + $_ship_probe_CC +" in
  235. "+ $PATH + $CC +")
  236. CC="$_ship_probe_CC $_ship_probe_CCFLAGS"
  237. case $_ship_probe_CCFLAGS in
  238. ?*) CC="$CC $_ship_probe_CCFLAGS" ;;
  239. esac
  240. ;;
  241. *) _ship_probe_PATH=$PATH
  242. case $CC in
  243. "") echo 'main() { return 0; }' > ${_tmp_}0.c
  244. cat > $_tmp_.c <<'!'
  245. #include <stdio.h>
  246. #include <limits.h>
  247. #define STD_POSIX1 (1<<5)
  248. #define STD_LIMITS (1<<4)
  249. #define STD_C (0<<3)
  250. #define STD_POSIX2 (1<<2)
  251. #define STD_XOPEN (1<<1)
  252. #define STD_ALL (1<<0)
  253. main(argc, argv)
  254. int argc;
  255. char** argv;
  256. {
  257. int std = 0;
  258. #ifdef __STDC__
  259. std |= STD_C;
  260. #endif
  261. #ifdef CHAR_BIT
  262. std |= STD_LIMITS;
  263. #endif
  264. #ifdef PIPE_BUF
  265. std |= STD_POSIX1;
  266. #endif
  267. #ifdef LINE_MAX
  268. std |= STD_POSIX2;
  269. #endif
  270. #ifdef DBL_MAX
  271. std |= STD_XOPEN;
  272. #endif
  273. #ifdef PID_MAX
  274. std |= STD_ALL;
  275. #endif
  276. printf("#ccflags#%04o#%s\n", std, argv[1]);
  277. return 0;
  278. }
  279. !
  280. CC="`ifs=\$IFS
  281. IFS=:
  282. set /opt/SUNWspro/bin:+:$PATH:+:/opt/gnu/bin:/usr/add-on/gnu/bin:/usr/local/bin
  283. IFS=\$ifs
  284. path=\$*
  285. set cc 9 gcc 8 xlc 7 acc 6 apcc 5
  286. std=
  287. while :
  288. do case \$# in
  289. 0|1) break ;;
  290. esac
  291. for bin in \$path -
  292. do case \$bin in
  293. +) std=1\$std; continue ;;
  294. -) break 2 ;;
  295. esac
  296. test -x \$bin/\$1 && break
  297. done
  298. case $std in
  299. 1) cmd=\$1 ;;
  300. *) cmd=\$bin/\$1 ;;
  301. esac
  302. seq=
  303. rm -f ${_tmp_}0.exe
  304. \$cmd -o ${_tmp_}0.exe ${_tmp_}0.c && ./${_tmp_}0.exe &&
  305. for opt in \
  306. '' \
  307. -D_ALL_SOURCE \
  308. -D_ANSI_SOURCE \
  309. -D_ANSI_C_SOURCE \
  310. -D_POSIX_SOURCE \
  311. -D_XOPEN_SOURCE \
  312. '-D_ANSI_SOURCE -D_POSIX_SOURCE' \
  313. '-D_ANSI_SOURCE -D_XOPEN_SOURCE' \
  314. '-D_ANSI_C_SOURCE -D_POSIX_SOURCE' \
  315. '-D_ANSI_C_SOURCE -D_XOPEN_SOURCE' \
  316. '-D_POSIX_SOURCE -D_XOPEN_SOURCE' \
  317. '-D_ANSI_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE' \
  318. '-D_ANSI_C_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE' \
  319. -posix
  320. do seq=x$seq
  321. xxx=$cmd
  322. case \$opt in
  323. '') tie=1 ;;
  324. *) xxx=\"\$xxx \$opt\" tie=0 ;;
  325. esac
  326. \$xxx $_tmp_.c -o $_tmp_.exe && ./$_tmp_.exe \"\$2#\$tie# \$seq#\$xxx\"
  327. done
  328. shift
  329. shift
  330. done 2>/dev/null | sort +0r -1 +1 | grep '^#ccflags#' | sed -e '2,$d' -e 's/.*#//'`"
  331. rm -f ${_tmp_}*.*
  332. ;;
  333. esac
  334. case $CC in
  335. "") CC=cc ;;
  336. esac
  337. echo 'int x;' > $_tmp_.c
  338. rm -f $_tmp_.o 2>/dev/null
  339. if $CC -c $_tmp_.c >/dev/null 2>&1 && test -f $_tmp_.o
  340. then : ok
  341. else echo "$_command_: must have CC=\"$CC\" to continue" >&2
  342. exit 1
  343. fi
  344. _ship_probe_CC=$CC
  345. _ship_probe_CCFLAGS=
  346. #
  347. # commit the wimps
  348. #
  349. echo "#if !defined(TEST) && (defined(__STDC__) || defined(__cplusplus))
  350. (
  351. #else
  352. #include <stddef.h>
  353. #include <stdlib.h>
  354. #include <stdarg.h>
  355. #include <sys/types.h>
  356. #if defined(TEST)
  357. #define glue(a,b) a ## b
  358. glue(i, nt)
  359. #else
  360. int
  361. #endif
  362. main(int argc, char** argv) { return 0; }
  363. #endif
  364. " > $_tmp_.c
  365. if $CC $CCFLAGS -c $_tmp_.c >/dev/null 2>&1
  366. then if $CC $CCFLAGS -DTEST -c $_tmp_.c >/dev/null 2>&1
  367. then : ok
  368. elif $CC -D__STDC__ $CCFLAGS -DTEST -c $_tmp_.c >/dev/null 2>&1
  369. then CC="$CC -D__STDC__"
  370. case $_ship_probe_CCFLAGS in
  371. ?*) _ship_probe_CCFLAGS="$_ship_probe_CCFLAGS " ;;
  372. esac
  373. _ship_probe_CCFLAGS="${_ship_probe_CCFLAGS}-D__STDC__"
  374. fi
  375. fi
  376. echo "#include <sys/types.h>
  377. #include <sys/socket.h>
  378. #include <netinet/in.h>
  379. main() { return socket(0, 0, 0); }" > $_tmp_.c
  380. for i in "" "-systype bsd43"
  381. do if $CC $CCFLAGS $i -o $_tmp_.exe $_tmp_.c >/dev/null 2>&1
  382. then case $i in
  383. ?*) CC="$CC $i"
  384. case $_ship_probe_CCFLAGS in
  385. ?*) _ship_probe_CCFLAGS="$_ship_probe_CCFLAGS " ;;
  386. esac
  387. _ship_probe_CCFLAGS="${_ship_probe_CCFLAGS}$i"
  388. ;;
  389. esac
  390. break
  391. fi
  392. done
  393. rm -f $_tmp_.*
  394. {
  395. echo _ship_probe_PATH="'$_ship_probe_PATH'"
  396. echo _ship_probe_CC="'$_ship_probe_CC'"
  397. echo _ship_probe_CCFLAGS="'$_ship_probe_CCFLAGS'"
  398. } > $_ship_probe_
  399. ;;
  400. esac
  401. ;;
  402. esac
  403. for i in $_export_
  404. do eval d='"$'$i'"'
  405. case $d in
  406. ?*) export $i ;;
  407. esac
  408. done
  409. #
  410. # check the manifest and then copy from the spool area to $SHIP
  411. #
  412. case $_debug_ in
  413. ?*) SHIPSPOOL= ;;
  414. esac
  415. for UUSHIP in $SHIPSPOOL
  416. do if test -d $UUSHIP
  417. then cd $UUSHIP
  418. case $_trace_ in
  419. ?*) $_trace_ cd $UUSHIP ;;
  420. esac
  421. for f in ${SHIPDATE}*.*
  422. do if test -f $f/manifest
  423. then _manifest_=`cat $f/manifest`
  424. d=
  425. for i in $_manifest_
  426. do if test ! -f $i
  427. then case $i in
  428. */*/*) case $i in
  429. *.???) p=`echo $i | sed -e 's/\....$//'` ;;
  430. *) p=$i ;;
  431. esac
  432. if test -d $SHIP/$p
  433. then continue
  434. fi
  435. ;;
  436. esac
  437. echo "$f: $i has not arrived yet" >&2
  438. d=1
  439. fi
  440. done
  441. case $d in
  442. ?*) continue ;;
  443. esac
  444. _unspool_=
  445. for i in $_manifest_
  446. do case $i in
  447. $f/unspool) _unspool_=$i ;;
  448. esac
  449. done
  450. if test "" != "$_unspool_" -a -f $_unspool_ && $_trace_ . $_unspool_
  451. then : ok
  452. else echo "$f: cannot unspool shipment" >&2; continue
  453. fi
  454. d=
  455. for i in $_manifest_
  456. do case $i in
  457. $f/*) ;;
  458. *.000) d="$d $i" ;;
  459. */*.*) ;;
  460. */*/*) d="$d $i" ;;
  461. esac
  462. done
  463. d=`echo "$d " | sed -e 's,//*[^/ ]* , ,g'`
  464. $_trace_ rm -rf $f $d
  465. fi
  466. done
  467. cd $INSTALLROOT
  468. case $_trace_ in
  469. ?*) $_trace_ cd $INSTALLROOT ;;
  470. esac
  471. fi
  472. done
  473. #
  474. # check for shipment support update
  475. #
  476. # B install in $BIN
  477. # M must exist
  478. # P must exist on PATH
  479. #
  480. _path_=`echo $PATH | sed -e 's/:/ /g' -e 's,///*,/,g'`
  481. _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`'
  482. _update_=
  483. cd $SHIP
  484. set iffe .sh BM \
  485. in '' M \
  486. op .c M \
  487. proto .c BM \
  488. ar /usr/ccs/bin P \
  489. -- ${1+"$@"}
  490. while :
  491. do case $1 in
  492. --) shift; break ;;
  493. esac
  494. _cmd_=$1
  495. _suf_=$2
  496. _flg_=$3
  497. shift; shift; shift
  498. case $_flg_ in
  499. *B*) c=$_cmd_ ;;
  500. *) c=ship$_cmd_ ;;
  501. esac
  502. case $_flg_ in
  503. *P*) for i in $_path_
  504. do if test -x $i/$_cmd_
  505. then _flg_=
  506. break
  507. fi
  508. done
  509. case $_flg_ in
  510. *P*) for i in $_suf_
  511. do if test -x $i/$_cmd_
  512. then PATH=$PATH:$i
  513. _path_="$_path_ $i"
  514. _flg_=
  515. break
  516. fi
  517. done
  518. case $_flg_ in
  519. *P*) echo "$_command_: must have $_cmd_ to continue" >&2
  520. exit 1
  521. ;;
  522. esac
  523. ;;
  524. esac
  525. continue
  526. ;;
  527. esac
  528. eval _ship${_cmd_}_=$SHIP/ship$_cmd_
  529. case $_trace_ in
  530. ?*) continue ;;
  531. esac
  532. if test -f ship$_cmd_$_suf_
  533. then f=ship$_cmd_$_suf_; eval new=$_stamp_
  534. if test -f SHIP$_cmd_$_suf_
  535. then f=SHIP$_cmd_$_suf_; eval old=$_stamp_
  536. else old=0
  537. fi
  538. else case $_flg_ in
  539. *M*) echo "$_command_: must have ship$_cmd_$_suf_ to continue" >&2
  540. exit 1
  541. ;;
  542. esac
  543. eval _ship${_cmd_}_=
  544. continue
  545. fi
  546. # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
  547. if test "$new" -gt "${old:-0}"
  548. then case $_suf_ in
  549. ?*) cp ship$_cmd_$_suf_ SHIP$_cmd_$_suf_ ;;
  550. esac
  551. elif test "$new" -lt "$old"
  552. then cp SHIP$_cmd_$_suf_ ship$_cmd_$_suf_
  553. new=$old
  554. _update_="$_update_ $_cmd_$_suf_"
  555. fi
  556. case $_suf_ in
  557. ?*) f=ship$_cmd_; eval old=$_stamp_
  558. case $_suf_ in
  559. .c) test -f $f && ./$f </dev/null >/dev/null 2>&1 || old=0 ;;
  560. esac
  561. # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
  562. if test "$new" -gt "${old:-0}"
  563. then case $old in
  564. ""|0) ;;
  565. *) cp ship$_cmd_ SHIP$_cmd_ ;;
  566. esac
  567. case $_suf_ in
  568. .c) if $CC $CCFLAGS -o SHIPa.out ship$_cmd_$_suf_
  569. then mv SHIPa.out ship$_cmd_
  570. else case $old in
  571. ""|0) case $_flg_ in
  572. *M*) echo "$_command_: must have ship$_cmd_ to continue" >&2
  573. exit 1
  574. ;;
  575. esac
  576. eval _ship${_cmd_}_=
  577. continue
  578. ;;
  579. esac
  580. fi
  581. ;;
  582. .sh) cp ship$_cmd_$_suf_ ship$_cmd_
  583. chmod +x ship$_cmd_
  584. ;;
  585. esac
  586. else new=$old
  587. fi
  588. esac
  589. case $_flg_ in
  590. *B*) f=$BIN/$_cmd_; eval old=$_stamp_
  591. # the variable "old" can be empty, to avoid "arithmetic syntax error" from ksh, set it to 0
  592. if test "$new" -gt "${old:-0}"
  593. then if test ! -d $BIN
  594. then mkdir $BIN
  595. fi
  596. cp ship$_cmd_ $BIN/$_cmd_
  597. fi
  598. ;;
  599. esac
  600. done
  601. case $_trace_ in
  602. "") test -x $BIN/feature || ln $BIN/iffe $BIN/feature ;;
  603. esac
  604. case $_proto_ in
  605. "") _shipproto_= ;;
  606. esac
  607. cd $INSTALLROOT
  608. case " $_update_ " in
  609. *" in "*) $_trace_ exec $_command_ $_options_ ${1+"$@"} ;;
  610. esac
  611. #
  612. # intermediate unpacking from spool area done
  613. #
  614. case $_debug_$_intermediate_ in
  615. ?*) exit 0 ;;
  616. esac
  617. #
  618. # grab the select args
  619. #
  620. SELECT=" "
  621. while :
  622. do case $# in
  623. 0) break ;;
  624. esac
  625. case $1 in
  626. *=*) break ;;
  627. esac
  628. SELECT="$SELECT$1 "
  629. shift
  630. done
  631. #
  632. # handle character class botch -- it's hard to believe 9th edition
  633. # did this, easier to believe BSD never added it
  634. #
  635. cclasstype='^'
  636. case a in
  637. [${cclasstype}0]) ;;
  638. [!0]) cclasstype='!' ;;
  639. *) cclasstype='' ;;
  640. esac
  641. #
  642. # set up and verify the default directory hierarchy
  643. #
  644. hierarchy="src src/cmd src/lib ship/shipslog"
  645. case $_uncrate_ in
  646. "") hierarchy="$hierarchy bin fun include lib man man/man1 man/man3 man/man8" ;;
  647. esac
  648. for d in $hierarchy
  649. do if test ! -d $d
  650. then $_trace_ mkdir $d
  651. fi
  652. done
  653. if test ! -f src/Makefile
  654. then case $_trace_ in
  655. "") echo ":MAKE: lib - cmd" > src/Makefile ;;
  656. *) $_trace_ echo ":MAKE: lib - cmd" "> src/Makefile" ;;
  657. esac
  658. fi
  659. if test ! -f src/lib/Makefile
  660. then case $_trace_ in
  661. "") echo ':MAKE: lib[0-9]* - libast - *' > src/lib/Makefile ;;
  662. *) $_trace_ echo ':MAKE: lib[0-9]* - libast - *' '> src/lib/Makefile' ;;
  663. esac
  664. fi
  665. if test ! -f src/cmd/Makefile
  666. then case $_trace_ in
  667. "") echo ':MAKE: probe - cpp - *' > src/cmd/Makefile ;;
  668. *) $_trace_ echo ':MAKE: probe - cpp - *' '> src/cmd/Makefile' ;;
  669. esac
  670. fi
  671. #
  672. # ignore and silent may be used by nmake generated bootstraps
  673. #
  674. case $_trace_$_uncrate_ in
  675. "") if test ! -f bin/ignore
  676. then cat > bin/ignore <<'!'
  677. :
  678. "$@"
  679. exit 0
  680. !
  681. chmod +x bin/ignore
  682. fi
  683. if test ! -f bin/silent
  684. then cat > bin/silent <<'!'
  685. :
  686. case $1 in
  687. +|-|"") exit 0 ;;
  688. esac
  689. "$@"
  690. !
  691. chmod +x bin/silent
  692. fi
  693. ;;
  694. esac
  695. trap 'exit 2' 1 2
  696. #
  697. # check if we can use nmake from the start
  698. # if so then limit proto to notices only
  699. #
  700. ACCEPT=nmake
  701. _make_=
  702. for p in $_path_
  703. 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
  704. then l=`echo $p | sed 's,[^/]*\$,lib,'`
  705. _make_="$p/nmake MAKEPP=$l/cpp MAKERULES=$l/make/makerules"
  706. ACCEPT=
  707. _proto_default_=d$_proto_default_
  708. break
  709. fi
  710. done
  711. _proto_default_=$_proto_default_$_proto_opt_
  712. #
  713. # some context for nohup.out
  714. #
  715. if test -f nohup.out
  716. then _nohup_="==============================================================================="
  717. echo "$_nohup_"
  718. id="`(uname -a) 2>/dev/null`"
  719. case $id in
  720. ?*) echo "system $id" ;;
  721. esac
  722. echo "installroot $INSTALLROOT"
  723. case $SHIPSPOOL in
  724. *"*"*) ;;
  725. *) echo "shipspool $SHIPSPOOL" ;;
  726. esac
  727. case $INSTALLER in
  728. $RECIPIENT) echo "by $FROMSYS!$INSTALLER" ;;
  729. *) echo "by $FROMSYS!$INSTALLER for $RECIPIENT" ;;
  730. esac
  731. echo "archive $AR_PATH $AR_DELTA"
  732. case $_make_ in
  733. ?*) x=$_make_ ;;
  734. *) x=mamexec ;;
  735. esac
  736. echo "build $x"
  737. echo "cc $CC $CCFLAGS"
  738. case $CCS in
  739. ?*) echo "preroot $CCS" ;;
  740. esac
  741. echo "start `date`"
  742. echo "$_nohup_"
  743. else _nohup_=
  744. fi
  745. #
  746. # finish up initialization
  747. #
  748. case $_trace_ in
  749. ?*) $_trace_ cd $SHIP ;;
  750. esac
  751. cd $SHIP
  752. #
  753. # uncrate the archives into the source tree
  754. #
  755. COMPONENTS_SELECT=" "
  756. for NAME in *
  757. do case $_exclude_ in
  758. *" $NAME "*) continue ;;
  759. esac
  760. if test -f $NAME/items
  761. then # don't rebuild items under local control
  762. echo "$_command_: warning: $NAME: delete ship/$NAME/items to build" >&2
  763. continue
  764. fi
  765. case $cclasstype in
  766. '!'|'^')
  767. case $NAME in
  768. *[${cclasstype}a-zA-Z_0-9]*)
  769. continue ;;
  770. esac
  771. ;;
  772. '') case "`echo $NAME | grep '[^a-zA-Z_0-9]'`" in
  773. ?*) continue ;;
  774. esac
  775. ;;
  776. esac
  777. if test -d $NAME
  778. then _release_=
  779. _state_=found
  780. case $NAME in
  781. *_*) eval `echo $NAME | sed 's/\([^_]*\)_\(.*\)/_system_=\1 _tool_=\2/'`
  782. _root_=$INSTALLROOT/$_system_
  783. if test ! -d $_root_
  784. then $_trace_ mkdir $_root_
  785. fi
  786. for d in $hierarchy
  787. do case $d in
  788. ship/*) ;;
  789. *) if test ! -d $_root_/$d
  790. then $_trace_ mkdir $_root_/$d
  791. fi
  792. ;;
  793. esac
  794. done
  795. ;;
  796. *) _root_=$INSTALLROOT
  797. _tool_=$NAME
  798. ;;
  799. esac
  800. case $_tool_ in
  801. lib*) _type_=lib ;;
  802. *) _type_=cmd ;;
  803. esac
  804. _source_=$_root_/src/$_type_/$_tool_
  805. if test ! -d $_source_
  806. then $_trace_ mkdir $_source_
  807. fi
  808. cd $NAME
  809. base= # newest base
  810. delta= # newest delta for newest base [not in dlist]
  811. dlist= # list of deltas for newest base [no delta]
  812. need= # pax needed to uncrate
  813. new= # delta shipments requiring new base
  814. old= # first base for new chain
  815. remove= # old shipments to be removed
  816. type= # base|delete|delta|patch
  817. for d in $SHIPMENT
  818. do case $d in
  819. "$SHIPMENT") continue ;;
  820. esac
  821. if test -f $d/base -o -f $d/delete
  822. then remove="$remove $base $dlist $delta $need $new"
  823. base=$d
  824. delta=
  825. need=
  826. new=
  827. if test -f $d/delete
  828. then type=delete
  829. else type=base
  830. fi
  831. else if test "" != "$base" -a -f $d/$base && egrep 'DELTA!!!|!PAX!D!' $d/$base >/dev/null
  832. then case $AR_DELTA in
  833. "") need="$need $d"
  834. continue
  835. ;;
  836. esac
  837. type=delta
  838. else type=patch
  839. fi
  840. case $base in
  841. "") dlist="$dlist $d"
  842. ;;
  843. *) if test -f $d/$base
  844. then dlist="$dlist $delta"
  845. delta=$d
  846. elif test "" != "$delta" -a -f $d/$delta
  847. then dlist="$dlist $base"
  848. case $new in
  849. "") old=$base ;;
  850. esac
  851. new="$new $delta"
  852. base=$delta
  853. delta=$d
  854. else dlist="$dlist $d"
  855. fi
  856. ;;
  857. esac
  858. fi
  859. done
  860. case $type in
  861. delete) case $NAME in
  862. lib*) i=lib ;;
  863. *) i=cmd ;;
  864. esac
  865. cd $SHIP
  866. $_trace_ rm -rf $SHIP/$NAME $INSTALLROOT/src/$i/$NAME
  867. continue
  868. ;;
  869. esac
  870. for i in $new
  871. do echo generate $NAME $i base from $old >&2
  872. case $_trace_ in
  873. "") echo "generate $NAME $i base from $old [`date`]" >> $SHIP/$NAME/$LOG
  874. case $type in
  875. delta) $AR_DELTA -rf $i/$old -z $old/base -wf $i/base
  876. _code_=$?
  877. ;;
  878. patch) mkdir /tmp/ship.$$
  879. cd /tmp/ship.$$
  880. $AR_READ < $SHIP/$NAME/$old/base &&
  881. $AR_READ < $SHIP/$NAME/$i/$old &&
  882. {
  883. $AR_LIST < $SHIP/$NAME/$old/base
  884. $AR_LIST < $SHIP/$NAME/$i/$old
  885. } | sort -u | $AR_WRITE > $SHIP/$NAME/$i/base
  886. _code_=$?
  887. cd $SHIP/$NAME
  888. rm -rf /tmp/ship.$$
  889. ;;
  890. esac
  891. case $_code_ in
  892. 0) touch $i/GENERATED
  893. ;;
  894. *) echo "cannot generate $i base from $old" >&2
  895. echo "cannot generate $i base from $old" >> $SHIP/$NAME/$LOG
  896. break
  897. ;;
  898. esac
  899. ;;
  900. *) $_trace_ $AR_DELTA -rf $SHIP/$NAME/$i/$old -z $SHIP/$NAME/$old/base -wf $i/base
  901. $_trace_ touch $SHIP/$NAME/$i/GENERATED
  902. ;;
  903. esac
  904. old=$i
  905. done
  906. case $base in
  907. "") echo "$_command_: warning: $NAME: no base archive" >&2
  908. cd $SHIP
  909. continue
  910. ;;
  911. esac
  912. case $_preserve_ in
  913. ?*) case `echo $remove $dlist` in
  914. ?*) case $_trace_ in
  915. "") rm -rf $remove $dlist 2>/dev/null ;;
  916. *) $_trace_ "(cd $NAME; rm -rf" $remove $dlist")" ;;
  917. esac
  918. ;;
  919. esac
  920. ;;
  921. esac
  922. $_trace_ cd $_source_
  923. case $delta in
  924. "") _release_=$base ;;
  925. *) _release_=$delta ;;
  926. esac
  927. if test 11 = "$_force_$_uncrate_" -o ! -f $SHIP/$NAME/$_release_/UNCRATED
  928. then echo uncrate $NAME $_release_ $type >&2
  929. case $_trace_ in
  930. "") echo "uncrate $NAME $_release_ $type [`date`]" >> $SHIP/$NAME/$LOG ;;
  931. esac
  932. error=
  933. if test -f $SHIP/$NAME/$_release_/delete
  934. then cd $SHIP
  935. rm -rf $NAME
  936. continue
  937. fi
  938. if test ! -f $SHIP/$NAME/$_release_/items
  939. then echo "$_command_: warning: $NAME: no items file" >&2
  940. fi
  941. _proto_options_="-${_proto_default_}c`cat $SHIP/$NAME/$_release_/copyright 2>/dev/null`"
  942. if test "" = "$AAR_LIST" -o "delta" = "$type" || $OAR_LIST < $SHIP/$NAME/$base/base >/dev/null 2>&1
  943. then AR_PATH=$OAR_PATH
  944. AR_LIST=$OAR_LIST
  945. AR_READ=$OAR_READ
  946. AR_WRITE=$OAR_WRITE
  947. else AR_PATH=$AAR_PATH
  948. AR_LIST=$AAR_LIST
  949. AR_READ=$AAR_READ
  950. AR_WRITE=$AAR_WRITE
  951. fi
  952. for i in base $base
  953. do case $type in
  954. base|patch)
  955. case $type in
  956. base) if test ! -f $SHIP/$NAME/$_release_/GENERATED
  957. then case $_trace_ in
  958. "") rm -rf * ;;
  959. *) $_trace_ "(cd $_source_; rm -rf *)" ;;
  960. esac
  961. fi
  962. ;;
  963. esac
  964. _base_=$i
  965. case $_base_ in
  966. base) _release_=$base ;;
  967. *) _release_=$delta ;;
  968. esac
  969. case $_trace_ in
  970. "") if $AR_READ < $SHIP/$NAME/$_release_/$_base_
  971. then case $_shipproto_ in
  972. ?*) $AR_LIST <$SHIP/$NAME/$_release_/$_base_ 2>/dev/null | grep '\.[chlyY]$' | $_shipproto_ -l - "${_proto_options_}"
  973. ;;
  974. esac
  975. if test -d features && test ! -d feature
  976. then ln -s features feature 2>/dev/null
  977. elif test -d feature && test ! -d features
  978. then ln -s feature features 2>/dev/null
  979. fi
  980. else error="$AR_PATH $type read failed"
  981. fi
  982. ;;
  983. *) $_trace_ "$AR_READ < $SHIP/$NAME/$_release_/$_base_"
  984. case $_shipproto_ in
  985. ?*) $_trace_ "$AR_LIST <$SHIP/$NAME/$_release_/$_base_ 2>/dev/null | grep '\.[chlyY]\$' | $_shipproto_ -l - ${_proto_options_}" ;;
  986. esac
  987. ;;
  988. esac
  989. case $type in
  990. base) break ;;
  991. esac
  992. ;;
  993. delta) if $_trace_ $AR_DELTA -rf $SHIP/$NAME/$_release_/$base -z $SHIP/$NAME/$base/base
  994. then $_trace_ touch $SHIP/$NAME/$base/UNCRATED
  995. case $_shipproto_ in
  996. ?*) case $_trace_ in
  997. "") ($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_}" ;;
  998. *) $_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_}" ;;
  999. esac
  1000. ;;
  1001. esac
  1002. case $_trace_ in
  1003. "") if test -d features && test ! -d feature
  1004. then ln -s features feature 2>/dev/null
  1005. elif test -d feature && test ! -d features
  1006. then ln -s feature features 2>/dev/null
  1007. fi
  1008. ;;
  1009. esac
  1010. else error="$AR_DELTA $type read failed"
  1011. fi
  1012. break
  1013. ;;
  1014. esac
  1015. done
  1016. case $error in
  1017. "") $_trace_ touch $SHIP/$NAME/$_release_/UNCRATED ;;
  1018. *) echo "$_command_: $NAME: $_release_: uncrate error: $error" >&2
  1019. case $_trace_ in
  1020. "") echo "uncrate $NAME $_release_ $type error: $error" >> $SHIP/$NAME/$LOG ;;
  1021. esac
  1022. _state_=error
  1023. ;;
  1024. esac
  1025. fi
  1026. cd $SHIP
  1027. eval STATE_$NAME=$_state_
  1028. case $_state_ in
  1029. error) ;;
  1030. *) case $need in
  1031. ?*) for i in $need
  1032. do NEED_pax="$NEED_pax $NAME/$i"
  1033. done
  1034. ;;
  1035. *) eval RELEASE_$NAME=$_release_ SOURCE_$NAME=$_source_ TOOL_$NAME=$_tool_
  1036. COMPONENTS_SELECT="$COMPONENTS_SELECT$NAME "
  1037. ;;
  1038. esac
  1039. ;;
  1040. esac
  1041. fi
  1042. done
  1043. case $COMPONENTS_SELECT in
  1044. " ") exit 0 ;;
  1045. esac
  1046. case $_uncrate_ in
  1047. ?*) case $NEED_pax in
  1048. ?*) case $STATE_pax in
  1049. found) ;;
  1050. *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;
  1051. esac
  1052. ;;
  1053. esac
  1054. exit 0
  1055. ;;
  1056. esac
  1057. #
  1058. # determine the ordered list of components to (re)build
  1059. #
  1060. case $SELECT in
  1061. " ") COMPONENTS="$ORDER $COMPONENTS_SELECT" ;;
  1062. *) COMPONENTS=
  1063. for NAME in $COMPONENTS_SELECT
  1064. do case $SELECT in
  1065. *" $NAME "*) COMPONENTS="$COMPONENTS $NAME" ;;
  1066. esac
  1067. done
  1068. ;;
  1069. esac
  1070. #
  1071. # get the component closure
  1072. #
  1073. case $_closure_ in
  1074. "") ORDER=$COMPONENTS
  1075. ;;
  1076. *) ORDER=
  1077. for NAME in $COMPONENTS
  1078. do old=
  1079. new=$NAME
  1080. while :
  1081. do case $new in
  1082. $old) break ;;
  1083. esac
  1084. dup=
  1085. for _item_ in $new
  1086. do # we assume ITEMS_* not in environment
  1087. eval _items_='"$'ITEMS_$_item_'"'
  1088. case $_items_ in
  1089. "") eval _release_='$'RELEASE_$_item_
  1090. _items_=`cat $_item_/$_release_/items 2>/dev/null`" $_item_"
  1091. eval ITEMS_$_item_='"$'_items_'"'
  1092. ;;
  1093. esac
  1094. dup="$dup $_items_"
  1095. done
  1096. old=$new
  1097. new=
  1098. for _item_ in $dup
  1099. do eval SEEN_$_item_=
  1100. done
  1101. for _item_ in $dup
  1102. do eval seen='$'SEEN_$_item_
  1103. case $seen in
  1104. "") eval SEEN_$_item_=1
  1105. new="$new $_item_"
  1106. ;;
  1107. esac
  1108. done
  1109. done
  1110. eval ITEMS_$NAME='"'$new'"'
  1111. ORDER="$ORDER $new"
  1112. done
  1113. dup=$ORDER
  1114. ORDER=
  1115. for NAME in $dup
  1116. do eval SEEN_$NAME=
  1117. done
  1118. for NAME in $dup
  1119. do eval seen='$'SEEN_$NAME
  1120. case $seen in
  1121. "") eval SEEN_$NAME=1
  1122. ORDER="$ORDER $NAME"
  1123. ;;
  1124. esac
  1125. done
  1126. ;;
  1127. esac
  1128. _built_=
  1129. COMPONENTS=
  1130. for NAME in $ORDER
  1131. do case $_exclude_ in
  1132. *" $NAME "*) continue ;;
  1133. esac
  1134. eval _release_='$'RELEASE_$NAME
  1135. test -f $NAME/$_release_/items || continue
  1136. case $_force_ in
  1137. "") _built_=$NAME/$_release_/BUILT
  1138. eval _items_='$'ITEMS_$NAME
  1139. for i in $_items_
  1140. do case " $COMPONENTS " in
  1141. *" $i "*) _built_=; break ;;
  1142. esac
  1143. case $i in
  1144. $NAME) ;;
  1145. *) eval _built_='"'$_built_ $i/'$'RELEASE_$i/BUILT'"' ;;
  1146. esac
  1147. done
  1148. case $_built_ in
  1149. ?*) if $_shipop_ newer $_built_
  1150. then continue
  1151. fi
  1152. ;;
  1153. esac
  1154. ;;
  1155. esac
  1156. $_trace_ rm -f $NAME/$_release_/BUILT
  1157. if test "" != "$_force_" -o "" != "$_ignore_" -o ! -f $NAME/$_release_/ERROR
  1158. then COMPONENTS="$COMPONENTS $NAME"
  1159. $_trace_ rm -f $NAME/$_release_/ERROR
  1160. elif test ! -f $NAME/$_release_/BYPASS
  1161. then echo "$_command_: $NAME/$_release_: new shipment required" >&2
  1162. fi
  1163. done
  1164. #
  1165. # tame the environment
  1166. #
  1167. case $_make_ in
  1168. ?*) STATE_nmake=installed ;;
  1169. esac
  1170. case $_make_ in
  1171. ""|$BIN/nmake)
  1172. MAKEPP=$INSTALLROOT/lib/cpp
  1173. MAKERULES=$INSTALLROOT/lib/make/makerules
  1174. export MAKEPP MAKERULES
  1175. _make_=$BIN/nmake
  1176. ;;
  1177. esac
  1178. COSHELL_OPTIONS=nodevfd
  1179. ENV=
  1180. MAKE_OPTIONS="clobber compare link=lib*.a*"
  1181. MAKEPATH=
  1182. PATH=:$INSTALLROOT/bin:$PATH
  1183. VPATH=
  1184. export COSHELL_OPTIONS ENV MAKE_OPTIONS MAKEPATH PATH VPATH
  1185. case $_AST_FEATURES in
  1186. "") _AST_FEATURES='UNIVERSE - att PATH_RESOLVE - logical'
  1187. export _AST_FEATURES
  1188. ;;
  1189. esac
  1190. #
  1191. # (re)build the components
  1192. #
  1193. cd $INSTALLROOT
  1194. for NAME in $COMPONENTS
  1195. do case $_exclude_ in
  1196. *" $NAME "*) continue ;;
  1197. esac
  1198. eval _items_='$'ITEMS_$NAME
  1199. case $_trace_ in
  1200. "") for i in $_items_
  1201. do case $i in
  1202. $NAME) ;;
  1203. *) eval r='$'RELEASE_$i
  1204. if test ! -f $SHIP/$i/$r/BUILT
  1205. then if test -f $SHIP/$i/$r/ERROR
  1206. then m="had build errors"
  1207. elif test -f $SHIP/$i/$r/UNCRATED
  1208. then m="was not built"
  1209. else m="was not shipped"
  1210. fi
  1211. m="$NAME requires $i but $i $m"
  1212. echo "$m" >&2
  1213. echo "$m" >> $SHIP/$NAME/$LOG
  1214. continue 2
  1215. fi
  1216. ;;
  1217. esac
  1218. done
  1219. ;;
  1220. esac
  1221. eval _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME _tool_='$'TOOL_$NAME
  1222. case $_total_ in
  1223. ?*) _components_="$_components_ $NAME/$_release_"
  1224. continue
  1225. ;;
  1226. esac
  1227. echo build $NAME $_release_ >&2
  1228. $_trace_ cd $_source_
  1229. case $_trace_ in
  1230. "") start="`date`"
  1231. if test -f $_bypass_
  1232. then touch $SHIP/$NAME/$_release_/BYPASS
  1233. else case $STATE_nmake in
  1234. installed|ok)
  1235. case $NAME in
  1236. nmake) $_make_ -o "ignorelock mismatch" ${1+"$@"}
  1237. MAKEPP=$INSTALLROOT/lib/cpp ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
  1238. MAKEPP=$INSTALLROOT/lib/cpp MAKERULES=./Makerules.mo ./nmake -o "ignorelock mismatch" install ${1+"$@"}
  1239. ;;
  1240. *) $_make_ -o "ignorelock mismatch" install ${1+"$@"}
  1241. ;;
  1242. esac
  1243. error=$?
  1244. ;;
  1245. *) if test -f Mamfile
  1246. then # here it is -- make+state in v7 shell
  1247. case $_read_ in
  1248. "") case `(echo ok | (read -r a; echo $a) 2>/dev/null)` in
  1249. ok) _read_='read -r' ;;
  1250. *) _read_=read ;;
  1251. esac
  1252. eval `(
  1253. mkdir /tmp/mam$$
  1254. cd /tmp/mam$$
  1255. echo 'main(){return 0;}' > main.c
  1256. if $CC -c main.c >/dev/null 2>&1
  1257. then if $CC -L. main.o -lc >/dev/null 2>&1
  1258. then $CC -L. main.o -lc > libc.a >/dev/null 2>&1 || echo "mam_cc_L=' '"
  1259. fi
  1260. fi
  1261. echo "int f(){return(0);} main(){return(f());}" > pic.c
  1262. if $CC -c pic.c >/dev/null 2>e
  1263. then e=\`wc -l e\`
  1264. s=\`wc pic.o\`
  1265. set x -Kpic -fpic -pic +z '-G 0'
  1266. while :
  1267. do shift
  1268. case $# in
  1269. 0) break ;;
  1270. esac
  1271. rm -f pic.o pic.exe
  1272. $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
  1273. case \`wc -l e\` in
  1274. $e) ;;
  1275. *) continue ;;
  1276. esac
  1277. case $1 in
  1278. ???*) os=\`wc pic.o\`
  1279. case $os in
  1280. $s) continue ;;
  1281. esac
  1282. m=\`echo " $1" | sed -e 's/^ [-+]//g' -e 's/./-& /g' -e 's/[-+] //g'\`
  1283. rm -f pic.o pic.exe
  1284. 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
  1285. then case \`wc -l e\` in
  1286. $e) continue
  1287. ;;
  1288. *) case \`wc pic.o\` in
  1289. $s|$os) continue ;;
  1290. esac
  1291. ;;
  1292. esac
  1293. fi
  1294. echo "mam_cc_PIC='$1'"
  1295. break
  1296. ;;
  1297. *) case \`wc pic.o\` in
  1298. $s) ;;
  1299. *) echo "mam_cc_PIC='$1'"
  1300. break
  1301. ;;
  1302. esac
  1303. ;;
  1304. esac
  1305. done
  1306. fi
  1307. cd /
  1308. rm -rf /tmp/mam$$
  1309. )`
  1310. ;;
  1311. esac
  1312. case $_redirect_ in
  1313. "") case `(a=old; eval a=new </dev/null; echo $a) 2>/dev/null` in
  1314. new) _redirect_=new ;;
  1315. *) _redirect_=old ;;
  1316. esac
  1317. ;;
  1318. esac
  1319. (
  1320. _code_=1
  1321. _list_=
  1322. _main_=0
  1323. _mam_=MAM
  1324. _targ_=install
  1325. trap "
  1326. mv $_mam_.list.tmp $_mam_.list
  1327. rm -f $_mam_.*.tmp
  1328. $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.time
  1329. trap 0 1 2
  1330. exit \$_code_
  1331. " 0 1 2
  1332. # some shells die with diff,next,same in vars
  1333. : > $_mam_.diff.tmp
  1334. exec 9> $_mam_.list.tmp
  1335. if test -f $_mam_.list -a -f $_mam_.time
  1336. then $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.sort.tmp
  1337. comm -12 $_mam_.time $_mam_.sort.tmp | sed 's/ .*//' > $_mam_.same.tmp
  1338. rm -f $_mam_.sort.tmp
  1339. else : > $_mam_.same.tmp
  1340. fi
  1341. _index_=_
  1342. _ifs_=$IFS
  1343. case $_read_ in
  1344. "read") # read strips \ -- thanks a lot
  1345. # tmp file avoids char at a time read
  1346. sed 's/\\/\\\\/g' Mamfile > $_mam_.read.tmp
  1347. exec < $_mam_.read.tmp
  1348. ;;
  1349. *) exec < Mamfile
  1350. ;;
  1351. esac
  1352. eval `sed -e '1,/^make /d' -e '/^setv /!d' -e 's/^setv \([^ ]*\).*/\1= /' Mamfile`
  1353. for _data_
  1354. do eval `echo $_data_ | sed -e 's/\"/\\\\"/g' -e 's/=/=\\"/' -e 's/\$/\\"/'`
  1355. done
  1356. _old_=1
  1357. while IFS=' '; $_read_ _op_ _arg_ _val_
  1358. do IFS=$_ifs_
  1359. case $_op_ in
  1360. "note") continue
  1361. ;;
  1362. "info") case $_arg_ in
  1363. "mam") _old_= ;;
  1364. esac
  1365. continue
  1366. ;;
  1367. "setv") eval _data_='$'$_arg_
  1368. case $_index_:$_data_ in
  1369. __*:*|*:)
  1370. case $_redirect_ in
  1371. new) eval $_arg_="$_val_" </dev/null
  1372. ;;
  1373. old) exec 8<&0 0</dev/null
  1374. eval $_arg_="$_val_"
  1375. exec 0<&8 8<&-
  1376. ;;
  1377. esac
  1378. ;;
  1379. esac
  1380. continue
  1381. ;;
  1382. "make") eval _name_$_index_=$_name_
  1383. eval _prev_$_index_=$_prev_
  1384. eval _cmds_$_index_='"$_cmds_"'
  1385. eval _attr_$_index_=$_attr_
  1386. eval _name_=$_arg_
  1387. _prev_=$_index_
  1388. _cmds_=
  1389. _attr_=u
  1390. case $_main_ in
  1391. 0) case $_name_ in
  1392. $_targ_)_main_=1 ;;
  1393. *) _attr_= ;;
  1394. esac
  1395. ;;
  1396. 1) case $_force_ in
  1397. "") grep "^$_name_\$" $_mam_.same.tmp >/dev/null && _attr_= ;;
  1398. esac
  1399. ;;
  1400. *) _attr_=
  1401. ;;
  1402. esac
  1403. case " $_val_ " in
  1404. *" metarule "*) _attr_=M$_attr_ ;;
  1405. esac
  1406. case $_attr_ in
  1407. *u*) echo $_name_ >> $_mam_.diff.tmp ;;
  1408. esac
  1409. _index_=_$_index_
  1410. eval _name_$_index_=$_name_
  1411. eval _prev_$_index_=$_prev_
  1412. eval _cmds_$_index_=$_cmds_
  1413. eval _attr_$_index_=$_attr_
  1414. echo $_name_ >&9
  1415. continue
  1416. ;;
  1417. "prev") case $_attr_ in
  1418. *u*) ;;
  1419. *) case $_force_ in
  1420. "") eval _arg_=$_arg_
  1421. if grep "^$_arg_\$" $_mam_.diff.tmp >/dev/null
  1422. then _attr_=u$_attr_
  1423. elif grep "^$_arg_\$" $_mam_.same.tmp >/dev/null
  1424. then :
  1425. else _attr_=u$_attr_
  1426. fi
  1427. ;;
  1428. *) _attr_=u$_attr_
  1429. ;;
  1430. esac
  1431. ;;
  1432. esac
  1433. continue
  1434. ;;
  1435. esac
  1436. case $_index_ in
  1437. _) echo $_op_: missing make op >&2; continue ;;
  1438. esac
  1439. case $_op_ in
  1440. "attr") case $_arg_ in
  1441. "meta"|"suff") _attr_=M ;;
  1442. esac
  1443. ;;
  1444. "exec"|"....")
  1445. case $_old_ in
  1446. "") _arg_=$_val_
  1447. ;;
  1448. *) case $_val_ in
  1449. ?*) _arg_="$_arg_ $_val_" ;;
  1450. esac
  1451. ;;
  1452. esac
  1453. case $_cmds_ in
  1454. "") _cmds_=$_arg_
  1455. ;;
  1456. *) _cmds_="$_cmds_
  1457. $_arg_"
  1458. ;;
  1459. esac
  1460. ;;
  1461. "done") eval _arg_=$_arg_
  1462. _prop_=
  1463. case $_arg_ in
  1464. $_targ_) _main_=2 ;;
  1465. esac
  1466. case $_arg_ in
  1467. $_name_)case $_attr_ in
  1468. *M*) ;;
  1469. *u*) case $_cmds_ in
  1470. "") case $_attr_ in
  1471. *u*) _prop_=u ;;
  1472. esac
  1473. ;;
  1474. *) eval "($_set_$_cmds_) </dev/null" ||
  1475. {
  1476. _status_=$?
  1477. case $_set_ in
  1478. *-*e*) ;;
  1479. *) case $_cmds_ in
  1480. *if*then*fi*|"||") _status_=0 ;;
  1481. esac
  1482. ;;
  1483. esac
  1484. case $_status_ in
  1485. 0) ;;
  1486. *) echo "*** exit code $_status_ making $_name_" >&2
  1487. _code_=$_status_
  1488. exit $_code_
  1489. ;;
  1490. esac
  1491. }
  1492. _prop_=u
  1493. echo $_name_ >> $_mam_.diff.tmp
  1494. ;;
  1495. esac
  1496. ;;
  1497. esac
  1498. _index_=$_prev_
  1499. eval _name_='$'_name_$_index_
  1500. eval _prev_='$'_prev_$_index_
  1501. eval _cmds_='$'_cmds_$_index_
  1502. eval _attr_='$'_attr_$_index_
  1503. case $_attr_ in
  1504. *u*) ;;
  1505. *) _attr_=$_prop_$_attr_ ;;
  1506. esac
  1507. ;;
  1508. *) echo $_arg_: $_op_ $_name_ expected >&2
  1509. ;;
  1510. esac
  1511. ;;
  1512. esac
  1513. done
  1514. exec 9>&-
  1515. case $_main_ in
  1516. 2) _code_=0 ;;
  1517. *) echo "*** don't know how to make $_targ_" >&2 ;;
  1518. esac
  1519. exit $_code_
  1520. ); error=$?
  1521. # ... indent
  1522. elif test -f makefile
  1523. then make -f makefile install ${1+"$@"}; error=$?
  1524. elif test -f Makescript
  1525. then ./Makescript ${1+"$@"}; error=$?
  1526. elif test -f $_tool_.bs
  1527. then ./$_tool_.bs ${1+"$@"}; error=$?
  1528. else echo "$_command_: cannot build $NAME" >&2; error=1
  1529. fi
  1530. ;;
  1531. esac
  1532. case $error+$NAME in
  1533. 0+nmake) $BIN/nmake -n -f /dev/null debug </dev/null >/dev/null 2>&1 || error=1 ;;
  1534. esac
  1535. case $error in
  1536. 0) touch $SHIP/$NAME/$_release_/BUILT ;;
  1537. *) touch $SHIP/$NAME/$_release_/ERROR ;;
  1538. esac
  1539. fi 2>&1 | (PATH=$OPATH; tee $SHIP/$NAME/$TMP 1>&2)
  1540. if test -f $SHIP/$NAME/$_release_/BUILT
  1541. then state=ok
  1542. elif test -f $SHIP/$NAME/$_release_/BYPASS
  1543. then state=bypass
  1544. else state=error
  1545. fi
  1546. {
  1547. echo "build $NAME $_release_ $state [$start] [`date`]"
  1548. case $CCS in
  1549. ?*) echo preroot CCS = $CCS ;;
  1550. esac
  1551. # some egreps blow this
  1552. sed \
  1553. -e '/^$/d' \
  1554. -e '/^[ ]/d' \
  1555. -e '/^+ /d' \
  1556. -e '/^[^ ]*:$/d' \
  1557. -e '/^[a-z] - /d' \
  1558. -e '/^[a-zA-Z_][a-zA-Z_0-9]*$/d' \
  1559. -e '/^[a-zA-Z_][a-zA-Z_0-9]*=/d' \
  1560. -e '/[Cc]opyright/d' \
  1561. -e '/: warning: assignment .* == was expected/d' \
  1562. -e '/: warning: if .* no effect/d' \
  1563. -e '/: warning: Symbol .* multiply defined/d' \
  1564. $SHIP/$NAME/$TMP
  1565. rm -f $SHIP/$NAME/$TMP
  1566. } >> $SHIP/$NAME/$LOG 2> /dev/null
  1567. eval STATE_$NAME=$state
  1568. ;;
  1569. *) if test -f $_source_/$_bypass_
  1570. then $_trace_ "refer to $_source_/$_bypass_ to install $NAME"
  1571. else case $STATE_nmake in
  1572. installed|ok)
  1573. case $NAME in
  1574. nmake) $_trace_ $_make_ -o "ignorelock mismatch" ${1+"$@"}
  1575. $_trace_ ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
  1576. $_trace_ ./nmake -o "ignorelock mismatch" install ${1+"$@"}
  1577. ;;
  1578. *) $_trace_ $_make_ -o "ignorelock mismatch" install ${1+"$@"}
  1579. ;;
  1580. esac
  1581. ;;
  1582. *) if test -f $_source_/Mamfile
  1583. then $_trace_ "mamexec < Mamfile"
  1584. elif test -f $_source_/Makescript
  1585. then $_trace_ ./Makescript ${1+"$@"}
  1586. elif test -f $_source_/$_tool_.bs
  1587. then $_trace_ ./$_tool_.bs ${1+"$@"}
  1588. else $_trace_ install $NAME
  1589. fi
  1590. ;;
  1591. esac
  1592. fi
  1593. ;;
  1594. esac
  1595. $_trace_ cd $INSTALLROOT
  1596. #
  1597. # accept stuff built before nmake to sync the state files
  1598. #
  1599. case $NAME in
  1600. $ACCEPT)
  1601. for NAME in $COMPONENTS
  1602. do eval state='$'STATE_$NAME _source_='$'SOURCE_$NAME
  1603. case $state in
  1604. ok) case $_trace_ in
  1605. "") cd $_source_
  1606. {
  1607. $BIN/nmake -o "accept ignorelock mismatch touch" install force_shared=1
  1608. case $NAME in
  1609. lib*) $BIN/nmake -o "accept" install ;;
  1610. esac
  1611. } 2>&1 | (PATH=$OPATH; tee $SHIP/$NAME/$TMP 1>&2)
  1612. {
  1613. echo "accept $NAME"
  1614. egrep -v '^([^ ]*:$| |\+ |[a-z] - |[a-zA-Z_][a-zA-Z_0-9]*=|$)' $SHIP/$NAME/$TMP
  1615. rm -f $SHIP/$NAME/$TMP
  1616. } 2>&1 >> $SHIP/$NAME/$LOG
  1617. cd $INSTALLROOT
  1618. ;;
  1619. *) $_trace_ cd $_source_
  1620. $_trace_ $BIN/nmake -o "accept ignorelock mismatch touch" install force_shared=1
  1621. case $NAME in
  1622. lib*) $_trace_ $BIN/nmake -o "accept" install ;;
  1623. esac
  1624. $_trace_ cd $INSTALLROOT
  1625. ;;
  1626. esac
  1627. ;;
  1628. esac
  1629. done
  1630. case $NAME in
  1631. $ACCEPT) break ;;
  1632. esac
  1633. ;;
  1634. esac
  1635. done
  1636. case $_total_ in
  1637. ?*) case $RANDOM in
  1638. $RANDOM)cd $SHIP
  1639. ls -Cd $_components_
  1640. ;;
  1641. *) PS3=''
  1642. eval ' select i in $_components_
  1643. do :
  1644. done </dev/null'
  1645. ;;
  1646. esac
  1647. exit 0
  1648. ;;
  1649. esac
  1650. #
  1651. # nohup.out again
  1652. #
  1653. case $_nohup_ in
  1654. ?*) echo "$_nohup_"
  1655. echo "done `date`"
  1656. echo "$_nohup_"
  1657. ;;
  1658. esac
  1659. #
  1660. # check for installation reports
  1661. #
  1662. bypass=
  1663. owners=
  1664. for NAME in $COMPONENTS
  1665. do eval state='$'STATE_$NAME _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME
  1666. case $state in
  1667. bypass) bypass="$bypass
  1668. $_source_/$_bypass_"
  1669. ;;
  1670. esac
  1671. o=$SHIP/$NAME/$_release_/$OWNER
  1672. if test -s $o
  1673. then r=`cat $SHIP/$NAME/$_release_/$REPORT 2>/dev/null`
  1674. case $r in
  1675. *\[no\]*) r= ;;
  1676. esac
  1677. case $r' + '$state in
  1678. ?*' + '*|*' + 'error)
  1679. address=`cat $o`
  1680. owner=`echo $address | sed -e 's/.*\(.............\)/\1/' -e 's/^[^a-zA-Z_]/_/' -e 's/[^a-zA-Z_0-9]/_/g'`
  1681. eval f='$'built_$owner
  1682. eval built_$owner='"$'f $NAME'"'
  1683. report=
  1684. for f in $SHIP/$NAME/$LOG $r
  1685. do case `ls -dt $f $SHIPSLOG/!$owner 2>/dev/null` in
  1686. $f*) report="$report $f" ;;
  1687. esac
  1688. done
  1689. case $report in
  1690. ?*) eval f='$'address_$owner
  1691. case $f in
  1692. "") owners="$owners $owner"
  1693. eval address_$owner=$address
  1694. ;;
  1695. esac
  1696. eval eval report_$owner=\\\"\$report_$owner \\\[$NAME\\\] $report\\\"
  1697. ;;
  1698. esac
  1699. ;;
  1700. esac
  1701. fi
  1702. done
  1703. #
  1704. # check if any components required pax to uncrate
  1705. #
  1706. case $NEED_pax in
  1707. ?*) AR_DELTA=$INSTALLROOT/bin/pax
  1708. ($AR_DELTA -f /dev/null -z /dev/null) >/dev/null 2>&1 || STATE_pax=error
  1709. case $STATE_pax in
  1710. ok) $_trace_ exec $_command_ $_options_ $SELECT ${1+"$@"} ;;
  1711. *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;
  1712. esac
  1713. ;;
  1714. esac
  1715. #
  1716. # done
  1717. #
  1718. exit 0