forked from cisco/ChezScheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILDING
237 lines (175 loc) · 8.63 KB
/
BUILDING
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
Building Chez Scheme Version 9.5.1
Copyright 1984-2017 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.
----------------------------------------------------------------------------
This directory contains the sources for Chez Scheme, plus boot and header
files for various supported machine types.
BASICS
Building and installing Chez Scheme on a recent version of Linux or OS X
is typically as simple as installing the prerequisites listed below and
running (Windows build instructions appear under the heading WINDOWS
later in this file):
./configure
sudo make install
This should not take more than a minute or so, after which the commands
'scheme' and 'petite' can be used to run Chez Scheme and Petite Chez
Scheme, while 'man scheme' and 'man petite' can be used to view the
manual pages. Chez Scheme and Petite Chez Scheme are terminal-based
programs, not GUIs. They both incorporate sophisticated command-line
editing reminiscent of tcsh but with support for expressions that span
multiple lines.
Prerequisites:
* GNU Make
* gcc
* Header files and libraries for ncurses
* Header files and libraries for X windows
BUILDING VERSION 9.5 AND EARLIER
If the environment variable CHEZSCHEMELIBDIRS is set, please unset
it before running make. Depending on the variable's value, it can
cause the build process to fail.
DETAILS
The sources for Chez Scheme come in two parts:
* A set of Scheme source files found in the subdirectory s. Compiling
these produces the boot files petite.boot and scheme.boot, along with
two header files, equates.h and scheme.h.
* A set of C source files found in the subdirectory c. Compiling and
linking these files produces the executable scheme (scheme.exe under
Windows). Compiling the C sources requires the two header files
produced by compiling the Scheme sources.
Since the Scheme sources can be compiled only by a working version of
Chez Scheme, it's not actually possible to build Chez Scheme from source.
That's why the boot and header files are packaged with the sources.
'./configure' attempts to determine what type of machine it's on and,
if successful, creates several files and directories:
* The directory nanopass containing the Nanopass Infrastructure,
retrieved from github.
* A make file, Makefile, in the root (top level) directory.
* A "workarea", or subdirectory named for the machine type (e.g.,
a6le for nonthreaded 64-bit linux). The workarea is a mirror of
the root directory, with subdirectories named c, s, and so on.
Compilation takes place in the workarea.
* Within the workarea, the files Makefile, Mf-install, and Mf-boot.
'./configure' supports various options, among which is --help, which
can be used to list the supported options.
The make file supports several targets:
'make' or 'make build'
compiles and links the C sources to produce the executable, then
bootstraps the Scheme sources. Bootstrapping involves using the
freshly built scheme executable along with the distributed boot files
to compile the Scheme sources. If the new boot files are equivalent
to the old boot files, the system is bootstrapped. Otherwise, the new
boot files are used to create a newer set, and those are compared.
If this succeeds, the system is bootstrapped. Otherwise, the make
fails. This should not fail unless the distributed boot files are
out of sync with the sources.
To run Chez Scheme without installing, you need to tell the executable
where to find the boot files. This can be done via command-line
arguments, e.g.:
$W/bin/$M/scheme -b $W/boot/$M/petite.boot -b $W/boot/$M/scheme.boot
or by setting the SCHEMEHEAPDIRS variable to point to the directory
containing the boot files. For example, in bash:
SCHEMEHEAPDIRS=$W/boot/$M $W/bin/$M/scheme
and in tcsh:
setenv SCHEMEHEAPDIRS "$W/boot/$M"
$W/bin/$M/scheme
In all cases, $W should be replaced with the name of the workarea,
and $M should be replaced with the machine type. (Unless the default
is overridden via an argument to ./configure, $W is the same as $M.)
'sudo make install'
runs the build plus installs the resulting executable, boot files,
example files, and manual pages.
'make test'
runs the build plus runs a set of test programs in various different
ways, e.g., with different compiler options. It can take 30 minutes
or more, depending on the speed of the machine. It produces voluminous
output, so it's best to redirect its stdout and stderr to a file.
NB: A complete run does not imply no errors occurred. To check for
errors, look at the file $W/mats/summary, where $W is the name of the
workarea created by ./configure. $W/mats/summary should contain one
line per test run, something like this:
-------- o=0 --------
-------- o=3 --------
-------- o=0 cp0=t --------
-------- o=3 cp0=t --------
-------- o=0 spi=t p=t --------
-------- o=3 spi=t p=t --------
-------- o=0 eval=interpret --------
-------- o=3 eval=interpret --------
-------- o=0 cp0=t eval=interpret --------
-------- o=3 cp0=t eval=interpret --------
-------- o=0 ehc=t eoc=f --------
-------- o=3 ehc=t eval=interpret --------
If there is anything else in $W/mats/summary, something unexpected
occurred.
'make bootfiles'
runs the build plus uses the locally built system to recreate the
distributed boot and header files for each supported machine type.
It should be run whenever modifications made to the Scheme sources
are to be committed to the source-code repository so that up-to-date
boot and header files can be committed as well. 'make bootfiles'
can take 5 minutes or more.
'make bootfiles' builds boot files for each machine type for which
a subdirectory exists in the top-level boot directory. to build
for a supported machine type that isn't built by default, simply
add the appropriate subdirectory, i.e., 'mkdir boot/$M', where M
is the machine type, before running 'make bootfiles'. You can
also run '(cd $W ; make -f Mf-boot $M.boot)', where W is the name
of a built work area for the host machine type, to build just the
boot files for machine-type M.
'make clean'
removes binaries from the workarea.
'make distclean'
removes nanopass, Makefile, and all workareas.
WINDOWS
Building Chez Scheme under 64-bit Windows with Cygwin or Bash/WSL
follows the instructions above, except that 'make install' is not
supported, and the 'OS' environment variable must be set to
'Windows_NT' on Bash/WSL (to indicate a build for Windows, as opposed
to a build for Linux on Windows):
env OS=Windows_NT ./configure
env OS=Windows_NT make
Prerequisites:
* Cygwin or Bash/WSL with bash, grep, make, sed, etc.
* Microsoft Visual Studio 2017 or 2015
* WiX Toolset (for making an install)
To run Chez Scheme or Petite Chez Scheme from a Windows command prompt,
set PATH:
set PATH=$W\bin\$M;%PATH%
again with $W and $M replaced with the workarea name and machine
type, and start Chez Scheme with the command "scheme" or Petite
Chez with the command "petite".
The executables are dynamically linked against the Microsoft Visual
C++ run-time library vcruntime140.dll. If you distribute the
executables to a different system, be sure to include the
redistributable run-time library.
Making an Install for Windows
cd wininstall
make workareas
make
This will create workareas and compile binaries for the a6nt, i3nt,
ta6nt, and ti3nt configurations and then include them in a single
Windows installer package Chez Scheme.msi. The package also includes
example files and the redistributable Microsoft Visual C++ run-time
libraries.
Testing under Windows
The iconv tests in mats/io.ms require that a 32-bit or 64-bit (as
appropriate) iconv.dll, libiconv.dll, or libiconv-2.dll implementing
GNU libiconv be located in $W\bin\$M or the path. Windows sources for
libiconv can be found at:
http://gnuwin32.sourceforge.net/packages/libiconv.htm
An alternative that uses the Windows API can be found at:
https://github.com/win-iconv/win-iconv
If the DLL is not present, the iconv tests will fail. No other tests
should be affected.
Unset the TZ environment variable before running the tests, because
the Cygwin values are incompatible with the Microsoft C Runtime
Library.
Use 'make test' described above to run the tests.