-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path:mk.fnd
290 lines (266 loc) · 7.95 KB
/
:mk.fnd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
echo ""
echo ""
echo " Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T"
echo " All Rights Reserved"
echo ""
echo " THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T"
echo " The copyright notice above does not evidence any actual or"
echo " intended publication of such source code."
echo ""
echo ""
echo ""
#ident "@(#)mk::mk.fnd 1.1.3.1"
#
# Shell script for rebuilding the UNIX System V/386 Release 4.0 except for the CSDS
#
if [ "$ROOT" = "" ]
then echo "$0: You must specify a \$ROOT directory, other than '/', \
as the root of the source and output tree."
exit 1
fi
if [ "$ROOT" = "/" ]
then echo "$0: You must specify a \$ROOT directory, other than '/', \
as the root of the source and output tree."
exit 1
fi
if [ ! -d ${ROOT} ]
then echo "$0: You must specify a \$ROOT directory, other than '/', \
as the root of the source and output tree."
exit 1
fi
OLDPATH=$PATH
PATH=$ROOT/xenv:/usr/ccs/bin:/usr/bin:/usr/sbin:/etc; export PATH
PATH=$PATH:$OLDPATH; export PATH
MCS=${MCS:-mcs}; export MCS
#
# changed to allow the following to be setable
#
LOAD=${LOAD:-STC}; export LOAD
RELEASE=${RELEASE:-4.0}; export RELEASE
TARGET=${TARGET:-i386}; export TARGET
PRODUCT=${PRODUCT:-386unix}; export PRODUCT
echo $0 started at `date`
trap "exit 1" 1 2 3 15
SHELL="/bin/sh"
export SHELL
CH=`id | sed '/uid=0[^0-9].*/!s|.*|#|;/#/!d'`
export CH
CCSTYPE=${CCSTYPE:-ELF}; export CCSTYPE
if [ "$ROOT" = "" ]
then
PATH=/usr/ccs/bin:/usr/bin:/usr/sbin:/etc; export PATH
else
# Cross-makes may not have all the directories needed
for dir in /bin /lib /usr/include /usr/include/sys /shlib /tmp /xenv
do if [ ! -d $ROOT/$dir ]
then rm -f $ROOT/$dir
mkdir $ROOT/$dir
fi
done
fi
echo "uname -a = \c"; uname -a
echo 'MAKEOPTS="MAKE=make AS=as CC=cc LD=ld ROOT=$ROOT INC=$ROOT/usr/include"
export MAKEOPTS
if [ -x $ROOT/usr/ccs/bin/make ]
then ${ROOT}/usr/ccs/bin/make ${MAKEOPTS} "$@"
else /usr/ccs/bin/make ${MAKEOPTS} "$@"
fi ' > $ROOT/xenv/make
chmod +x ${ROOT}/xenv/make
# This is needed because :mkcmd set's CC to be i386cc if ROOT is unset and
# the current command to be compiled is only a .c (e.g. no .mk and no directory
if [ -x ${ROOT}/usr/ccs/bin/cc ]
then
echo '${ROOT}/usr/ccs/bin/cc -Y 0,${ROOT}/usr/ccs/lib -Y 2,${ROOT}/usr/ccs/lib -Y a,${ROOT}/usr/ccs/bin -Y l,${ROOT}/usr/ccs/bin -Y S,${ROOT}/usr/ccs/lib -Y L,${ROOT}/usr/ccs/lib -Y U,${ROOT}/usr/lib "$@" -Y I,${ROOT}/usr/include' > $ROOT/xenv/cc
else
echo '/usr/ccs/bin/cc -L $ROOT/usr/ccs/lib -L $ROOT/usr/lib -Y L,/usr/lib -Y U,/usr/ccs/lib "$@" -Y I,$ROOT/usr/include' > $ROOT/xenv/cc
fi
if [ ! -x $ROOT/xenv/i386cc ]
then ln $ROOT/xenv/cc $ROOT/xenv/i386cc
fi
chmod +x ${ROOT}/xenv/cc
for i in as ld ar
do
if [ -x ${ROOT}/usr/ccs/bin/${i} ]
then cp ${ROOT}/usr/ccs/bin/${i} ${ROOT}/xenv/${i}
fi
done
cd $ROOT/usr/src
while [ $# -ge 1 ]
do
case "$1" in
at386|AT386|at|AT) BUS=AT386; ARCH=AT386;;
vpix|VPIX) VPIX=VPIX;;
novpix|NOVPIX) VPIX=NOVPIX;;
merge386|MERGE386) MERGE386=MERGE386;;
nomerge386|NOMERGE386) MERGE386=" ";;
mca|MCA) BUS=MCA; ARCH=MCA;;
mb1|MB1|mbus1|MBUS1) BUS=MB1; ARCH=MBUS;;
mb2|MB2|mbus2|MBUS2) BUS=MB2; ARCH=MBUS;;
eisa|EISA) BUS=EISA; ARCH=AT386;;
ev\-at|EV\-AT) BUS=EV-AT; ARCH=EV-AT;;
i860|I860|860) ;;
mbus|MBUS) ;;
*) BUS="$1"; ARCH="$1";;
esac
shift
done
BUS=${BUS:-AT386}; export BUS
ARCH=${ARCH:-AT386}; export ARCH
MERGE386=${MERGE386:-MERGE386}; export MERGE386
VPIX=${VPIX:-VPIX}; export VPIX
# install /usr/include and /usr/include/sys header files
sh ./:mkhead
sh ./:mksyshead
sh ./:mkucbhead
if [ ! -f $ROOT/usr/include/curses.h ]
then cp /usr/include/curses.h $ROOT/usr/include/curses.h
fi
if [ ! -f $ROOT/usr/include/term.h ]
then cp /usr/include/term.h $ROOT/usr/include/term.h
fi
if [ ! -f $ROOT/usr/include/unctrl.h ]
then cp /usr/include/unctrl.h $ROOT/usr/include/unctrl.h
fi
if [ ! -f $ROOT/usr/include/regexpr.h ]
then cp /usr/include/regexpr.h $ROOT/usr/include/regexpr.h
fi
if [ ! -f $ROOT/usr/include/libgen.h ]
then cp $ROOT/usr/src/lib/libgen/libgen.h $ROOT/usr/include/libgen.h
fi
# Build all the non CSDS libraries
(
cd lib
ls -a | sed \
-e "/^.lib.mk$/d" \
-e "/^.libmk.temp$/d" \
-e "/^libc$/d" \
-e "/^libcrypt$/d" \
-e "/^libdl$/d" \
-e "/^libgen$/d" \
-e "/^libl$/d" \
-e "/^libm$/d" \
-e "/^libmalloc$/d" \
-e "/^liby$/d" \
-e "/^rtld$/d" \
-e "/^xlibcurses$/d" \
-e "/^zlibeti$/d" \
-e "/^zlibetitam$/d" |
sort -u | sed -n '3,$p' > /tmp/$$.doit
)
if [ -s /tmp/$$.doit ]
then sh ./:mklib $VPIX $MERGE386 `cat -s /tmp/$$.doit`
fi
rm -f /tmp/$$.doit
(
cd ${ROOT}/usr/src/xcplib
ls -a |
sort -u |
sed -n '3,$p' > /tmp/$$.xit
)
sh ./:mkxcplib `cat -s /tmp/$$.xit`
rm -f /tmp/$$.xit
(
cd ${ROOT}/usr/src/ucblib
ls -a |
sort -u |
sed -n '3,$p' > /tmp/$$.ucbit
)
sh ./:mkucblib `cat -s /tmp/$$.ucbit`
rm -f /tmp/$$.ucbit
if [ ! -f ${ROOT}/usr/lib/libcrypt_d.a -a ! -f ${ROOT}/usr/ccs/lib/libcrypt_d.a ]
then cp /usr/lib/libcrypt_d.a ${ROOT}/usr/lib/libcrypt_d.a || cp /usr/ccs/lib/libcrypt_d.a ${ROOT}/usr/ccs/lib/libcrypt_d.a
fi
# build all the commands
(
cd ${ROOT}/usr/src/cmd
ls -a |
sed -e "s/\.mk$//" -e "s/\.sh$//" -e "s/\.c$//" | sed \
-e "/^include$/d" \
-e "/^cb$/d" \
-e "/^cflow$/d" \
-e "/^cscope$/d" \
-e "/^ctrace$/d" \
-e "/^cxref$/d" \
-e "/^ldd$/d" \
-e "/^make$/d" \
-e "/^prof$/d" \
-e "/^regcmp$/d" \
-e "/^sccs$/d" \
-e "/^sdb$/d" \
-e "/^sgs$/d" |
sort -u |
sed -n '3,$p' > /tmp/$$.doit
)
sh ./:mkcmd BUS=${BUS} ARCH=${ARCH} $VPIX $MERGE386 `cat -s /tmp/$$.doit`
rm -f /tmp/$$.doit
(
cd ${ROOT}/usr/src/ucbcmd
ls -a |
sed -e "s/\.mk$//" -e "s/\.sh$//" -e "s/\.c$//" |
sort -u |
sed -n '3,$p' > /tmp/$$.ucbit
)
sh ./:mkucbcmd `cat -s /tmp/$$.ucbit`
rm -f /tmp/$$.ucbit
# Remove these five files which are links to other files
rm -f ${ROOT}/usr/bin/view ${ROOT}/usr/bin/vedit ${ROOT}/usr/bin/edit ${ROOT}/usr/bin/ex ${ROOT}/usr/bin/pcat
# build the OS itself
if [ -x ${ROOT}/usr/ccs/bin/as ]
then cp ${ROOT}/usr/ccs/bin/as ${ROOT}/usr/bin/idas
cp ${ROOT}/usr/ccs/bin/ld ${ROOT}/usr/bin/idld
cp ${ROOT}/usr/ccs/bin/cc ${ROOT}/usr/bin/idcc
cp ${ROOT}/usr/ccs/lib/cpp ${ROOT}/usr/lib/idcpp
cp ${ROOT}/usr/ccs/lib/acomp ${ROOT}/usr/lib/idacomp
cp ${ROOT}/usr/ccs/bin/ar ${ROOT}/usr/bin/ar
cp ${ROOT}/usr/ccs/bin/captoinfo ${ROOT}/usr/bin/captoinfo
cp ${ROOT}/usr/ccs/bin/infocmp ${ROOT}/usr/bin/infocmp
cp ${ROOT}/usr/ccs/bin/mcs ${ROOT}/usr/bin/mcs
cp ${ROOT}/usr/ccs/bin/tic ${ROOT}/usr/bin/tic
cp ${ROOT}/usr/ccs/bin/tput ${ROOT}/usr/bin/tput
cp ${ROOT}/usr/ccs/bin/what ${ROOT}/usr/bin/what
else cp /usr/ccs/bin/as ${ROOT}/usr/bin/idas
cp /usr/ccs/bin/ld ${ROOT}/usr/bin/idld
cp /usr/ccs/bin/cc ${ROOT}/usr/bin/idcc
cp /usr/ccs/lib/cpp ${ROOT}/usr/lib/idcpp
cp /usr/ccs/lib/acomp ${ROOT}/usr/lib/idacomp
cp /usr/ccs/bin/ar ${ROOT}/usr/bin/ar
cp /usr/ccs/bin/captoinfo ${ROOT}/usr/bin/captoinfo
cp /usr/ccs/bin/infocmp ${ROOT}/usr/bin/infocmp
cp /usr/ccs/bin/mcs ${ROOT}/usr/bin/mcs
cp /usr/ccs/bin/tic ${ROOT}/usr/bin/tic
cp /usr/ccs/bin/tput ${ROOT}/usr/bin/tput
cp /usr/ccs/bin/what ${ROOT}/usr/bin/what
fi
if [ ! -f $ROOT/usr/bin/tic ]
then
cp /usr/bin/captoinfo $ROOT/usr/bin/captoinfo
cp /usr/bin/infocmp $ROOT/usr/bin/infocmp
cp /usr/bin/tic $ROOT/usr/bin/tic
cp /usr/bin/tput $ROOT/usr/bin/tput
fi
ln -s $ROOT/usr/bin/idas $ROOT/bin/idas
ln -s $ROOT/usr/bin/idcc $ROOT/bin/idcc
ln -s $ROOT/usr/bin/idld $ROOT/bin/idld
ln -s $ROOT/usr/lib/idacomp $ROOT/lib/idacomp
ln -s $ROOT/usr/lib/idcpp $ROOT/lib/idcpp
sh ./:mkuts ${BUS} ${ARCH} $VPIX $MERGE386
# Build the add-ons
# build all the add-ons that are present.
pkglist=""
for i in `cd add-on; ls`
do
# skip ones which are interactive
[ $i = source ] && continue
pkglist="$pkglist $i"
done
sh ./:mk.addon BUS=${BUS} ARCH=${ARCH} $VPIX $MERGE386 $pkglist
for i in `cd pkg; ls`
do
pkglist="$pkglist $i"
done
sh ./:mkoam BUS=${BUS} ARCH=${ARCH} $pkglist
if [ ! -f $ROOT/usr/lib/libc.so.1 ]
then cp /usr/lib/libc.so.1 $ROOT/usr/lib/libc.so.1
fi
echo $0 done at `date`
exit 0