From 1edcb9b62a1a520eddae8403c19d841c9b18737f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:24 -0800 Subject: Import Upstream version 5b3 --- build.scm | 702 +++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 462 insertions(+), 240 deletions(-) (limited to 'build.scm') diff --git a/build.scm b/build.scm index 557a5ab..bf40fc2 100755 --- a/build.scm +++ b/build.scm @@ -1,7 +1,7 @@ #!/bin/sh -type;exec scmlit -f $0 -e"(bi)" build $* -;;; "build.scm" Build database and program -*-scheme-*- -;;; Copyright (C) 1994, 1995, 1996 Aubrey Jaffer. +:;exec ./scmlit -f $0 -e"(bi)" build $* +;;; "build.scm" Build database and program +;;; Copyright (C) 1994, 1995, 1996, 1997 Aubrey Jaffer. ;;; See the file `COPYING' for terms applying to this program. (require 'getopt) @@ -13,6 +13,7 @@ type;exec scmlit -f $0 -e"(bi)" build $* (require 'batch) (batch:initialize! build) +(set! OPEN_WRITE "w") ; Because MS-DOS scripts need ^M (define-tables build @@ -24,6 +25,8 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-header) (scheme) (vax-asm) + (gnu-as) + (gdb-init) (cray-asm) (makefile) (MS-DOS-batch) @@ -33,12 +36,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* '(file-categories ((category symbol)) ((documentation string)) - ((documentation "Documentation file (or source for)") - (required "File required for building executable SCM") - (optional "File required for some feature") - (linkable "File whose object can be dynamically linked") - (test "File to test SCM") - (none "No files"))) + ((documentation "documentation") + (platform-specific "required for certain platforms") + (required "required for building executable SCM") + (optional "required for some feature") + (linkable "required and can be dynamically linked") + (test "test SCM") + (none "no files"))) '(build-whats ((name symbol)) @@ -51,16 +55,16 @@ type;exec scmlit -f $0 -e"(bi)" build $* "executable program") (lib required compile-c-files make-archive ((define "RTL")) "library module") - (dlls linkable compile-dll-c-files make-dll-archive ((define "RTL")) + (dlls linkable compile-dll-c-files make-dll-archive ((define "DLL")) "archived dynamically linked library object files") - (dll none compile-dll-c-files make-nothing #f + (dll none compile-dll-c-files update-catalog ((define "DLL")) "dynamically linked library object file"))) '(manifest - ((file string)) - ((format file-formats) - (category file-categories) - (documentation string)) + ((file string) + (format file-formats) + (category file-categories)) + ((documentation string)) (("README" plaintext documentation "contains a MANIFEST, INSTALLATION INSTRUCTIONS, hints for EDITING SCHEME CODE, and a TROUBLE SHOOTING GUIDE.") ("COPYING" plaintext documentation "details the LACK OF WARRANTY for SCM and the conditions for distributing SCM.") ("scm.1" nroff documentation "unix style man page.") @@ -75,12 +79,16 @@ type;exec scmlit -f $0 -e"(bi)" build $* ("bench.scm" Scheme test "computes and records performance statistics of pi.scm.") ("Makefile" Makefile required "builds SCMLIT using the `make' program.") ("build.scm" Scheme required "database for compiling and linking new SCM programs.") - ("build.bat" MS-DOS-batch optional "invokes build.scm for MS-DOS") - ("setjump.mar" Vax-asm optional "provides setjmp and longjmp which do not use $unwind utility on VMS.") - ("setjump.s" Cray-asm optional "provides setjmp and longjmp for the Cray YMP.") + ("build.bat" MS-DOS-batch platform-specific "invokes build.scm for MS-DOS") + ("mkimpcat.scm" Scheme required "build SCM-specific catalog for SLIB.") + (".gdbinit" gdb-init optional "provides commands for debugging SCM with GDB") + ("setjump.mar" Vax-asm platform-specific "provides setjump and longjump which do not use $unwind utility on VMS.") + ("ugsetjump.s" gnu-as platform-specific "provides setjump and longjump which work on Ultrix VAX.") + ("setjump.s" Cray-asm platform-specific "provides setjump and longjump for the Cray YMP.") ("Init.scm" Scheme required "Scheme initialization.") ("Transcen.scm" Scheme required "inexact builtin procedures.") ("Link.scm" Scheme required "compiles and dynamically links.") + ("Macro.scm" Scheme required "Supports R4RS Macros.") ("scmfig.h" c-header required "contains system dependent definitions.") ("patchlvl.h" c-header required "patchlevel of this release.") ("setjump.h" c-header required "continuations, stacks, and memory allocation.") @@ -89,6 +97,7 @@ type;exec scmlit -f $0 -e"(bi)" build $* ("scm.h" c-header required "data type and external definitions of SCM.") ("scm.c" c-source required "top level, interrupts, and non-IEEE utility functions.") ("findexec.c" c-source required "find the executable file function.") + ("script.c" c-source required "utilities for running as `#!' script.") ("time.c" c-source required "functions dealing with time.") ("repl.c" c-source required "error, read-eval-print loop, read, write and load.") ("scl.c" c-source required "inexact arithmetic") @@ -111,11 +120,14 @@ type;exec scmlit -f $0 -e"(bi)" build $* ("posix.c" c-source linkable "posix library interface.") ("unix.c" c-source linkable "non-posix system calls on unix systems.") ("socket.c" c-source linkable "BSD socket interface.") - ("pre-crt0.c" c-source optional "loaded before crt0.o on machines which do not remap part of the data space into text space in unexec.") - ("ecrt0.c" c-source optional "standard Vax 4.2 Unix crt0.c cannot be used because it makes `envron' an initialized variable.") - ("gmalloc.c" c-source optional "Gnu malloc().") - ("unexec.c" c-source optional "Convert a running program into an a.out file.") - ("unexelf.c" c-source optional "Convert a running ELF program into an a.out file.") + ("pre-crt0.c" c-source platform-specific "loaded before crt0.o on machines which do not remap part of the data space into text space in unexec.") + ("ecrt0.c" c-source platform-specific "discover the start of initialized data space dynamically at runtime.") + ("gmalloc.c" c-source platform-specific "Gnu malloc(); used for unexec.") + ("unexec.c" c-source platform-specific "Convert a running program into an executable file.") + ("unexhp9k800.c" c-source platform-specific "Convert a running HP-UX program into an executable file.") + ("unexelf.c" c-source platform-specific "Convert a running ELF program into an executable file.") + ("unexalpha.c" c-source platform-specific "Convert a running program into an Alpha executable file.") + ("unexsunos4.c" c-source platform-specific "Convert a running program into an executable file.") ))) (for-each (build 'add-domain) @@ -131,6 +143,7 @@ type;exec scmlit -f $0 -e"(bi)" build $* ((*unknown* #f) (8086 #f) (acorn #f) + (alpha #f) (cray #f) (hp-risc #f) (i386 8086) @@ -157,25 +170,31 @@ type;exec scmlit -f $0 -e"(bi)" build $* ((*unknown* *unknown* unix *unknown*) (acorn-unixlib acorn *unknown* *unknown*) (aix powerpc aix *unknown*) + (alpha alpha osf1 cc) + (alpha-elf alpha unix *unknown*) + (alpha-linux alpha linux gcc) (amiga-aztec m68000 amiga aztec) (amiga-dice-c m68000 amiga dice-c) + (amiga-gcc m68000 amiga gcc) (amiga-sas/c-5.10 m68000 amiga sas/c) (atari-st-gcc m68000 atari.st gcc) (atari-st-turbo-c m68000 atari.st turbo-c) (borland-c-3.1 8086 ms-dos borland-c) (djgpp i386 ms-dos gcc) + (freebsd i386 unix cc) (gcc *unknown* unix gcc) (highc.31 i386 ms-dos highc) (hp-ux hp-risc hp-ux *unknown*) - (linux-aout i386 linux gcc) (linux i386 linux gcc) + (linux-aout i386 linux gcc) (microsoft-c 8086 ms-dos microsoft-c) (microsoft-c-nt i386 ms-dos microsoft-c) (microsoft-quick-c 8086 ms-dos microsoft-quick-c) (ms-dos 8086 ms-dos *unknown*) (os/2-cset i386 os/2 C-Set++) (os/2-emx i386 os/2 gcc) - (sun sparc sun-os *unknown*) + (sun-svr4-gcc-sunld sparc sunos gcc) + (sunos sparc sunos *unknown*) (svr4 *unknown* unix *unknown*) (turbo-c-2 8086 ms-dos turbo-c) (unicos cray unicos *unknown*) @@ -191,17 +210,18 @@ type;exec scmlit -f $0 -e"(bi)" build $* ((compiler-flags string) (link-lib-flag string) (lib-path optstring) - (supress-files expression)) + (lib-support expression)) ((m *unknown* "" "-lm" "/usr/lib/libm.a" ()) (c *unknown* "" "-lc" "/usr/lib/libc.a" ()) - (regex *unknown* "" "-lrgx" "/usr/lib/librgx.a" ()) + (regex *unknown* "" "-lregex" "/usr/lib/libregex.a" ()) (curses *unknown* "" "-lcurses" "/usr/lib/libcurses.a" ()) (graphics *unknown* "-I/usr/X11/include -DX11" "-lX11" "/usr/X11/lib/libX11.sa" ()) - (editline *unknown* "" "-ledit" "/usr/lib/libedit.a" ()) + (editline *unknown* "" "-lreadline" "/usr/lib/libreadline.a" ()) (termcap *unknown* "" "-ltermcap" "/usr/lib/libtermcap.a" ()) (debug *unknown* "-g" "-g" #f ()) + (socket *unknown* "" "" #f ()) (m linux-aout "" "-lm" "/usr/lib/libm.sa" ()) (c linux-aout "" "-lc" "/usr/lib/libc.sa" ()) @@ -209,8 +229,8 @@ type;exec scmlit -f $0 -e"(bi)" build $* (regex linux-aout "" "" "" ()) (curses linux-aout "-I/usr/include/ncurses" "-lncurses" "/usr/lib/libncurses.a" ()) - (nostart linux-aout "" "-nostartfiles" #f ("ecrt0.c")) - (dump linux-aout "" "/usr/lib/crt0.o" #f ("unexelf.c")) + (nostart linux-aout "" "-nostartfiles" #f ("pre-crt0.c")) + (dump linux-aout "" "/usr/lib/crt0.o" #f ("unexec.c" "gmalloc.c")) (m linux "" "-lm" "/lib/libm.so" ()) (c linux "" "-lc" "/lib/libc.so" ()) @@ -218,11 +238,14 @@ type;exec scmlit -f $0 -e"(bi)" build $* (graphics linux "-I/usr/include/X11 -DX11" "-L/usr/X11R6/lib -lX11" "/usr/X11R6/lib/libX11.so" ()) (curses linux "" "-lcurses" "/lib/libncurses.so" ()) - (nostart linux "" "" #f ("pre-crt0.c" "ecrt0.c")) - (dump linux "" "" #f ("unexec.c")) + (nostart linux "" "" #f ()) + (dump linux "" "" #f ("unexelf.c" "gmalloc.c")) (m acorn-unixlib "" "" #f ()) + (nostart alpha "" "-non_shared" #f ("pre-crt0.c")) + (dump alpha "" "" #f ("unexalpha.c")) + (m amiga-dice-c "" "-lm" #f ()) (m amiga-SAS/C-5.10 "" "lcmieee.lib" #f ()) (c amiga-SAS/C-5.10 "" "lc.lib" #f ()) @@ -233,21 +256,37 @@ type;exec scmlit -f $0 -e"(bi)" build $* (m atari-st-gcc "" "-lpml" #f ()) (m atari-st-turbo-c "" "" #f ()) - (m sun "" "-lm" #f ()) - (dlll sun "-DSUN_DL" "-ldl" #f ()) - (nostart sun "" "-e __start -nostartfiles -static" #f ("pre-crt0.c")) - (dump sun "" "" #f ("unexec.c")) + (m sunos "" "-lm" #f ()) + (dlll sunos "-DSUN_DL" "-ldl" #f ()) + (nostart sunos "" "-e __start -nostartfiles -static" #f ("ecrt0.c")) + (dump sunos "" "" #f ("unexelf.c" "gmalloc.c")) + + (m sun-svr4-gcc-sunld "" "-lm" #f ()) + (dlll sun-svr4-gcc-sunld "-DSUN_DL" "-Wl,-ldl" #f ()) + (nostart sun-svr4-gcc-sunld "" "-e __start -nostartfiles" #f ("ecrt0.c")) + (dump sun-svr4-gcc-sunld "" "" #f ("unexelf.c" "gmalloc.c")) + (socket sun-svr4-gcc-sunld "" "-lsocket -lnsl" #f ()) + (regex sun-svr4-gcc-sunld "" "" #f ()) + + (nostart gcc "" "-e __start -nostartfiles" #f ("ecrt0.c")) + (dump gcc "" "" #f ("unexelf.c" "gmalloc.c")) (m hp-ux "" "-lm" #f ()) (dlll hp-ux "-DHAVE_DYNL" "-Wl,-E -ldld" #f ()) (graphics hp-ux "-DX11" "-lX" "/usr/lib/X11R5/libX11.sl" ()) + (nostart hp-ux "" "" #f ("ecrt0.c")) + (dump hp-ux "" "" #f ("unexhp9k800.c" "gmalloc.c")) (c djgpp "" "-lc" #f ("findexec.c")) (curses djgpp "-I/djgpp/contrib/pdcurses/include/" "-L/djgpp/contrib/pdcurses/lib/ -lcurses" "\\djgpp\\contrib\\pdcurses\\lib\\libcurse.a" ()) - (nostart djgpp "" "-nostartfiles" #f ("ecrt0.c")) - (dump djgpp "" "c:/djgpp/lib/crt0.o" #f ("unexelf.c")) + (nostart djgpp "" "-nostartfiles" #f ("pre-crt0.c")) + (dump djgpp "" "c:/djgpp/lib/crt0.o" #f ("unexec.c" "gmalloc.c")) +;;; (nostart djgpp "" "" #f ("ecrt0.c")) +;;; (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c")) +;;; (nostart djgpp "" "-e __start -nostartfiles -static" #f ("ecrt0.c")) +;;; (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c")) (c Microsoft-C "" "" #f ("findexec.c")) (m Microsoft-C "" "" #f ()) @@ -268,6 +307,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c highc.31 "" "" #f ("findexec.c")) (m highc.31 "" "" #f ()) (windows highc.31 "-Hwin" "-Hwin" #f ()) + + (m freebsd "" "-lm" #f ()) + (regex freebsd "" "-lgnuregex" "" ()) + (editline freebsd "" "-lreadline" "" ()) + (dlll freebsd "-DSUN_DL" "" "" ()) + (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c")) + (dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c")) )) '(compile-commands @@ -284,10 +330,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (if (member '(define "FLOATS" #t) (c-defines parms)) "" "-f-") + (include-spec "-I" parms) (c-includes parms) (c-flags parms) (string-append "@" rsp-name)) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Borland-C-3.1 (lambda (oname objects libs parms) (define lnk-name (string-append oname ".lnk")) @@ -305,13 +354,18 @@ type;exec scmlit -f $0 -e"(bi)" build $* (batch:system parms "tcc" "-c" "-d" "-O" "-Z" "-G" "-ml" "-c" "-Ic:\\turboc\\include" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Turbo-C-2 (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) ".obj" ".exe") + #\\)) (oexe (string-append oname ".exe"))) (if (not (string-ci=? exe oexe)) (batch:delete-file parms oexe)) @@ -325,13 +379,18 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "cl" "-c" "Oxp" "-AH" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Microsoft-C (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) ".obj" ".exe") + #\\)) (oexe (string-append oname ".exe"))) (if (not (string-ci=? exe oexe)) (batch:delete-file parms oexe)) @@ -348,26 +407,31 @@ type;exec scmlit -f $0 -e"(bi)" build $* (compile-c-files Microsoft-C-nt (lambda (files parms) (batch:system parms - "cl" "-c" + "cl" "-c" "-nologo" "-O2" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Microsoft-C-nt (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) ".obj" ".exe") + #\\)) (oexe (string-append oname ".exe"))) - (if (not (string-ci=? exe oexe)) - (batch:delete-file parms oexe)) +; (if (not (string-ci=? exe oexe)) +; (batch:delete-file parms oexe)) (batch:system parms - "link" + "link" "/nologo" (string-append "/out:" oexe) (apply string-join " " (map (lambda (o) (replace-suffix o ".obj" "")) objects)) libs) - (if (not (string-ci=? exe oexe)) - (batch:rename-file parms exe oexe)) +; (if (not (string-ci=? exe oexe)) +; (batch:rename-file parms exe oexe)) oexe))) (compile-c-files Microsoft-Quick-C @@ -377,7 +441,9 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Microsoft-Quick-C (lambda (oname objects libs parms) (define crf-name (string-append oname ".crf")) @@ -403,11 +469,15 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program Watcom-9.0 (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) - ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) + ".obj" ".exe") + #\\)) (oexe (string-append oname ".exe"))) (if (not (string-ci=? exe oexe)) (batch:delete-file parms oexe)) @@ -427,11 +497,14 @@ type;exec scmlit -f $0 -e"(bi)" build $* (define hcc-name "temp.hcc") (apply batch:lines->file parms hcc-name files) (batch:system parms - "\\hi_c\\hc386.31\\bin\\hc386" + "d:\\hi_c\\hc386.31\\bin\\hc386" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) "-c" (string-append "@" hcc-name)) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program highc.31 (lambda (oname objects libs parms) (let ((oexe (string-append oname ".exe"))) @@ -439,10 +512,10 @@ type;exec scmlit -f $0 -e"(bi)" build $* (apply batch:lines->file parms lnk-name (append libs objects)) (batch:system parms - "\\hi_c\\hc386.31\\bin\\hc386" "-o" oname + "d:\\hi_c\\hc386.31\\bin\\hc386" "-o" oname (string-append "@" lnk-name)) (batch:system parms - "bind386" "/hi_c/pharlap.51/run386b.exe" oname + "bind386" "d:/hi_c/pharlap.51/run386b.exe" oname "-exe" oexe) oexe))) @@ -451,9 +524,12 @@ type;exec scmlit -f $0 -e"(bi)" build $* (batch:apply-chop-to-fit batch:try-system parms "gcc" "-Wall" "-O2" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + "\\/"))) (link-c-program djgpp (lambda (oname objects libs parms) (let ((exe (string-append oname ".exe"))) @@ -470,30 +546,32 @@ type;exec scmlit -f $0 -e"(bi)" build $* (batch:apply-chop-to-fit batch:try-system parms "ar" "r" arname objects) - (batch:system - parms "gcc" "-o" oname - (must-be-first - '("-nostartfiles" - "pre-crt0.o" "ecrt0.o" - "c:/djgpp/lib/crt0.o") - (cons arname libs)))) + (and + (batch:system + parms "gcc" "-o" oname + (must-be-first + '("-nostartfiles" + "pre-crt0.o" "ecrt0.o" "c:/djgpp/lib/crt0.o") + (cons arname libs))) + (batch:delete-file parms arname))) (slib:error 'build "couldn't build archive")) - (batch:system parms "strip" oname) - (batch:delete-file parms exe) - (batch:system parms - "coff2exe" "-s" - "c:\\djgpp\\bin\\go32.exe" - oname) + (batch:system parms "strip" exe) + (batch:delete-file parms oname) + ;;(batch:delete-file parms exe) + ;;(batch:system parms "coff2exe" "-s" "c:\\djgpp\\bin\\go32.exe" oname) exe))) (compile-c-files os/2-emx (lambda (files parms) (batch:system parms "gcc" "-O" "-m386" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\\))) (link-c-program os/2-emx (lambda (oname objects libs parms) (batch:system parms @@ -505,10 +583,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "icc.exe" "/Gd-" "/Ge+" "/Gm+" "/Q" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + #\\))) (link-c-program os/2-cset (lambda (oname objects libs parms) (batch:system parms @@ -520,10 +601,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "cc" "+O1" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (compile-dll-c-files HP-UX (lambda (files parms) (batch:system parms @@ -531,7 +615,7 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) files) - (for-each + (map (lambda (fname) (batch:rename-file parms (string-append fname ".sl") @@ -539,32 +623,39 @@ type;exec scmlit -f $0 -e"(bi)" build $* (batch:system parms "ld" "-b" "-o" (string-append fname ".sl") - (string-append fname ".o"))) - (replace-suffix files ".c" "")) - (replace-suffix files ".c" ".sl"))) + (string-append fname ".o")) + (string-append fname ".sl")) + (truncate-up-to + (replace-suffix files ".c" "") + #\/)))) ; (make-dll-archive HP-UX ; (lambda (oname objects libs parms) ; (batch:system parms ; "ld" "-b" "-o" (string-append oname ".sl") ; objects) +; (rebuild-catalog) ; (string-append oname ".sl"))) - (make-dll-archive sun + (make-dll-archive sunos (lambda (oname objects libs parms) (batch:system parms "ld" "-assert" "pure-text" "-o" (string-append oname ".so.1.0") objects) + (rebuild-catalog) (string-append oname ".so.1.0"))) (compile-c-files linux-aout (lambda (files parms) (batch:system parms "gcc" "-Wall" "-O2" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (compile-dll-c-files linux-aout (lambda (files parms) (batch:system parms @@ -572,18 +663,24 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) ;;; (make-dll-archive linux-aout ;;; (lambda (oname objects libs parms) #t +;;; (rebuild-catalog) ;;; oname)) (compile-c-files linux (lambda (files parms) (batch:system parms "gcc" "-O2" "-c" (c-includes parms) + (include-spec "-I" parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (compile-dll-c-files linux (lambda (files parms) (batch:system parms @@ -596,15 +693,17 @@ type;exec scmlit -f $0 -e"(bi)" build $* (map (lambda (l) (build:lib-ld-flag l platform)) (parameter-list-ref parms 'c-lib)))) - (for-each + (map (lambda (fname) (batch:system parms "gcc" "-shared" "-o" (string-append fname ".so") (string-append fname ".o") - ld-opts)) - (replace-suffix files ".c" ""))) - (replace-suffix files ".c" ".so"))) + ld-opts) + (string-append fname ".so")) + (truncate-up-to + (replace-suffix files ".c" "") + #\/))))) (make-dll-archive linux (lambda (oname objects libs parms) (let ((platform (car (parameter-list-ref @@ -616,6 +715,7 @@ type;exec scmlit -f $0 -e"(bi)" build $* objects (map (lambda (l) (build:lib-ld-flag l platform)) (parameter-list-ref parms 'c-lib)))) + (rebuild-catalog) (string-append oname ".so"))) (link-c-program linux (lambda (oname objects libs parms) @@ -630,10 +730,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "cc" "-hvector2" "-hscalar2" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program Unicos (lambda (oname objects libs parms) (batch:system parms @@ -644,11 +747,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "gcc" "-Wall" "-O2" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) - + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program gcc (lambda (oname objects libs parms) (batch:rename-file parms @@ -662,23 +767,53 @@ type;exec scmlit -f $0 -e"(bi)" build $* (append objects libs))) oname)) + (compile-c-files sun-svr4-gcc-sunld + (lambda (files parms) + (batch:system parms + "gcc" "-Wall" "-O2" "-c" + (include-spec "-I" parms) + (c-includes parms) + (c-flags parms) + files) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) + (link-c-program sun-svr4-gcc-sunld + (lambda (oname objects libs parms) + (batch:rename-file parms + oname (string-append oname "~")) + (batch:system parms + "gcc" "-o" oname + (must-be-first + '("-nostartfiles" + "pre-crt0.o" "ecrt0.o" + "/usr/lib/crt0.o") + (append objects libs))) + oname)) + (compile-c-files svr4 (lambda (files parms) (batch:system parms "cc" "-O" "-DSVR4" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (compile-c-files aix (lambda (files parms) (batch:system parms "cc" "-O" "-Dunix" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program aix (lambda (oname objects libs parms) (batch:system parms @@ -689,10 +824,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "cc" "-dAMIGA" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program amiga-aztec (lambda (oname objects libs parms) (batch:system parms @@ -703,11 +841,14 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "lc" "-d3" "-M" "-fi" "-O" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) (batch:system parms "blink with link.amiga NODEBUG") - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program amiga-SAS/C-5.10 (lambda (oname objects libs parms) (define lnk-name "link.amiga") @@ -732,10 +873,15 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "dcc" "-r" "-gs" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) - files "-o" (replace-suffix files ".c" ".o")) - (replace-suffix files ".c" ".o"))) + files "-o" (truncate-up-to + (replace-suffix files ".c" ".o") + #\/)) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program amiga-dice-c (lambda (oname objects libs parms) (batch:system parms @@ -746,10 +892,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "gcc" "-v" "-O" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program atari-st-gcc (lambda (oname objects libs parms) (batch:system parms @@ -761,10 +910,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "tcc" "-P" "-W-" "-Datarist" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program atari-st-turbo-c (lambda (oname objects libs parms) (batch:system parms @@ -778,10 +930,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (batch:system parms "cc" "-c" "-depend" "!Depend" "-IUnixLib:" "-pcc" "-Dunix" "-DSVR3" "-DARM_ULIB" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + #\/))) (link-c-program acorn-unixlib (lambda (oname objects libs parms) (batch:system parms @@ -798,11 +953,15 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) (replace-suffix files ".c" "")) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + "/]"))) (link-c-program vms (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) - ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) + ".obj" ".exe") + "/]")) (oexe (string-append oname ".exe"))) (batch:system parms "macro" "setjump") @@ -824,14 +983,19 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "gcc" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) (replace-suffix files ".c" "")) - (replace-suffix files ".c" ".obj"))) + (truncate-up-to + (replace-suffix files ".c" ".obj") + "/]"))) (link-c-program vms-gcc (lambda (oname objects libs parms) - (let ((exe (replace-suffix (car objects) - ".obj" ".exe")) + (let ((exe (truncate-up-to + (replace-suffix (car objects) + ".obj" ".exe") + "/]")) (oexe (string-append oname ".exe"))) (batch:system parms "macro" "setjump") @@ -853,10 +1017,13 @@ type;exec scmlit -f $0 -e"(bi)" build $* (lambda (files parms) (batch:system parms "cc" "-O" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + "\\/]"))) (link-c-program *unknown* (lambda (oname objects libs parms) (batch:rename-file parms @@ -872,10 +1039,8 @@ type;exec scmlit -f $0 -e"(bi)" build $* (make-archive *unknown* (lambda (oname objects libs parms) (let ((aname (string-append oname ".a"))) - (batch:system parms - "ar rc" aname objects) - (batch:system parms - "ranlib" aname) + (batch:system parms "ar rc" aname objects) + (batch:system parms "ranlib" aname) aname))) (compile-dll-c-files *unknown* (lambda (files parms) @@ -884,7 +1049,9 @@ type;exec scmlit -f $0 -e"(bi)" build $* (c-includes parms) (c-flags parms) files) - (replace-suffix files ".c" ".o"))) + (truncate-up-to + (replace-suffix files ".c" ".o") + "\\/]"))) (make-dll-archive *unknown* (lambda (oname objects libs parms) (let ((aname (string-append oname ".a"))) @@ -892,11 +1059,59 @@ type;exec scmlit -f $0 -e"(bi)" build $* "ar rc" aname objects) (batch:system parms "ranlib" aname) + (rebuild-catalog) aname))) - (make-nothing *unknown* - (lambda (oname objects libs parms) - (if (= 1 (length objects)) (car objects) - objects))) + (update-catalog *unknown* + (lambda (oname objects libs parms) + (rebuild-catalog) + (if (= 1 (length objects)) (car objects) + objects))) + + (compile-c-files freebsd + (lambda (files parms) + (batch:system parms + "cc" "-O" "-Dfreebsd" "-c" + (c-includes parms) + (c-flags parms) + files) + (replace-suffix files ".c" ".o"))) + (link-c-program freebsd + (lambda (oname objects libs parms) + (batch:rename-file parms + oname (string-append oname "~")) + (batch:system parms + "cc" "-o" oname + (must-be-first + '("-nostartfiles" + "pre-crt0.o" "crt0.o" + "/usr/lib/crt0.o") + (append objects libs))) + oname)) + (compile-dll-c-files freebsd + (lambda (files parms) + (batch:system parms + "cc" "-O" "-fpic" "-c" + "-Dfreebsd" + (string-append "-I" (implementation-vicinity)) + (c-includes parms) + (c-flags parms) + files) + (let ((objs (replace-suffix files ".c" ".o"))) + (map (lambda (f) + (batch:system parms "ld" "-Bshareable" f) + (batch:system parms "mv" "a.out" f)) + objs) + objs))) + + (make-dll-archive freebsd + (lambda (oname objects libs parms) + (batch:system parms + "ld" "-Bshareable" "-o" + (string-append oname ".so") + objects) + (rebuild-catalog) + (string-append oname ".so"))) + )) '(features @@ -936,6 +1151,10 @@ value of STACK_LIMIT to be the size to which SCM should allow the stack to grow. STACK_LIMIT should be less than the maximum size the hardware can support, as not every routine checks the stack.") + (macro ((define "MACRO") (features rev2-procedures record)) + "\ +R4RS-macros") + (bignums ((define "BIGNUMS")) "\ Large precision integers.") @@ -978,7 +1197,7 @@ Define SICP if you want to run code from: These procedures were specified in the `Revised^2 Report on Scheme' but not in `R4RS'.") - (record ((c-file "record.c") (init "init_record")) + (record ((define "CCLO") (c-file "record.c") (init "init_record")) "\ The Record package provides a facility for user to define their own record data types. See SLIB for documentation.") @@ -1019,7 +1238,7 @@ interface to the editline or GNU readline library") "\ String regular expression matching.") - (socket ((c-file "socket.c") (init "init_socket")) + (socket ((c-lib socket) (c-file "socket.c") (init "init_socket")) "\ BSD socket interface.") @@ -1041,14 +1260,7 @@ Microsoft Windows executable.") "\ Load compiled files while running.") - (dump ((define "CAN_DUMP") - (c-lib dump) - (c-lib nostart) - (c-file "unexec.c") - (c-file "unexelf.c") - (c-file "gmalloc.c") - (c-file "ecrt0.c") - (c-file "pre-crt0.c")) + (dump ((define "CAN_DUMP") (c-lib dump) (c-lib nostart)) "\ Convert a running scheme program into an executable file.") @@ -1074,11 +1286,6 @@ unusual stacks need this. Also, if you incorporate new C code into scm which uses VMS system services or library routines (which need to unwind the stack in an ordrly manner) you may need to define CHEAP_CONTINUATIONS.") - - (memoize-local-bindings ((define "MEMOIZE_LOCALS")) - "\ -Saves the interpeter from having to look up local bindings for every -identifier reference") )) '(build-params *parameter-columns* @@ -1107,19 +1314,13 @@ identifier reference") (11 what single build-whats (lambda (pl) '(exe)) (lambda (rdb) - (define tab (((rdb 'open-table) 'build-whats #f) 'get 'class)) - (define manifest ((((rdb 'open-table) 'manifest #f) - 'row:retrieve*))) - (lambda (what) - (define catgry (tab what)) - `((c-file - ,@(map car - (remove-if-not - (lambda (row) (and (eq? 'c-source (cadr row)) - (eq? catgry (caddr row)))) - manifest))) - ,@(or ((((rdb 'open-table) 'build-whats #f) 'get 'spec) what) - '())))) + (let* ((bwt ((rdb 'open-table) 'build-whats #f)) + (getclass (bwt 'get 'class)) + (getspec (bwt 'get 'spec)) + (getfile (((rdb 'open-table) 'manifest #f) 'get* 'file))) + (lambda (what) + `((c-file ,@(getfile #f 'c-source (getclass what))) + ,@(or (getspec what) '()))))) "what to build") (12 batch-dialect single batch-dialect guess-how @@ -1134,6 +1335,12 @@ identifier reference") "port batch file will be written to.") (18 c-defines nary expression #f #f "#defines for C") (19 c-includes nary expression #f #f "library induced defines for C") + (20 scm-srcdir single filename + (lambda (pl) (list (user-vicinity))) #f + "directory path for files in the manifest") + (21 scm-libdir single filename + (lambda (pl) (list (implementation-vicinity))) #f + "directory path for files in the manifest") )) '(build-pnames ((name string)) @@ -1153,6 +1360,8 @@ identifier reference") ("w" 13) ("script name" 13) ("compiler options" 14) ("linker options" 15) + ("scm srcdir" 20) + ("scm libdir" 21) )) '(*commands* @@ -1179,7 +1388,7 @@ identifier reference") (define build:c-libraries #f) (define build:lib-cc-flag #f) (define build:lib-ld-flag #f) -(define build:c-supress #f) +(define build:c-lib-support #f) (define plan-command #f) ;;; Look up command on a platform, but default to '*unknown* if not @@ -1191,105 +1400,109 @@ identifier reference") (let ((ans (getter thing platform))) (cond (ans ans) ((eq? '*unknown* platform) - (build:error "Couldn't find: " thing)) + (build:error "Couldn't find: " plat thing)) (else (look '*unknown*))))) (look plat))) -(define system:success? zero?) - (require 'alist) (require 'common-list-functions) (require 'object->string) -(define build:build - (lambda (rdb) - (lambda (parms) - (let ((expanders - (map (lambda (e) (and e (lambda (s) (e s)))) - (map (lambda (f) (if f ((slib:eval f) rdb) f)) - ((((rdb 'open-table) 'build-params #f) - 'get* 'expander)))))) - (parameter-list-expand expanders parms) - (set! parms - (fill-empty-parameters - (map slib:eval - ((((rdb 'open-table) 'build-params #f) - 'get* 'default))) - parms)) - (parameter-list-expand expanders parms)) - (let* ((platform (car (parameter-list-ref parms 'platform))) - (init= (apply string-append - (map (lambda (c) - (string-append c "();")) - (parameter-list-ref parms 'init)))) - (compiled-init= - (apply string-append - (map (lambda (c) - (string-append c "();")) - (parameter-list-ref parms 'compiled-init)))) - (c-defines - `((define "IMPLINIT" - ,(car (parameter-list-ref parms 'implinit))) - ,@(if (string=? "" init=) '() - `((define "INITS" ,init=))) - ,@(if (string=? "" compiled-init=) '() - `((define "COMPILED_INITS" ,compiled-init=))) - ,@(map (lambda (d) (if (pair? d) - `(define ,@d) - `(define ,d #t))) - (parameter-list-ref parms 'define)))) - (c-includes - (map (lambda (l) (build:lib-cc-flag l platform)) - (parameter-list-ref parms 'c-lib))) - (batch-dialect (car (parameter-list-ref parms 'batch-dialect))) - (what (car (parameter-list-ref parms 'what))) - (c-proc (plan-command ((((rdb 'open-table) 'build-whats #f) - 'get 'c-proc) - what) - platform))) - (adjoin-parameters! +(define (build:build rdb) + (lambda (parms) + (let ((expanders + (map (lambda (e) (and e (lambda (s) (e s)))) + (map (lambda (f) (if f ((slib:eval f) rdb) f)) + ((((rdb 'open-table) 'build-params #f) + 'get* 'expander)))))) + (parameter-list-expand expanders parms) + (set! parms + (fill-empty-parameters + (map slib:eval + ((((rdb 'open-table) 'build-params #f) + 'get* 'defaulter))) + parms)) + (parameter-list-expand expanders parms)) + (let* ((platform (car (parameter-list-ref parms 'platform))) + (init= (apply string-append + (map (lambda (c) + (string-append c "();")) + (parameter-list-ref parms 'init)))) + (compiled-init= + (apply string-append + (map (lambda (c) + (string-append c "();")) + (parameter-list-ref parms 'compiled-init)))) + (c-defines + `((define "IMPLINIT" + ,(car (parameter-list-ref parms 'implinit))) + ,@(if (string=? "" init=) '() + `((define "INITS" ,init=))) + ,@(if (string=? "" compiled-init=) '() + `((define "COMPILED_INITS" ,compiled-init=))) + ,@(map (lambda (d) (if (pair? d) + `(define ,@d) + `(define ,d #t))) + (parameter-list-ref parms 'define)))) + (c-includes + (map (lambda (l) (build:lib-cc-flag l platform)) + (parameter-list-ref parms 'c-lib))) + (batch-dialect (car (parameter-list-ref parms 'batch-dialect))) + (what (car (parameter-list-ref parms 'what))) + (c-proc (plan-command ((((rdb 'open-table) 'build-whats #f) + 'get 'c-proc) + what) + platform))) + (adjoin-parameters! + parms + (cons 'c-defines c-defines) + (cons 'c-includes c-includes) + ) + + (let ((name (car (parameter-list-ref parms 'who)))) + (batch:call-with-output-script parms - (cons 'c-defines c-defines) - (cons 'c-includes c-includes) - ) - - (let ((name (car (parameter-list-ref parms 'who)))) - (batch:call-with-output-script - parms - name - (lambda (batch-port) - (define o-files '()) - (adjoin-parameters! - parms - (list 'batch-port batch-port)) - - ;; ================ Write file with C defines - (apply batch:lines->file parms - "scmflags.h" - (defines->c-defines c-defines)) - - ;; ================ Compile C source files - (set! o-files - (let ((supressors - (apply append - (map (lambda (l) (build:c-supress l platform)) - (parameter-list-ref parms 'c-lib))))) - (c-proc (remove-if (lambda (file) (member file supressors)) - (parameter-list-ref parms 'c-file)) - parms))) - - ;; ================ Link C object files - ((plan-command - ((((rdb 'open-table) 'build-whats #f) 'get 'o-proc) what) - platform) - (car (parameter-list-ref parms 'target-name)) - (append o-files (parameter-list-ref parms 'o-file)) - (append - (parameter-list-ref parms 'linker-options) - (map (lambda (l) (build:lib-ld-flag l platform)) - (parameter-list-ref parms 'c-lib))) - parms)))))))) - + name + (lambda (batch-port) + (define o-files '()) + (adjoin-parameters! + parms + (list 'batch-port batch-port)) + + ;; ================ Write file with C defines + (apply batch:lines->file parms + "scmflags.h" + (defines->c-defines c-defines)) + + ;; ================ Compile C source files + (set! o-files + (c-proc + (map (lambda (file) + (in-vicinity + (car (parameter-list-ref parms 'scm-srcdir)) + file)) + (apply append + (parameter-list-ref parms 'c-file) + (map + (lambda (l) (build:c-lib-support l platform)) + (parameter-list-ref parms 'c-lib)))) + parms)) + + ;; ================ Link C object files + ((plan-command + ((((rdb 'open-table) 'build-whats #f) 'get 'o-proc) what) + platform) + (car (parameter-list-ref parms 'target-name)) + (append o-files (parameter-list-ref parms 'o-file)) + (append + (parameter-list-ref parms 'linker-options) + (map (lambda (l) (build:lib-ld-flag l platform)) + (parameter-list-ref parms 'c-lib))) + parms))))))) + +(define (include-spec str parms) + (let ((path (car (parameter-list-ref parms 'scm-srcdir)))) + (if (eqv? "" path) () (list str path)))) (define (c-defines parms) (parameter-list-ref parms 'c-defines)) (define (c-includes parms) @@ -1332,9 +1545,9 @@ identifier reference") (set! build:lib-ld-flag (make-defaulting-platform-lookup (build:c-libraries 'get 'link-lib-flag))) - (set! build:c-supress + (set! build:c-lib-support (make-defaulting-platform-lookup - (build:c-libraries 'get 'supress-files))) + (build:c-libraries 'get 'lib-support))) (set! plan-command (let ((lookup (make-defaulting-platform-lookup (((rdb 'open-table) 'compile-commands #f) @@ -1343,6 +1556,11 @@ identifier reference") (slib:eval (lookup thing plat))))))) (build:initializer build) +(define (rebuild-catalog) + (delete-file (in-vicinity (implementation-vicinity) "slibcat")) + ;;(load (in-vicinity (implementation-vicinity) "mkimpcat")) + ) + (define (build-from-argv argv) (cond ((string? argv) (require 'read-command) @@ -1356,10 +1574,10 @@ identifier reference") ((make-command-server build '*commands*) command (lambda (comname comval options positions arities types - defaults checks aliases) + defaulters checks aliases) (let* ((params (getopt->parameter-list argc argv options arities types aliases)) - (fparams (fill-empty-parameters defaults params))) + (fparams (fill-empty-parameters defaulters params))) (cond ((not (list? params)) #f) ((not (check-parameters checks fparams)) #f) ((not (check-arities (map arity->arity-spec arities) fparams)) @@ -1391,3 +1609,7 @@ identifier reference") (cond (*interactive* (display "type (b \"build \") to build") (newline) (display "type (b*) to enter build command loop") (newline))) + +;;; Local Variables: +;;; mode:scheme +;;; End: -- cgit v1.2.3