-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mk_dist
158 lines (117 loc) · 4.11 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
#!/bin/sh -
#
# 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. (85Mb!)
#
trap "exit 1" 1 2 3 15
DIR="`pwd`"
TMPDIR=/tmp/Linux-86
TMPSRC=linux86
ARCDIR="$DIR"/dev86arc
SRCDIRS='bcc unproto as ar ld copt man elksemu dis88 tests libbsd bin86'
DISTFILES='Libc_version Makefile README COPYING Changes Contributors
mkcompile GNUmakefile libcompat ifdef.c makefile.in Mk_dist'
TMPDIST=$TMPDIR/$TMPSRC
rm -rf ${TMPDIR}
mkdir -p ${TMPDIST}
#-----------------------------------------------------------------------
echo Checking version
make -s -C libc Libc_version
make -s -C bin86 ungrab
VER=`cat Libc_version`
echo Copying most program files.
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:root ${TMPDIST}
chmod -R og=u-w ${TMPDIST}
}
rm -f /tmp/bootblocks.tar.gz /tmp/doselks.tar.gz /tmp/libc-8086-$VER.tar.gz
echo Extracting previous version
rm -f $ARCDIR/Dev86src-$VER.tar.gz
mkdir ${TMPDIST}.tmp
( cd ${TMPDIST}.tmp
tar xzf `ls -tr $ARCDIR/Dev86src*.0.tar.gz | tail -1`
mv * ${TMPDIST}.old
)
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`
echo Generating patch against previous .0 version.
cd ${TMPDIR}
mv ${TMPSRC}.old/bootblocks boot.old
mv ${TMPSRC}/bootblocks boot
diff -Nurd ${TMPSRC}.old ${TMPSRC} > ${ARCDIR}/Dev86src-$VER.patch
mv boot.old ${TMPSRC}.old/bootblocks
mv boot ${TMPSRC}/bootblocks
diff -Nurd ${TMPSRC}.old/bootblocks ${TMPSRC}/bootblocks >> ${ARCDIR}/Dev86src-$VER.patch
gzip -f9 ${ARCDIR}/Dev86src-$VER.patch
echo Creating full source archive.
ln -s ${TMPSRC} dev86-$VER
tar cf ${ARCDIR}/Dev86src-$VER.tar dev86-$VER/*
gzip -f9 ${ARCDIR}/Dev86src-$VER.tar
echo Creating as86 source archive.
ln -s ${TMPSRC}/as as86-$VER
cp -p ${TMPSRC}/man/as86.1 as86-$VER/as86.1
cp -p ${TMPSRC}/COPYING as86-$VER/COPYING
tar cf ${ARCDIR}/as86-$VER.tar `find as86-$VER/* -prune -type f`
gzip -f9 ${ARCDIR}/as86-*.tar
echo Creating bin86 source archive.
make -s -C ${TMPSRC}/bin86 grab
ln -s ${TMPSRC}/bin86 bin86-$VER
tar chf ${ARCDIR}/bin86-$VER.tar bin86-$VER
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 ARFLAGS=q DIST=${TMPDIST}.ins ELKSSRC=/dev/null ||
exit
make -C ${TMPDIST} other || exit
tar cf ${ARCDIR}/Dev86bin-$VER.tar -C ${TMPDIST}.ins .
rm -f ${ARCDIR}/Dev86clb-$VER.zip Bcc
ln -s ${TMPDIST} Bcc
zip -9rpk ${ARCDIR}/Dev86clb-$VER.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-$VER.tar || exit
echo Process completed.