Path: utzoo!attcan!uunet!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.sources.unix Subject: v16i037: Larry Wall's Configure generator, etc., Part04/07 Message-ID: <1121@fig.bbn.com> Date: 14 Oct 88 19:53:54 GMT Organization: BBN Laboratories Inc., Cambridge MA Lines: 1912 Approved: rsalz@uunet.UU.NET Submitted-by: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) Posting-number: Volume 16, Issue 37 Archive-name: dist2/part04 #! /bin/sh # Make a new directory for the dist sources, cd to it, and run kits 1 # thru 7 through sh. When all 7 kits have been run, read README. echo "This is dist 2.0 kit 4 (of 7). If kit 4 is complete, the line" echo '"'"End of kit 4 (of 7)"'" will echo at the end.' echo "" export PATH || (echo "You didn't use sh, you clunch." ; kill $$) mkdir kit mcon mcon/U pat 2>/dev/null echo Extracting mcon/U/d_news.U sed >mcon/U/d_news.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: d_news.U,v 2.0 88/06/28 23:15:12 lwall Locked $ X?RCS: X?RCS: Revision 1.0 87/05/22 12:30:34 siegel X?RCS: This unit looks to see what window system you are using X?RCS: Initial revision X?RCS: X?MAKE:d_news d_news0 d_newshome d_textcan: contains echo n Myread c X?MAKE: -pick add $@ %* X?INIT:d_newshome="../../NeWS" X?S:d_news: X?S: Set if running NeWS 1.1 X?S:. X?S:d_news0: X?S: Set if running NeWS 1.0 X?S:. X?S:d_newshome: X?S: Path to the top directory of the NeWS structure. X?S:. X?S:d_textcan: X?S: Path to where the textcan.ps stuff is... X?S:. X?C:NEWS1_1: X?C: This symbol defined if running NeWS 1.1. X?C:. X?C:NEWS1_0: X?C: This symbol defined if running NeWS 1.0. X?C:. X?C:TEXTCAN: X?C: Tells path to where the textcan.ps stuff is... X?C:. X?H:?%1:#$d_news NEWS1_1 /**/ X?H:?%1:#$d_news0 NEWS1_0 /**/ X?H:?%1:#define TEXTCAN $d_textcan /**/ X?H:?%1: X: Check to see what version of NeWS is being run? Xcd .. Xecho " " X$echo "Now for the interesting stuff... Lets see what kind of NeWS" X$echo "they grow round here...." Xecho " " X Xdflt='y' X Xans='foobar' X Xif $test -d $d_newshome; then Xd_newshome=`(cd $d_newshome ; /bin/pwd)` X$echo "Ah...found myself a NeWS in $d_newshome..." X$echo $n "Is this the NeWS you want your children to grow up with? [$dflt] $c" Xrp="use $d_newshome? [$dflt] " X. UU/myread Xfi X Xwhile $test $ans = "n" -o ! -d $d_newshome; do X ans='y' X $echo $n "Path to NeWS you want [$d_newshome] $c" X rp="NeWS to use [$d_newshome] " X . UU/myread X d_newshome=$ans X if $test ! -d $d_newshome; then X $echo "No directory with the name of $d_newshome.." X fi X ans='y' Xdone X Xecho " " Xif $test ! -d $d_newshome/lib; then X $echo "ARG! No lib directory in $d_newshome!!!" X $rm -f kit*isdone X $rm -rf UU X set -t; $echo " sorry... no NeWS is bad news..." Xfi X Xif $test -r $d_newshome/lib/NeWS/colors.ps ; then X $echo 'Ahh... your running NeWS 1.1! Boy... that makes stuff' X $echo 'easy....' X echo " " X d_news="$define" X d_news0="$undef" X if $test -r $d_newshome/lib/NeWS/textcan.ps; then X d_textcan=$d_newshome/lib/NeWS X $echo "The textcan.ps stuff seems to be in :" X $echo $n " " X $echo $d_textcan X else X d_textcan=$d_newshome/clientsrc/client/nterm X if $test ! -r $d_textcan/textcan.ps; then X d_news="$undef" X d_news0="$define" X $echo 'Hmm... must have been fooled... gotta be NeWS 1.1 beta!' X else X $echo "The textcan.ps stuff seems to be in :" X $echo $n " " X $echo $d_textcan X fi X fi Xelse X $echo 'snif... snif... I smell the dilapidated smell of NeWS 1.0..' X $echo 'Some things will not work under NeWS 1.0...' X echo " " X d_news="$undef" X d_news0="$define" Xfi Xcd UU X !STUFFY!FUNK! echo Extracting pat/mailagent sed >pat/mailagent <<'!STUFFY!FUNK!' -e 's/X//' X#!/usr/bin/perl X X# You'll need to set up a .forward file that feeds your mail to this script. X# Mine looks like this: X# "| /a/lwall/bin/mailagent /a/lwall lwall Larry >>/usr/spool/mail/lwall 2>&1" X# Actually, this doesn't work real good, since I don't lock the mail file. X# Someday I'll fix this. For now, put something like X# lwall, "| /a/lwall/bin/mailagent /a/lwall lwall Larry >>/a/lwall/.bak 2>&1" X X($HOME, $USER, $NAME) = @ARGV; X X$ENV{'PATH'}="$1:/bin:/usr/bin:/usr/ucb"; X$ENV{'IFS'} = '' if $ENV{'IFS'}; X X$hostname = `hostname`; X Xexec '/bin/cat' unless $NAME; Xexec '/bin/cat' unless chdir $HOME; Xexec '/bin/cat' unless $hostname =~ /vax/; X X$HOME=`pwd`; Xchop($HOME); X$ENV{'HOME'} = $HOME; X$ENV{'USER'} = $USER; X$ENV{'NAME'} = $NAME; X Xumask(022); X Xif (open(commands,".commands")) { X while () { X chop; X $command{$_} = 1; X } X close(commands); X} X X$dest = $USER; X$cmd = "set -x\n"; Xline: while () { X $all .= $_; X s/^From ([^ ]*).*$/$1/ && ($dest = $1); X /@RR/ && ($ack = 1); X if (1 .. /^$/) { X if (/^Apparently-To:.*admin/) { $admin = 1; } X if (/^To:.*admin/) { $admin = 1; } X if (/^Cc:.*admin/) { $admin = 1; } X } X if (/^Subject:[ \t]*(.*)/) { $subj = $1; } X if (/^Title:[ \t]*(.*)/) { $subj = $1; } X if (/^Subject:[ ]*[Cc]ommand[ ]*$/ .. 99) { X s/^ @SH/@SH/; X if (/^@SH/) { X s/\\!/!/g; X if (/[=$^&*([{}`\\|;>?]/) { X s/^@SH/bad cmd:/; X $bad .= $_; X next line; X } X s/ PATH/ $dest/; X s/SH mailpath/SH mailpatch/; X s/@SH[ ]*//; X if (/^([^ \t]+)[ \t]/) { X $first = $1; X } X else { X $first = $_; X chop($first); X } X if (!$command{$first}) { X s/^/unk cmd: /; X $bad .= $_; X next line; X } X $cmd .= $_; X } X } X} X Xif ($dest ne $USER) { X X if ($cmd ne "set -x\n") { X open(cmd,">/tmp/mess.cmd$$"); X print cmd $cmd; X close cmd; X $tmp = `sh -x /tmp/mess.cmd$$ 2>&1`; X if ($?) { X open(mailer,"|/bin/mail $dest $USER"); X print mailer X"Subject: the following returned a non-zero status XTo: $dest X X$tmp X Xmailagent speaking for $USER X"; X close mailer; X } X unlink "/tmp/mess.cmd$$"; X } X X if ($ack) { X open(mailer,"|/bin/mail $dest $USER"); X print mailer X"Subject: $subj XTo: $dest X XHere is the receipt you requested. X Xmailagent speaking for $USER X"; X close mailer; X } X X if ($bad) { X open(mailer,"|/bin/mail $dest $USER"); X print mailer X"Subject: the following commands were not executed XTo: $dest X X$bad X XIf $NAME can figure out what you wanted he may do it anyway. X Xmailagent speaking for $USER X"; X close mailer; X } X} X Xif ($admin) { X open(out,">>.junk"); X select(out); X} X Xprint $all,"\n\n"; X !STUFFY!FUNK! echo Extracting mcon/U/registers.U sed >mcon/U/registers.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: registers.U,v 2.0 88/06/28 23:18:11 lwall Locked $ X?RCS: $Log: registers.U,v $ X?RCS: Revision 2.0 88/06/28 23:18:11 lwall X?RCS: Baseline. X?RCS: X?MAKE:registers reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 reg10 reg11 reg12 reg13 reg14 reg15 reg16: Cppsym echo n c Myread Oldconfig X?MAKE: -pick add $@ %* X?S:registers: X?S: This variable contains the number of register declarations paid X?S: attention to by the C compiler. X?S:. X?S:reg1: X?S: This variable, along with reg2, reg3, etc. contains the eventual X?S: value for the symbols Reg1, Reg2, Reg3, etc. It has either the X?S: value "register" or is null. X?S:. X?C:Reg1: X?C: This symbol, along with Reg2, Reg3, etc. is either the word "register" X?C: or null, depending on whether the C compiler pays attention to this X?C: many register declarations. The intent is that you don't have to X?C: order your register declarations in the order of importance, so you X?C: can freely declare register variables in sub-blocks of code and as X?C: function parameters. Do not use Reg more than once per routine. X?C:. X?H:?%1: X?H:?%1:#define Reg1 $reg1 /**/ X?H:?%1:#define Reg2 $reg2 /**/ X?H:?%1:#define Reg3 $reg3 /**/ X?H:?%1:#define Reg4 $reg4 /**/ X?H:?%1:#define Reg5 $reg5 /**/ X?H:?%1:#define Reg6 $reg6 /**/ X?H:?%1:#define Reg7 $reg7 /**/ X?H:?%1:#define Reg8 $reg8 /**/ X?H:?%1:#define Reg9 $reg9 /**/ X?H:?%1:#define Reg10 $reg10 /**/ X?H:?%1:#define Reg11 $reg11 /**/ X?H:?%1:#define Reg12 $reg12 /**/ X?H:?%1:#define Reg13 $reg13 /**/ X?H:?%1:#define Reg14 $reg14 /**/ X?H:?%1:#define Reg15 $reg15 /**/ X?H:?%1:#define Reg16 $reg16 /**/ X?H:?%1: X: see how many register declarations we want to use Xcase "$registers" in X'') X if Cppsym vax; then X dflt=6 X elif Cppsym sun mc68000; then X dflt=10 X elif Cppsym pyr; then X dflt=14 X elif Cppsym ns32000 ns16000; then X dflt=5 X elif Cppsym $smallmach; then X dflt=3 X else X : if you have any other numbers for me, send them in X dflt=6 X fi X ;; X*) dflt=$registers ;; Xesac Xcat <.foo X. .foo Xawk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ X .foo X. .foo Xrm -f .foo X !STUFFY!FUNK! echo Extracting pat/pat.SH sed >pat/pat.SH <<'!STUFFY!FUNK!' -e 's/X//' Xcase $CONFIG in X'') X if test ! -f config.sh; then X ln ../config.sh . || \ X ln ../../config.sh . || \ X ln ../../../config.sh . || \ X (echo "Can't find config.sh."; exit 1) X echo "Using config.sh from above..." X fi X . ./config.sh X ;; Xesac X: This forces SH files to create target in same directory as SH file. X: This is so that make depend always knows where to find SH derivatives. Xcase "$0" in X*/*) cd `expr X$0 : 'X\(.*\)/'` ;; Xesac Xecho "Extracting pat (with variable substitutions)" Xcat >pat <>pat <<'!NO!SUBS!' X Xdie "pat [files]\n" unless $#ARGV >= 0; X Xdo readpackage(); X Xif ($ARGV[0] eq '-n') { X open(FIND, "find . -type f -newer patchlevel.h -print | sort |") || X die "Can't run find.\n"; X open(NEWER,">.newer") || die "Can't create .newer.\n"; X open(MANI,"MANIFEST.new"); X while () { X ($name,$foo) = split; X $mani{$name} = 1; X } X close MANI; X while () { X s|^\./||; X chop; X if (!$mani{$_}) { X next if m|^MANIFEST.new$|; X next if m|^Wanted$|; X next if m|^bugs|; X next if m|^UU/|; X next if m|^RCS/|; X next if m|/RCS/|; X next if m|^config.sh$|; X next if m|/config.sh$|; X next if m|^make.out$|; X next if m|/make.out$|; X next if m|^all$|; X next if m|/all$|; X next if m|^core$|; X next if m|/core$|; X next if m|^foo|; X next if m|/foo|; X next if m|^blurfl|; X next if m|/blurfl|; X next if m|^\.|; X next if m|/\.|; X next if m|\.o$|; X next if m|\.old$|; X next if m|\.orig$|; X next if $mani{$_ . ".SH"}; X next if m|(.*)\.c$| && $mani{$1 . ".y"}; X next if -x $_; X } X print NEWER $_,"\n"; X } X close FIND; X close NEWER; X print "Please remove unwanted files...\n"; X sleep(2); X system '${EDITOR-vi} .newer'; X @ARGV = split(' ',`cat .newer`); X} Xelsif ($ARGV[0] eq '-a') { X open(MANI,"MANIFEST.new") || die "No MANIFEST.new found.\n"; X @ARGV = (); X while () { X chop; X ($_) = split(' '); X push(@ARGV,$_); X } X close MANI; X} X Xunlink ; X Xsystem 'perl', '-S', 'patcil', '-p', @ARGV; Xsystem 'perl', '-S', 'patdiff', @ARGV; Xsystem 'perl', '-S', 'patmake'; X X!NO!SUBS! Xcat ../pl/package.pl >>pat Xchmod +x pat X$eunicefix pat !STUFFY!FUNK! echo Extracting pat/patsend.SH sed >pat/patsend.SH <<'!STUFFY!FUNK!' -e 's/X//' Xcase $CONFIG in X'') X if test ! -f config.sh; then X ln ../config.sh . || \ X ln ../../config.sh . || \ X ln ../../../config.sh . || \ X (echo "Can't find config.sh."; exit 1) X echo "Using config.sh from above..." X fi X . ./config.sh X ;; Xesac X: This forces SH files to create target in same directory as SH file. X: This is so that make depend always knows where to find SH derivatives. Xcase "$0" in X*/*) cd `expr X$0 : 'X\(.*\)/'` ;; Xesac Xecho "Extracting patsend (with variable substitutions)" Xcat >patsend <>patsend <<'!NO!SUBS!' X Xchop($orgname = `cat $orgname`) if $orgname =~ m|^/|; X Xchdir '..' if -f '../.package'; X Xdo readpackage(); X Xwhile ($_ = shift) { X if (/^(patch)?[1-9][\d,-]*$/) { X s/^patch//; X push(@argv,$_); X } X else { X push(@dest,$_); X } X} X$dest = join(' ',@dest); Xdie "patsend dest [patches]\n" unless $dest; X X@ARGV = @argv; X Xopen(PL,"patchlevel.h") || die "Can't open patchlevel.h\n"; Xwhile () { X $maxnum = $1 if /^#define\s+PATCHLEVEL\s+(\d+)/; X} Xclose PL; Xdie "Malformed patchlevel.h file.\n" if $maxnum eq ''; X Xif ($#ARGV < 0) { X $argv = $maxnum; X @ARGV = $argv; X} Xelse { X $argv = do rangeargs(@ARGV); X @ARGV = split(' ',$argv); X} X X$argv =~ s/ $//; X Xif ($#ARGV < 0) { X die "No patches specified.\n"; X} Xelsif ($#ARGV) { X print "Sending $package $baserev patches $argv to $dest...\n"; X} Xelse { X print "Sending $package $baserev patch $argv to $dest...\n"; X} X Xchdir 'bugs' || die "Can't cd to bugs\n"; X Xfork && exit; X Xuntil ($#ARGV < 0) { X $patnum = shift; X open(XHEAD,">.xhead$$") || die "Can't create temp file.\n"; X print XHEAD X"Subject: $package $baserev patch #$patnum XOrganization: $orgname X X[The latest patch for $package version $baserev is #$maxnum.] X X"; X open(PATCH,"patch$patnum") || die "Can't open patch$_\n"; X while () { X print XHEAD; X } X close XHEAD; X system "/bin/mail $dest <.xhead$$"; X} Xunlink ".xhead$$"; X X!NO!SUBS! Xcat ../pl/package.pl >>patsend Xcat ../pl/rangeargs.pl >>patsend Xchmod +x patsend X$eunicefix patsend !STUFFY!FUNK! echo Extracting mcon/U/d_havetlib.U sed >mcon/U/d_havetlib.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: d_havetlib.U,v 2.0 88/06/28 23:14:50 lwall Locked $ X?RCS: $Log: d_havetlib.U,v $ X?RCS: Revision 2.0 88/06/28 23:14:50 lwall X?RCS: Baseline. X?RCS: X?MAKE:d_havetlib termlib: echo contains n c Myread Loc Filexp Oldconfig X?MAKE: -pick add $@ %* X?S:d_havetlib: X?S: This variable conditionally defines the HAVETERMLIB symbol, which X?S: indicates to the C program that termlib-style routines are available. X?S:. X?S:termlib: X?S: This variable contains the argument to pass to the loader to get X?S: termlib-style routines. It is up to the Makefile.SH to make sure X?S: the value gets to the right command. Note that on many systems the X?S: termlib routines are emulated by the curses or terminfo library. X?S:. X?C:HAVETERMLIB: X?C: This symbol, when defined, indicates that termlib-style routines X?C: are available. There is nothing to include. X?C:. X?H:?%1:#$d_havetlib HAVETERMLIB /**/ X?H:?%1: X: where do we get termlib routines from Xecho " " Xans=`loc libcurses.a x $libpth` Xcase "$ans" in X/*) X ar t $ans >grimble X if $contains tputs.o grimble >/dev/null 2>&1; then X termlib='-lcurses' X d_havetlib="$define" X echo "Terminfo library found." X else X ans=x X fi X rm -f grimble X ;; Xesac Xcase "$ans" in Xx) X ans=`loc libtermlib.a x $libpth` X case "$ans" in X /usr/lib*|/lib*) X termlib='-ltermlib' X d_havetlib="$define" X echo "Termlib library found." X ;; X /*) X termlib="$ans" X d_havetlib="$define" X echo "Termlib library found." X ;; X *) X ans=`loc libtermcap.a x $libpth` X case "$ans" in X /usr/lib*|/lib*) X termlib='-ltermcap' X d_havetlib="$define" X echo "Termcap library found." X ;; X /*) X termlib="$ans" X d_havetlib="$define" X echo "Termcap library found." X ;; X *) X case "$termlib" in X '') X dflt=y X rp="Your system appears to NOT have termlib-style routines. Is this true? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X n*|f*) d_havetlib="$define" X echo "Then where are the termlib-style routines kept (specify either -llibname" X $echo $n " or full pathname (~name ok))? $c" X rp='Specify termlib:' X . myread X termlib=`filexp $ans` X ;; X *) d_havetlib="$undef" X termlib='' X echo "You will have to play around with term.c then." X ;; X esac X echo " " X ;; X *) echo "You said termlib was $termlib before." X ;; X esac X ;; X esac X ;; X esac X ;; Xesac X !STUFFY!FUNK! echo Extracting mcon/U/Instruct.U sed >mcon/U/Instruct.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: Instruct.U,v 2.0 88/06/28 23:13:21 lwall Locked $ X?X: X?X: This unit spew out the directions that we want everyone to read. I try to X?X: keep the first "pagefull" much less than a page since they don't know it X?X: isn't going to go shooting off the top of the screen, and we don't want X?X: to panic them yet. X?X: X?RCS: $Log: Instruct.U,v $ X?RCS: Revision 2.0 88/06/28 23:13:21 lwall X?RCS: Baseline. X?RCS: X?MAKE:Instruct: package n c Myread X?MAKE: -pick add $@ %* X: general instructions Xcat <pat/mailpatch <<'!STUFFY!FUNK!' -e 's/X//' X#!/bin/sh X X# You'll have to customize this to know about your own packages. Also, copy X# rangeargs to your private bin directory, or change invocations below. X Xcmd=`date`" $@ " Xcd $HOME X Xdest=$1 Xshift Xsystem=$1 Xshift Xversion=$1 Xshift Xcase "$system" in Xdist) X cd /u/sfoc/lwall/src/dist/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel.h` X curversion='1.0' X ;; Xperl) X cd /usr/local/src/perl/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel.h` X curversion='2.0' X ;; Xrn) X cd /u/sfoc/lwall/src/rn/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel` X curversion='4.3' X ;; Xpatch) X cd /u/sfoc/lwall/src/patch/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel.h` X curversion='2.0' X ;; Xwarp) X cd /u/sfoc/lwall/src/warp/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel.h` X curversion='7.0' X ;; Xcdiff) X cd /u/sfoc/lwall/src/cdiff/bugs X maxnum=`/bin/sed -n -e 's/^[^0-9]*\([1-9][0-9]*\).*$/\1/p' ../patchlevel.h` X curversion='1.1' X ;; X*) X /bin/mail $dest $USER <> $HOME/.patchlog X exit 1 X ;; Xesac X Xcase "$version" in X$curversion) ;; X*) X /bin/mail $dest $USER <> $HOME/.patchlog X exit 1 X ;; Xesac X Xargs="$*" X Xset `$HOME/bin/rangeargs -m "$maxnum" $*` X Xcase $# in X0) set `$HOME/bin/rangeargs -m 100 $args` X set $1 X ;; Xesac X Xfor num do X /bin/cat </tmp/mp$$ XSubject: $system version $version patch #$num X X[The latest patch for $system version $version is #$maxnum.] X Xmailpatch speaking for $USER X XEOM X if test -f patch$num; then X /bin/cat >/tmp/mp$$ X fi X /bin/mail $dest > $HOME/.patchlog !STUFFY!FUNK! echo Extracting kit/makedist.man sed >kit/makedist.man <<'!STUFFY!FUNK!' -e 's/X//' X.rn '' }` X''' $Header: makedist.man,v 2.0 88/06/28 23:12:21 lwall Locked $ X''' X''' $Log: makedist.man,v $ X''' Revision 2.0 88/06/28 23:12:21 lwall X''' Baseline. X''' X''' X.de Sh X.br X.ne 5 X.PP X\fB\\$1\fR X.PP X.. X.de Sp X.if t .sp .5v X.if n .sp X.. X''' X''' Set up \*(-- to give an unbreakable dash; X''' string Tr holds user defined translation string. X''' Bell System Logo is used as a dummy character. X''' X.ie n \{\ X.tr \(*W-\*(Tr X.ds -- \(*W- X.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch X.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch X.ds L" "" X.ds R" "" X.ds L' ' X.ds R' ' X'br\} X.el\{\ X.ds -- \(em\| X.tr \*(Tr X.ds L" `` X.ds R" '' X.ds L' ` X.ds R' ' X'br\} X.TH MAKEDIST 1 LOCAL X.SH NAME Xmakedist - a distribution kit maker X.SH SYNOPSIS X.B makedist X[options] X.SH DESCRIPTION X.I Makedist Xis a rather simpleminded shar program that knows how to pack files Xinto multiple kits of approximately 50000 bytes each. XThe shar scripts produced assume very little about the target machine; Xthere is correspondingly little error checking done compared to other Xshar programs. X.PP XIn order to run makedist you have to do two things: X.IP 1) 4 XCreate a .package file in the package's top-level directory by running packinit. XThis program will ask you about your package and remember what you tell Xit so that all the dist programs can be smart. X.IP 2) 4 XCreate a MANIFEST.new file in your top-level directory that lists all the Xfiles in your package. XThe filename should be the first field on each line. XAfter some whitespace you can add a comment which will end up in MANIFEST. X.PP XThe only option is a \-v, which turns on verbose mode. XAfter running makedist, you will have a set of kits in your top-level directory. XIf your package name is "foo", they will be named foo.kit1, foo.kit2, etc. X.SH AUTHOR XLarry Wall X.SH ENVIRONMENT XNo environment variables are used by X.IR makedist . X.SH FILES XCreates ./$package.kit*. X.SH SEE ALSO Xpat(1) X.br Xmetaconfig(1) X.SH DIAGNOSTICS X.SH BUGS XIt ought to know how to split and recombine files longer than 50000 bytes. X.rn }` '' !STUFFY!FUNK! echo Extracting pat/patbase.SH sed >pat/patbase.SH <<'!STUFFY!FUNK!' -e 's/X//' Xcase $CONFIG in X'') X if test ! -f config.sh; then X ln ../config.sh . || \ X ln ../../config.sh . || \ X ln ../../../config.sh . || \ X (echo "Can't find config.sh."; exit 1) X fi X . ./config.sh X ;; Xesac X: This forces SH files to create target in same directory as SH file. X: This is so that make depend always knows where to find SH derivatives. Xcase "$0" in X*/*) cd `expr X$0 : 'X\(.*\)/'` ;; Xesac Xecho "Extracting patbase (with variable substitutions)" Xcat >patbase <>patbase <<'!NO!SUBS!' X Xdie "pat [files]\n" unless $#ARGV >= 0; X Xdo readpackage(); X X$RCSEXT = ',v' unless $RCSEXT; X Xif ($ARGV[0] eq '-a') { X open(MANI,"MANIFEST.new") || die "No MANIFEST.new found.\n"; X @ARGV = (); X while () { X chop; X ($_) = split(' '); X push(@ARGV,$_); X } X close MANI; X} X Xforeach $file (@ARGV) { X $files = do rcsargs($file); X @files = split(' ',$files); X $revs=0; X $rlog = `rlog -r$baserev -r$revbranch $files 2>&1`; X ($revs) = ($rlog =~ /selected revisions: (\d+)/); X if (!$revs) { X print "patbase: $file has never been checked in--checking in...\n"; X $comment = rcscomment($file); X system 'rcs', '-i', "-c$comment", @files if $comment; X (system 'ci', "-l$baserev", @files) || X (system 'rcs', "-Nlastpat:$baserev", @files); X } X elsif ($revs == 1) { X print "Last revision for $file is $baserev.\n"; X system 'rcs', "-Nlastpat:$baserev", @files; X } X else { X ($lastrev) = ($rlog =~ /revision $revbranch\.(\d+)/); X print "Last revision for $file is $revbranch.$lastrev.\n"; X system 'rcs', "-Nlastpat:$revbranch.$lastrev", @files; X } X} Xunlink ".rlog$$"; X X!NO!SUBS! Xcat ../pl/package.pl >>patbase Xcat ../pl/rcsargs.pl >>patbase Xcat ../pl/comment.pl >>patbase Xchmod +x patbase X$eunicefix patbase !STUFFY!FUNK! echo Extracting mcon/U/Finish.U sed >mcon/U/Finish.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: Finish.U,v 2.0 88/06/28 23:13:02 lwall Locked $ X?X: X?X: This unit is the very last one in the Configure script. It runs all the X?X: SH files, which among other things produce config.h and (usually) Makefile. X?X: It offers to do a make depend if the Makefile contains that target. X?X: X?RCS: $Log: Finish.U,v $ X?RCS: Revision 2.0 88/06/28 23:13:02 lwall X?RCS: Baseline. X?RCS: X?MAKE:Finish: grep echo n c rm contains Myread Config_sh Config_h expr X?MAKE: -pick add $@ %* XCONFIG=true X Xecho " " Xdflt='' Xfastread='' Xecho "If you didn't make any mistakes, then just type a carriage return here." Xrp="If you need to edit config.sh, do it as a shell escape here:" X$echo $n "$rp $c" X. UU/myread Xcase "$ans" in X'') ;; X*) : in case they cannot read X eval $ans;; Xesac X. ./config.sh X Xecho " " Xecho "Doing variable substitutions on .SH files..." Xset x `awk '{print $1}' /dev/null 2>&1; then X dflt=n X $cat < makedepend.out &" XIt can take a while, so you might not want to run it right now. X XEOM X rp="Run make depend now? [$dflt]" X $echo $n "$rp $c" X . UU/myread X case "$ans" in X y*) make depend X echo "Now you must run a make." X ;; X *) echo "You must run 'make depend' then 'make'." X ;; X esac Xelif test -f Makefile; then X echo " " X echo "Now you must run a make." Xelse X echo "Done." Xfi X X$rm -f kit*isdone X: the following is currently useless Xcd UU && $rm -f $rmlist X: since this removes it all anyway Xcd .. && $rm -rf UU X: end of Configure !STUFFY!FUNK! echo Extracting mcon/U/libc.U sed >mcon/U/libc.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: libc.U,v 2.0 88/06/28 23:16:50 lwall Locked $ X?RCS: $Log: libc.U,v $ X?RCS: Revision 2.0 88/06/28 23:16:50 lwall X?RCS: Baseline. X?RCS: X?MAKE:libc: echo n c Myread Oldconfig Loc X?MAKE: -pick add $@ %* X?S:libc: X?S: This variable contains the location of the C library. X?S:. X: get list of predefined functions in a handy place Xecho " " Xif test -f /lib/libc.a; then X echo "Your C library is in /lib/libc.a. You're normal." X libc=/lib/libc.a Xelse X ans=`loc libc.a blurfl/dyick $libpth` X if test ! -f $ans; then X ans=`loc clib blurfl/dyick $libpth` X fi X if test ! -f $ans; then X ans=`loc libc blurfl/dyick $libpth` X fi X if test -f $ans; then X echo "Your C library is in $ans, of all places." X libc=$ans X else X if test -f "$libc"; then X echo "Your C library is in $libc, like you said before." X else X cat </dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list Xif $contains '^printf$' libc.list >/dev/null 2>&1; then X echo "done" Xelse X nm $libc 2>/dev/null | sed -n -e 's/^.* D _//p' -e 's/^.* D //p' > libc.list X if $contains '^printf$' libc.list >/dev/null 2>&1; then X echo "done" X else X echo " " X echo "nm didn't seem to work right." X echo "Trying ar instead..." X rmlist="$rmlist libc.tmp" X if ar t $libc > libc.tmp; then X sed -e 's/\.o$//' < libc.tmp > libc.list X echo "Ok." X else X echo "ar didn't seem to work right." X echo "Maybe this is a Cray...trying bld instead..." X if bld t $libc | sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then X echo "Ok." X else X echo "That didn't work either. Giving up." X exit 1 X fi X fi X fi Xfi Xrmlist="$rmlist libc.list" X !STUFFY!FUNK! echo Extracting mcon/U/Cppsym.U sed >mcon/U/Cppsym.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: Cppsym.U,v 2.0 88/06/28 23:12:50 lwall Locked $ X?X: X?X: This unit produces a shell script called Cppsym, which can be used to X?X: determine whether any in a list of symbols is defined by the C preprocessor. X?X: It can determine the status of any symbol, though the symbols in attrlist X?X: are more easily determined. If you want to add to attrlist you can do X?X: it in Myinit.U. X?X: X?RCS: $Log: Cppsym.U,v $ X?RCS: Revision 2.0 88/06/28 23:12:50 lwall X?RCS: Baseline. X?RCS: X?MAKE:Cppsym: eunicefix Guess cppstdin cat tr sed rm X?MAKE: -pick add $@ %* X?INIT:attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr" X?INIT:attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200" X?INIT:attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" X?INIT:attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" X?INIT:attrlist="$attrlist $mc68k __STDC__" X: get C preprocessor symbols handy Xecho " " Xecho $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know X$cat <Cppsym X$startsh Xcase "\$1" in X-l) list=true X shift X ;; Xesac Xunknown='' Xcase "\$list\$#" in X1|2) X for sym do X if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then X exit 0 X elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then X : X else X unknown="\$unknown \$sym" X fi X done X set X \$unknown X shift X ;; Xesac Xcase \$# in X0) exit 1;; Xesac Xecho \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\ X#ifdef \1\\ Xexit 0; _ _ _ _\1\\ \1\\ X#endif\\ X/' >/tmp/Cppsym\$\$ Xecho exit 1 >>/tmp/Cppsym\$\$ X$cppstdin $cppminus /tmp/Cppsym2\$\$ Xcase "\$list" in Xtrue) awk 'NF > 5 {print substr(\$6,2,100)}' Cppsym.true Xcat Cppsym.true Xrmlist="$rmlist Cppsym Cppsym.know Cppsym.true" X !STUFFY!FUNK! echo Extracting mcon/U/d_nolnbuf.U sed >mcon/U/d_nolnbuf.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: d_nolnbuf.U,v 2.0 88/06/28 23:15:22 lwall Locked $ X?RCS: $Log: d_nolnbuf.U,v $ X?RCS: Revision 2.0 88/06/28 23:15:22 lwall X?RCS: Baseline. X?RCS: X?MAKE:d_nolnbuf: Guess n c echo test Myread X?MAKE: -pick add $@ %* X?S:d_nolnbuf: X?S: This variable conditionally defines the NOLINEBUF symbol, which X?S: indicates to the C program that stdout is not buffered, so that X?S: the program can call setbuf() or setlinebuf() for efficiency. X?S:. X?C:NOLINEBUF: X?C: This symbol, if defined, indicates that stdout is not buffered, so that X?C: the program can call setbuf() or setlinebuf() for efficiency. X?C:. X?H:?%1:#$d_nolnbuf NOLINEBUF /**/ X?H:?%1: X: check for buffering of stdout Xecho " " Xcase "$d_nolnbuf" in X'') X cat <<'EOT' >blurfl.c X#include Xmain() X{ X int i; X X for (i=0; i<5; i++) { X putchar(i+'a'); X sleep(1); X } X putchar('\n'); X} XEOT X cc blurfl.c -o blurfl X rm -f blurfl.c X cat <<'EOM' XChecking for buffering of stdout to terminal. X XObserve the following characters as they are printed out, to see whether they Xprint out all at once, or with a 1 second pause between each of them. If they Xprint out one by one, you don't have buffering. If they print together (after Xabout a 5 second pause), you do have buffering. X XEOM X rp="Type return to start printing the test characters:" X $echo $n "$rp $c" X . myread X ans=y X while $test "$ans" = 'y'; do X blurfl X dflt=n X rp='Would you like to see that again? [n]' X $echo $n "$rp $c" X . myread X done X dflt=y X rp="Do you have buffering (printed all at once)? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X n*) d_nolnbuf="$define";; X *) d_nolnbuf="$undef";; X esac X ;; X*) X case "$d_nolnbuf" in X "$define") dflt=n;; X *) dflt=y;; X esac X rp="Do you have buffering on stdout to terminals? [$dflt]" X $echo $n "$rp $c" X . myread X case "$ans" in X n*) d_nolnbuf="$define";; X *) d_nolnbuf="$undef";; X esac X ;; Xesac X !STUFFY!FUNK! echo Extracting pat/Makefile.SH sed >pat/Makefile.SH <<'!STUFFY!FUNK!' -e 's/X//' Xcase $CONFIG in X'') X if test ! -f config.sh; then X ln ../config.sh . || \ X ln ../../config.sh . || \ X ln ../../../config.sh . || \ X (echo "Can't find config.sh."; exit 1) X echo "Using config.sh from above..." X fi X . ./config.sh X ;; Xesac X: This forces SH files to create target in same directory as SH file. X: This is so that make depend always knows where to find SH derivatives. Xcase "$0" in X*/*) cd `expr X$0 : 'X\(.*\)/'` ;; Xesac Xecho "Extracting Makefile (with variable substitutions)" Xcat >Makefile <>Makefile <<'!NO!SUBS!' X Xpublic = pat patcil patbase patdiff patmake patpost patsend patftp \ X patindex Xprivate = Xmanpages = pat.man Xutil = Makefile X Xc = X Xobj = X Xaddedbyconf = pat patmake patpost patsend X X# grrr XSHELL = /bin/sh X Xall: $(public) $(private) $(util) X touch all Xpat: pat.SH ../pl/package.pl X sh pat.SH X Xpatbase: patbase.SH ../pl/package.pl ../pl/rcsargs.pl ../pl/comment.pl X sh patbase.SH X Xpatcil: patcil.SH ../pl/package.pl ../pl/rcsargs.pl ../pl/comment.pl X sh patcil.SH X Xpatdiff: patdiff.SH ../pl/package.pl ../pl/rcsargs.pl X sh patdiff.SH X Xpatmake: patmake.SH ../pl/package.pl X sh patmake.SH X Xpatpost: patpost.SH ../pl/package.pl ../pl/rangeargs.pl X sh patpost.SH X Xpatsend: patsend.SH ../pl/package.pl ../pl/rangeargs.pl X sh patsend.SH X Xpatftp: patftp.SH ../pl/package.pl ../pl/rangeargs.pl X sh patftp.SH X XMakefile: Makefile.SH X sh Makefile.SH X X# won't work with csh Xinstall: $(public) X export PATH || exit 1 X - if test `pwd` != $(bin); then cp $(public) $(bin); fi X cd $(bin); chmod +x $(public) X - if test `pwd` != $(mansrc); then \ Xfor page in $(manpages); do \ Xcp $$page $(mansrc)/`basename $$page .man`.$(manext); \ Xdone; \ Xfi X Xclean: X Xrealclean: X rm -f core $(addedbyconf) X X!NO!SUBS! X$eunicefix Makefile !STUFFY!FUNK! echo Extracting mcon/U/d_dosuid.U sed >mcon/U/d_dosuid.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: d_dosuid.U,v 2.0 88/06/29 00:18:20 lwall Locked $ X?RCS: $Log: d_dosuid.U,v $ X?RCS: Revision 2.0 88/06/29 00:18:20 lwall X?RCS: Baseline. X?RCS: X?MAKE:d_dosuid: echo contains sed test n c Myread Oldconfig Guess X?MAKE: -pick add $@ %* X?S:d_dosuid: X?S: This variable conditionally defines the symbol DOSUID, which X?S: tells the C program that it should insert setuid emulation code X?S: on hosts which have setuid #! scripts disabled. X?S:. X?C:DOSUID: X?C: This symbol, if defined, indicates that the C program should X?C: check the script that it is executing for setuid/setgid bits, and X?C: attempt to emulate setuid/setgid on systems that have disabled X?C: setuid #! scripts because the kernel can't do it securely. X?C: It is up to the package designer to make sure that this emulation X?C: is done securely. Among other things, it should do an fstat on X?C: the script it just opened to make sure it really is a setuid/setgid X?C: script, it should make sure the arguments passed correspond exactly X?C: to the argument on the #! line, and it should not trust any X?C: subprocesses to which it must pass the filename rather than the X?C: file descriptor of the script to be executed. X?C:. X?H:?%1:#$d_dosuid DOSUID /**/ X?H:?%1: X: now see if they want to do setuid emulation Xcase "$d_dosuid" in X'') if bsd; then X dflt=y X else X dflt=n X fi X ;; X*undef*) dflt=n;; X*) dflt=y;; Xesac Xcat <mcon/U/d_hidnet.U <<'!STUFFY!FUNK!' -e 's/X//' X?RCS:$Header: d_hidnet.U,v 2.0 88/06/28 23:14:54 lwall Locked $ X?RCS: $Log: d_hidnet.U,v $ X?RCS: Revision 2.0 88/06/28 23:14:54 lwall X?RCS: Baseline. X?RCS: X?MAKE:d_hidnet hiddennet: echo contains sed test n c Myread Oldconfig Guess X?MAKE: -pick add $@ %* X?S:d_hidnet: X?S: This variable conditionally defines the symbol HIDDENNET, which X?S: tells the C program that it should pretend it is on a different X?S: host for purposes of advertising a mailing address. X?S:. X?S:hiddennet: X?S: This variable contains the value eventually given to the symbol X?S: HIDDENNET, if d_hidnet defines it. If defined, it's the name X?S: of the host which serves as the mail server for a network that X?S: is invisible to the outside world. X?S:. X?C:HIDDENNET: X?C: This symbol, if defined, contains the host name that you want to X?C: advertise to the outside world. This name can be different from X?C: your actual host name, as long as the machine you specify knows X?C: how to forward mail to you. X?C:. X?H:?%1:#$d_hidnet HIDDENNET "$hiddennet" /**/ X?H:?%1: X: now get the host name to advertise as our mailing address Xcase "$hiddennet" in X'') dflt=n;; X*) dflt=y;; Xesac Xcat <