Skip to content

Commit

Permalink
Merge branch 'bsd'
Browse files Browse the repository at this point in the history
# Conflicts:
#	LOG
  • Loading branch information
Bob Burger committed Jul 25, 2019
2 parents 8bf1e18 + 2649600 commit b6f861e
Show file tree
Hide file tree
Showing 64 changed files with 786 additions and 214 deletions.
91 changes: 80 additions & 11 deletions BUILDING
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Prerequisites:

* GNU Make
* gcc
* Header files and libraries for ncurses
* Header files and libraries for X windows
* Header files and libraries for ncurses [unless --disable-curses]
* Header files and libraries for X windows [unless --disable-x11]
* Header files and libraries for uuid

Uninstalling on Unix-like systems is as simple as running:
Expand Down Expand Up @@ -75,7 +75,7 @@ That's why the boot and header files are packaged with the sources.
if successful, creates several files and directories:

* The directory nanopass containing the Nanopass Infrastructure,
retrieved from github.
retrieved from GitHub.

* A make file, Makefile, in the root (top level) directory.

Expand Down Expand Up @@ -117,9 +117,18 @@ The make file supports several targets:
Set SCHEMEHEAPDIRS to /usr/lib/csv%v/%m:/usr/local/lib/csv%v/%m on
Unix-like systems and to %x/../../boot/%m on Windows systems.

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.:
Alternatively, if you have a build before the changes at full path
<orig>, use

make from-orig ORIG=<orig>

To run Chez Scheme without installing, you need to tell the
executable where to find the boot files. The run target of the
makefile will do that

make run

or this can be done manually via command-line arguments, e.g.:

$W/bin/$M/scheme -b $W/boot/$M/petite.boot -b $W/boot/$M/scheme.boot

Expand Down Expand Up @@ -194,15 +203,41 @@ The make file supports several targets:
'make distclean'
removes nanopass, Makefile, and all workareas.

OTHER UNIX VARIANTS

To build on Unix variants other than Linux and OS X, you will first
need to build boot files on a Linux or OS X machine. On that machine,
after building Chez Scheme, create boot files for the target machine
<machine> with:

make boot XM=<machine>

Copy the generated boot/<machine> directory to the target machine,
adding to or replacing the boot directory with pre-built boot files
there, and then build as on Linux.

Remember to use gmake if make is not GNU make. If you run into linker
trouble, try running configure with --libkernel so that the build
avoids running ld directly.

On OpenBSD, Chez Scheme must be built and installed on a filesystem
that is mounted with wxneeded.

On NetNSD, note that the makefiles run "paxctl +m" to enable WX pages
(i.e., pages that have both write and execute enabled).

WINDOWS

Building Chez Scheme under 64-bit Windows with Bash/WSL, MinGW/MSYS,
or Cygwin follows the instructions above, except that 'make install'
and 'make uninstall' are not supported. On Bash/WSL, the build
directory must be in a location with a Windows path such as /mnt/c,
and the 'OS' environment variable must be set to 'Windows_NT' to
indicate a build for Windows, as opposed to a build for Linux on
Windows:
and 'make uninstall' are not supported. Alternatively, the main Chez
Scheme executable can be built from the Windows command line or
cross-compiled using MinGW as described further below.

On Bash/WSL, the build directory must be in a location with a Windows
path such as /mnt/c, and the 'OS' environment variable must be set to
'Windows_NT' 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
Expand Down Expand Up @@ -267,3 +302,37 @@ the Cygwin values are incompatible with the Microsoft C Runtime
Library.

Use 'make test' described above to run the tests.

WINDOWS EXECUTABLE VIA COMMAND PROMPT

To build the Chez Scheme executable using Microsoft Visual Studio,
first set up command-line tools. The c\vs.bat script can help if you
supply amd64 for a 64-bit build or x86 for a 32-bit build:

c\vs.bat amd64

Then, run c\build/bat with a machine name, either ta6nt (64-bit
threaded), a6nt (64-bit non-threaded), ti3nt (32-bit threaded), or
i3nt (32-bit non-threaded):

c\build.bat ta6nt

The resulting executable in <machine>\bin\<machine> relies on
bootfiles in ..\boot\<machine> relative to the executable.

CROSS-COMPILING THE WINDOWS EXECUTABLE

To cross-compile the main Chez Scheme executable for Windows using
MinGW, specify suitable build tools to configure, perhaps using
--toolprefix= like this:

./configure -m=ta6nt --threads --toolprefix=x86_64-w64-mingw32-

Then, make with c/Mf-<machine> while supplying cross=t and o=o,
possibly like this:

(cd ta6nt/c && make -f Mf-ta6nt cross=t o=o)

The executable is written to <machine>/bin/<machine>, and it should be
installed with bootfiles in ../boot/<machine>/ relative to the
executable.
8 changes: 8 additions & 0 deletions LOG
Original file line number Diff line number Diff line change
Expand Up @@ -1375,3 +1375,11 @@
- fixed open-string-input-port on immutable strings
cpnanopass.ss, io.ms, release_notes.stex
- use setenv rather than putenv on non WIN32 environments
prim5.c, system.stex
- restore {Free,Open,Net}BSD build, support Windows cross-compile
via MinGW, add configuration options, and add helper makefile targets
expenditor.c, thread.c, stats.c, statics.c, scheme.c, main.c, types.h,
externs.h, globals.h, nocurses.h, version.h, system.h, segment.h,
a6ob.def, ta6ob.def, a6nb.def, ta6nb.def, i3nt.def, ti3nt.def,
c/Mf-*, build.bat, makefiles/Makefile.in, makefiles/Mf-install.in,
s/update-revision, BUILDING
8 changes: 4 additions & 4 deletions boot/i3nt/equates.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ typedef short I16;
typedef unsigned short U16;
typedef int I32;
typedef unsigned int U32;
typedef __int64 I64;
typedef unsigned __int64 U64;
typedef long long I64;
typedef unsigned long long U64;

/* constants from cmacros.ss */
#define $c_func_closure_index 0x4
Expand Down Expand Up @@ -682,14 +682,14 @@ typedef unsigned __int64 U64;
#define typed_object_type_disp 0x1
#define typedef_i16 "short"
#define typedef_i32 "int"
#define typedef_i64 "__int64"
#define typedef_i64 "long long"
#define typedef_i8 "char"
#define typedef_iptr "int"
#define typedef_ptr "void *"
#define typedef_string_char "unsigned int"
#define typedef_u16 "unsigned short"
#define typedef_u32 "unsigned int"
#define typedef_u64 "unsigned __int64"
#define typedef_u64 "unsigned long long"
#define typedef_u8 "unsigned char"
#define typedef_uptr "unsigned int"
#define typemod 0x8
Expand Down
8 changes: 4 additions & 4 deletions boot/i3nt/scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ EXPORT iptr Sinteger_value PROTO((ptr));
#define Sunsigned_value(x) (uptr)Sinteger_value(x)
EXPORT int Sinteger32_value PROTO((ptr));
#define Sunsigned32_value(x) (unsigned int)Sinteger32_value(x)
EXPORT __int64 Sinteger64_value PROTO((ptr));
#define Sunsigned64_value(x) (unsigned __int64)Sinteger64_value(x)
EXPORT long long Sinteger64_value PROTO((ptr));
#define Sunsigned64_value(x) (unsigned long long)Sinteger64_value(x)

/* Mutators */
EXPORT void Sset_box PROTO((ptr, ptr));
Expand Down Expand Up @@ -153,8 +153,8 @@ EXPORT ptr Sinteger PROTO((iptr));
EXPORT ptr Sunsigned PROTO((uptr));
EXPORT ptr Sinteger32 PROTO((int));
EXPORT ptr Sunsigned32 PROTO((unsigned int));
EXPORT ptr Sinteger64 PROTO((__int64));
EXPORT ptr Sunsigned64 PROTO((unsigned __int64));
EXPORT ptr Sinteger64 PROTO((long long));
EXPORT ptr Sunsigned64 PROTO((unsigned long long));

/* Miscellaneous */
EXPORT ptr Stop_level_value PROTO((ptr));
Expand Down
8 changes: 4 additions & 4 deletions boot/ti3nt/equates.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ typedef short I16;
typedef unsigned short U16;
typedef int I32;
typedef unsigned int U32;
typedef __int64 I64;
typedef unsigned __int64 U64;
typedef long long I64;
typedef unsigned long long U64;

/* constants from cmacros.ss */
#define $c_func_closure_index 0x4
Expand Down Expand Up @@ -682,14 +682,14 @@ typedef unsigned __int64 U64;
#define typed_object_type_disp 0x1
#define typedef_i16 "short"
#define typedef_i32 "int"
#define typedef_i64 "__int64"
#define typedef_i64 "long long"
#define typedef_i8 "char"
#define typedef_iptr "int"
#define typedef_ptr "void *"
#define typedef_string_char "unsigned int"
#define typedef_u16 "unsigned short"
#define typedef_u32 "unsigned int"
#define typedef_u64 "unsigned __int64"
#define typedef_u64 "unsigned long long"
#define typedef_u8 "unsigned char"
#define typedef_uptr "unsigned int"
#define typemod 0x8
Expand Down
8 changes: 4 additions & 4 deletions boot/ti3nt/scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ EXPORT iptr Sinteger_value PROTO((ptr));
#define Sunsigned_value(x) (uptr)Sinteger_value(x)
EXPORT int Sinteger32_value PROTO((ptr));
#define Sunsigned32_value(x) (unsigned int)Sinteger32_value(x)
EXPORT __int64 Sinteger64_value PROTO((ptr));
#define Sunsigned64_value(x) (unsigned __int64)Sinteger64_value(x)
EXPORT long long Sinteger64_value PROTO((ptr));
#define Sunsigned64_value(x) (unsigned long long)Sinteger64_value(x)

/* Mutators */
EXPORT void Sset_box PROTO((ptr, ptr));
Expand Down Expand Up @@ -153,8 +153,8 @@ EXPORT ptr Sinteger PROTO((iptr));
EXPORT ptr Sunsigned PROTO((uptr));
EXPORT ptr Sinteger32 PROTO((int));
EXPORT ptr Sunsigned32 PROTO((unsigned int));
EXPORT ptr Sinteger64 PROTO((__int64));
EXPORT ptr Sunsigned64 PROTO((unsigned __int64));
EXPORT ptr Sinteger64 PROTO((long long));
EXPORT ptr Sunsigned64 PROTO((unsigned long long));

/* Miscellaneous */
EXPORT ptr Stop_level_value PROTO((ptr));
Expand Down
13 changes: 8 additions & 5 deletions c/Mf-a6fb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ m = a6fb
Cpu = X86_64

mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm -lncurses
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Wextra -Werror -O ${CFLAGS}
o = o
mdsrc = i3le.c
Expand All @@ -31,11 +31,14 @@ mdobj = i3le.o

include Mf-base

${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}

${Scheme}: ${Kernel} ${Main}
$C -rdynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}

${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}

../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)
Expand Down
13 changes: 8 additions & 5 deletions c/Mf-a6le
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
m = a6le
Cpu = X86_64

mdclib = -lm -ldl -lncurses -lrt -luuid
mdclib = -lm -ldl ${ncursesLib} -lrt -luuid
C = ${CC} ${CPPFLAGS} -m64 -msse2 -Wpointer-arith -Wall -Wextra -Werror -Wno-implicit-fallthrough -O2 ${CFLAGS}
o = o
mdsrc = i3le.c
Expand All @@ -30,11 +30,14 @@ mdobj = i3le.o

include Mf-base

${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -melf_x86_64 -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -melf_x86_64 -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}

${Scheme}: ${Kernel} ${Main}
$C -rdynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}

${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}

../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)
Expand Down
12 changes: 8 additions & 4 deletions c/Mf-a6nb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ mdobj = i3le.o

include Mf-base

${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}

${Scheme}: ${Kernel} ${Main}
$C -rdynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}

${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}
paxctl +m ${Scheme}

../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)
Expand Down
28 changes: 27 additions & 1 deletion c/Mf-a6nt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ o = obj
mdobj=windows.$o
mdsrc=windows.c Makefile.$m cs.ico scheme.rc make.bat
mdclean=vs.bat make.bat scheme.res ../bin/$m/*.exp mtscheme.exe* mdscheme.exe*
cross=f

include Mf-base

${Scheme}: make.bat
${Scheme}${cross:f=}: make.bat
cmd.exe /c make.bat
cp ../bin/$m/scheme.exe ../bin/$m/petite.exe
cp ../bin/$m/scheme.pdb ../bin/$m/petite.pdb
Expand All @@ -34,3 +35,28 @@ make.bat: vs.bat
echo 'set MAKEFLAGS=' >> $@
echo 'vs.bat amd64 && nmake /f Makefile.$m /nologo %*' >> $@
chmod +x $@

# -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o

C = ${CC} ${CPPFLAGS} -O2 ${CFLAGS}

${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid

.c.$o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c

${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}

${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}

../zlib/configure.log:
echo "all:" >> ../zlib/Makefile
echo '\t$$(MAKE) -f win32/Makefile.gcc CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" RC="$(WINDRES)"' >> ../zlib/Makefile
touch ../zlib/configure.log

../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" ${MAKE} liblz4.a)
13 changes: 8 additions & 5 deletions c/Mf-a6ob
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ m = a6ob
Cpu = X86_64

mdinclude = -I/usr/local/include -I/usr/X11R6/include
mdclib = -L/usr/local/lib -liconv -lm -lncurses
mdclib = -L/usr/local/lib -liconv -lm ${ncursesLib} -lossp-uuid
C = ${CC} ${CPPFLAGS} -Wpointer-arith -Werror -O ${CFLAGS}
o = o
mdsrc = i3le.c
Expand All @@ -31,11 +31,14 @@ mdobj = i3le.o

include Mf-base

${Kernel}: ${kernelobj} ${zlibDep} ${LZ4Dep}
ld -r -X -o ${Kernel} ${kernelobj} ${zlibLib} ${LZ4Lib}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}

${Scheme}: ${Kernel} ${Main}
$C -rdynamic -Wl,--export-dynamic -o ${Scheme} ${Kernel} ${Main} ${mdclib} ${LDFLAGS}
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}

${Scheme}: ${Kernel} ${KernelLinkDeps} ${Main}
$C -rdynamic -Wl,--export-dynamic -Wl,-zwxneeded -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS}

../zlib/configure.log:
(cd ../zlib; CFLAGS="${CFLAGS} -m64" ./configure --64)
Expand Down
Loading

0 comments on commit b6f861e

Please sign in to comment.