-
Notifications
You must be signed in to change notification settings - Fork 45
/
Mk_dist
215 lines (163 loc) · 5.57 KB
/
Mk_dist
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
#!/bin/bash -
#
# This script builds _and checks_ all the distribution files from my source
# directory. It's very selective because I've got a lot of historical and
# other 'junk' in the same directory. (120Mb at the last count!)
#
trap "exit 1" 1 2 3 15
DIR="`pwd`"
TMPDIR=/tmp/Linux-86
TMPSRC=linux86
ARCDIR="$DIR"/dev86arc
SRCDIRS='bcc cpp unproto as ar ld copt man elksemu dis88 tests libbsd bin86'
DISTFILES='Makefile README COPYING Changes Contributors MAGIC
mkcompile GNUmakefile libcompat ifdef.c makefile.in Mk_dist'
VERSION="$1"
TMPDIST=$TMPDIR/$TMPSRC
rm -rf ${TMPDIR}
mkdir -p ${TMPDIST}
[ "$VERSION" = '' ] && {
echo 'Usage: $0 <version>' 1>&2
exit 1
}
#-----------------------------------------------------------------------
echo Copying most program files.
make -s -C bin86 ungrab || exit
cp -a $DISTFILES $SRCDIRS ${TMPDIST}
#-----------------------------------------------------------------------
echo Copying libc.
LIBC_FILES='Makefile Make.defs crt0.c
README COPYING KERNEL
New_subdir Pre_main Config_sh Config.dflt'
mkdir ${TMPDIST}/libc
(
cd libc
LIBC_DIRS="`for i in */Makefile */Config; do dirname $i; done | sort -u`"
cp -a $LIBC_FILES include $LIBC_DIRS ${TMPDIST}/libc/.
)
#-----------------------------------------------------------------------
echo Copying bootblocks and doselks.
make -s -C bootblocks distribution
make -s -C doselks distribution
mkdir ${TMPDIST}/bootblocks
( cd ${TMPDIST}/bootblocks ; tar xzf /tmp/bootblocks.tar.gz )
mkdir ${TMPDIST}/doselks
( cd ${TMPDIST}/doselks ; tar xzf /tmp/doselks.tar.gz )
[ "`id -un`" = "root" ] && {
chown -R root:0 ${TMPDIST}
chmod -R og=u-w ${TMPDIST}
}
rm -f /tmp/bootblocks.tar.gz /tmp/doselks.tar.gz /tmp/libc-8086-$VERSION.tar.gz
MINOR=${VERSION##*.}
MAJOR=${VERSION%.*}
MID=${MAJOR##*.}
MAJOR=${MAJOR%.*}
OLDVER=
case "$VERSION" in
0.0.0 ) BASEVER=0.0.0.0 ;; # Naa.
*.0.0 ) BASEVER=$((MAJOR-1)).$MID.$MINOR ;;
*.*.0 ) BASEVER=$MAJOR.$((MID-1)).$MINOR ;;
* ) BASEVER=$MAJOR.$MID.$((MINOR-1))
OLDVER=$MAJOR.$MID.0
;;
esac
if [ "$MAJOR.$MID.$((MINOR-1))" != "$BASEVER" ]
then PATCHNAME="$VERSION-$BASEVER"
else PATCHNAME="$VERSION"
fi
[ -f $ARCDIR/Dev86src-$BASEVER.tar.gz ] && {
echo "Extracting previous version ($BASEVER)"
mkdir ${TMPDIST}.tmp
( cd ${TMPDIST}.tmp
tar xzf $ARCDIR/Dev86src-$BASEVER.tar.gz
mv * ${TMPDIST}.old
)
rmdir ${TMPDIST}.tmp
}
[ "$OLDVER" != "" -a -f $ARCDIR/Dev86src-$OLDVER.tar.gz ] && {
echo "Extracting previous version ($OLDVER)"
mkdir ${TMPDIST}.tmp
( cd ${TMPDIST}.tmp
tar xzf $ARCDIR/Dev86src-$OLDVER.tar.gz
mv * ${TMPDIST}.vold
)
rmdir ${TMPDIST}.tmp
}
# ARCDIR=${TMPDIR}/arc ; mkdir -p ${ARCDIR}
cd ${TMPDIST}
echo COPY COMPLETE -- Switched to ${TMPDIST}, ARCDIR now $ARCDIR
echo
#-----------------------------------------------------------------------
#
#
echo 'Ensuring clean tree'
cd ${TMPDIST}
make -s clean realclean
mv as/obj1 ${TMPDIST}-obj1
EXCL="`find . -name '*.o' -o -name '*.obj' \
-o -name '*.lib' -o -name '*.bak' \
-o -name '*~' -o -name '*.exe' \
-o -name '*.orig' -o -name '*.rej' \
`"
mv ${TMPDIST}-obj1 as/obj1
rm -f $EXCL
rm -f `find . -type l`
cd ${TMPDIR}
[ -d ${TMPSRC}.old ] && {
echo "Generating patch against version $BASEVER."
mv ${TMPSRC}.old/bootblocks boot.old
mv ${TMPSRC}/bootblocks boot
diff -Nurd ${TMPSRC}.old ${TMPSRC} > ${ARCDIR}/patch-$PATCHNAME
mv boot.old ${TMPSRC}.old/bootblocks
mv boot ${TMPSRC}/bootblocks
diff -Nurd ${TMPSRC}.old/bootblocks ${TMPSRC}/bootblocks >> ${ARCDIR}/patch-$PATCHNAME
gzip -f9 ${ARCDIR}/patch-$PATCHNAME
}
[ -d ${TMPSRC}.vold ] && {
echo "Generating patch against version $OLDVER."
mv ${TMPSRC}.vold/bootblocks boot.old
mv ${TMPSRC}/bootblocks boot
diff -Nurd ${TMPSRC}.vold ${TMPSRC} > ${ARCDIR}/patch-$VERSION-$OLDVER
mv boot.old ${TMPSRC}.vold/bootblocks
mv boot ${TMPSRC}/bootblocks
diff -Nurd ${TMPSRC}.vold/bootblocks ${TMPSRC}/bootblocks >> ${ARCDIR}/patch-$VERSION-$OLDVER
gzip -f9 ${ARCDIR}/patch-$VERSION-$OLDVER
}
mkdir -p ${ARCDIR}
echo Creating full source archive.
ln -s ${TMPSRC} dev86-$VERSION
tar cf ${ARCDIR}/Dev86src-$VERSION.tar dev86-$VERSION/*
gzip -f9 ${ARCDIR}/Dev86src-$VERSION.tar
echo Creating as86 source archive.
ln -s ${TMPSRC}/as as86-$VERSION
cp -p ${TMPSRC}/man/as86.1 as86-$VERSION/as86.1
cp -p ${TMPSRC}/COPYING as86-$VERSION/COPYING
echo '#define VERSION "'"$VERSION"'"' > as86-$VERSION/version.h
tar cf ${ARCDIR}/as86-$VERSION.tar `find as86-$VERSION/* -prune -type f`
gzip -f9 ${ARCDIR}/as86-*.tar
echo Creating bin86 source archive.
make -s -C ${TMPSRC}/bin86 VERSION=${VERSION} grab
ln -s ${TMPSRC}/bin86 bin86-$VERSION
echo '#define VERSION "'"$VERSION"'"' > bin86-$VERSION/ld/version.h
tar chf ${ARCDIR}/bin86-$VERSION.tar bin86-$VERSION
make -s -C ${TMPSRC}/bin86 ungrab
gzip -f9 ${ARCDIR}/bin86-*.tar
###################################################################
echo Compile up the binaries.
cd ${TMPDIR} || exit 1
mkdir -p ${TMPDIST}.ins
make -C ${TMPDIST} install install-other \
ARFLAGS=q ELKSSRC=/dev/null \
DIST=${TMPDIST}.ins 'ASLDDIR=$(BINDIR)' ||
exit
make -C ${TMPDIST} other || exit
tar cf ${ARCDIR}/Dev86bin-$VERSION.tar -C ${TMPDIST}.ins .
rm -f ${ARCDIR}/Dev86clb-$VERSION.zip Bcc
ln -s ${TMPDIST} Bcc
zip -9rpk ${ARCDIR}/Dev86clb-$VERSION.zip \
Bcc/lib/crt0.o Bcc/lib/libc.a Bcc/lib/libbsd.a \
Bcc/lib/libdos.a Bcc/lib/libc_f.a Bcc/lib/libc_s.a \
Bcc/lib/i386/crt0.o Bcc/lib/i386/libc.a || exit
rm Bcc
gzip -9f ${ARCDIR}/Dev86bin-$VERSION.tar || exit
echo Process completed.