forked from cisco/ChezScheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workarea
executable file
·243 lines (221 loc) · 6.53 KB
/
workarea
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
#! /bin/sh
# workarea
# Copyright 1984-2016 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ $# != 1 -a $# != 2 ]
then
echo "Usage: workarea <machine-type> { <workarea name> }"
exit 1
fi
# set M to machine type and W to workarea name
M=$1
if [ "$2" = "" ]
then
W=$M
else
W=$2
fi
case "$M" in
a6fb) ;;
a6le) ;;
a6ob) ;;
a6osx) ;;
a6nb) ;;
a6nt) ;;
a6s2) ;;
arm32le) ;;
i3fb) ;;
i3le) ;;
i3nb) ;;
i3nt) ;;
i3ob) ;;
i3osx) ;;
i3qnx) ;;
i3s2) ;;
ppc32le) ;;
ta6fb) ;;
ta6le) ;;
ta6nt) ;;
ta6ob) ;;
ta6osx) ;;
ta6nb) ;;
ta6s2) ;;
tarm32le) ;;
ti3fb) ;;
ti3le) ;;
ti3nb) ;;
ti3nt) ;;
ti3ob) ;;
ti3osx) ;;
ti3qnx) ;;
ti3s2) ;;
tppc32le) ;;
*) echo "Unrecognized machine name $M"; exit 1 ;;
esac
if [ "$OS" = "Windows_NT" ]
then
ln="/bin/cp -R"
else
ln="/bin/ln -s"
fi
# This shell script creates a workarea for local modifications to the
# Chez Scheme source code. Invoke with the name of a machine type:
# i3le, i3nt, ti3osx, etc., plus an optional workarea name. The script
# creates a subdirectory in the current working (release) directory.
# If the workarea name argument is not given, this subdirectory is
# named by the machine type. The workarea contains subdirectories
# that correspond to various subdirectories of the release directory.
# Initially, all of the files in the workarea are links back into the
# source directories. Furthermore, many of the files are simply make
# files that are used to rebuild the system, and in most cases, the
# make files themselves create links for the source files as needed.
# To make local modifications, convert the links into local copies.
# workln source dest
# creates link if dest does not exist and source does
workln()
{
if [ ! -e $2 -a -e $1 ] ; then
$ln $1 $2 2> /dev/null
fi
}
# forceworkln source dest
# attempts to create link even if source does not exist
forceworkln()
{
if [ ! -e $2 ] ; then
/bin/ln -s $1 $2 2> /dev/null
fi
}
forceworkln2()
{
if [ ! -e $2 ] ; then
$ln $1 $2 2> /dev/null
fi
}
# workdir directory-name
workdir()
{
if [ ! -e $1 ] ; then
mkdir $1
fi
}
workdir $W
workdir $W/c
(cd $W/c; workln ../../c/Mf-$M Mf-$M)
(cd $W/c; forceworkln Mf-$M Makefile)
(cd $W/c; workln ../../c/Mf-base Mf-base)
if [ ! -e $W/c/config.h ] ; then
touch $W/c/config.h
fi
if [ ! -e $W/c/Mf-config ] ; then
touch $W/c/Mf-config
fi
workdir $W/s
(cd $W/s; workln ../../s/Mf-$M Mf-$M)
(cd $W/s; forceworkln Mf-$M Makefile)
(cd $W/s; workln ../../s/Mf-base Mf-base)
(cd $W/s; workln ../../s/Mf-cross Mf-cross)
(cd $W/s; workln ../../s/$M.def $M.def)
(cd $W/s; forceworkln2 $M.def machine.def)
workdir $W/mats
(cd $W/mats; workln ../../mats/Mf-$M Mf-$M)
(cd $W/mats; forceworkln Mf-$M Makefile)
(cd $W/mats; workln ../../mats/Mf-base Mf-base)
(cd $W/mats; workln ../../mats/Mf-exobj Mf-exobj)
for dir in `echo examples unicode` ; do
workdir $W/$dir
for file in `(cd $dir ; echo *)` ; do
(cd $W/$dir ; workln ../../$dir/$file $file)
done
done
# deep copy submodules where builds occur so changes don't propagate through symlinks
for dir in `echo zlib` ; do
if [ ! -e $W/$dir ] ; then
/bin/cp -R $dir $W/$dir
fi
done
workdir $W/boot
workdir $W/boot/$M
(cd $W/boot/$M; workln ../../../boot/$M/scheme.h scheme.h)
(cd $W/boot/$M; workln ../../../boot/$M/equates.h equates.h)
(cd $W/boot/$M; workln ../../../boot/$M/petite.boot petite.boot)
(cd $W/boot/$M; workln ../../../boot/$M/scheme.boot scheme.boot)
(cd $W/boot/$M; workln ../../../boot/$M/def.so def.so)
(cd $W/boot/$M; workln ../../../boot/$M/edit.so edit.so)
(cd $W/boot/$M; workln ../../../boot/$M/fact.so fact.so)
(cd $W/boot/$M; workln ../../../boot/$M/fatfib.so fatfib.so)
(cd $W/boot/$M; workln ../../../boot/$M/fib.so fib.so)
(cd $W/boot/$M; workln ../../../boot/$M/freq.so freq.so)
(cd $W/boot/$M; workln ../../../boot/$M/m4.so m4.so)
(cd $W/boot/$M; workln ../../../boot/$M/macro.so macro.so)
(cd $W/boot/$M; workln ../../../boot/$M/matrix.so matrix.so)
(cd $W/boot/$M; workln ../../../boot/$M/object.so object.so)
(cd $W/boot/$M; workln ../../../boot/$M/power.so power.so)
(cd $W/boot/$M; workln ../../../boot/$M/rabbit.so rabbit.so)
(cd $W/boot/$M; workln ../../../boot/$M/rsa.so rsa.so)
(cd $W/boot/$M; workln ../../../boot/$M/scons.so scons.so)
(cd $W/boot/$M; workln ../../../boot/$M/setof.so setof.so)
(cd $W/boot/$M; workln ../../../boot/$M/unify.so unify.so)
(cd $W/boot/$M; workln ../../../boot/$M/fft.so fft.so)
(cd $W/boot/$M; workln ../../../boot/$M/compat.so compat.so)
case $M in
*nt)
(cd $W/boot/$M; workln ../../../boot/$M/mainmd.obj mainmd.obj)
(cd $W/boot/$M; workln ../../../boot/$M/mainmt.obj mainmt.obj)
(cd $W/boot/$M; workln ../../../boot/$M/csv941md.lib csv941md.lib)
(cd $W/boot/$M; workln ../../../boot/$M/csv941mt.lib csv941mt.lib)
(cd $W/boot/$M; workln ../../../boot/$M/scheme.res scheme.res)
;;
*)
(cd $W/boot/$M; workln ../../../boot/$M/main.o main.o)
(cd $W/boot/$M; workln ../../../boot/$M/kernel.o kernel.o)
;;
esac
workdir $W/bin
workdir $W/bin/$M
case $M in
*nt)
(cd $W/bin/$M; workln ../../../bin/$M/scheme.exe scheme.exe)
(cd $W/bin/$M; forceworkln2 scheme.exe petite.exe)
(cd $W/bin/$M; workln ../../../bin/$M/csv941.dll csv941.dll)
(cd $W/bin/$M; workln ../../../bin/$M/csv941.lib csv941.lib)
;;
*)
(cd $W/bin/$M; workln ../../../bin/$M/scheme scheme)
(cd $W/bin/$M; forceworkln scheme petite)
;;
esac
# crutch links for fingers that remember old release structure
case $M in
*nt)
(cd $W/bin; forceworkln $M/scheme.exe scheme)
(cd $W/bin; forceworkln $M/petite.exe petite)
;;
*)
(cd $W/bin; forceworkln $M/scheme scheme)
(cd $W/bin; forceworkln $M/petite petite)
;;
esac
(cd $W; workln ../LOG LOG)
(cd $W; forceworkln2 ../nanopass nanopass)
(cd $W; workln ../makefiles/installsh installsh)
(cd $W; workln ../scheme.1.in scheme.1.in)
case $M in
*nt)
(cd $W/c; make source > /dev/null 2>&1)
(cd $W/s; make source > /dev/null 2>&1)
(cd $W/mats; make source > /dev/null 2>&1)
;;
esac
exit 0