diff options
Diffstat (limited to 'build.scm')
-rw-r--r-- | build.scm | 385 |
1 files changed, 169 insertions, 216 deletions
@@ -1,5 +1,5 @@ ;; "build.scm" Build database and program -*-scheme-*- -;; Copyright (C) 1994-2003 Aubrey Jaffer. +;; Copyright (C) 1994-2004 Aubrey Jaffer. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -58,9 +58,9 @@ ((documentation string)) ((documentation "documentation") (platform-specific "required for certain platforms") - (required "required for building executable SCM") + (core "core for building executable SCM") (optional "required for some feature") - (linkable "required and can be dynamically linked") + (linkable "can be statically or dynamically linked for some feature") (test "test SCM") (none "no files"))) @@ -81,38 +81,38 @@ ("pi.scm" Scheme test "computes digits of pi [type (pi 100 5)]. Test performance against pi.c.") ("pi.c" c-source test "computes digits of pi [cc -o pi pi.c;time pi 100 5].") ("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.") + ("Makefile" Makefile core "builds SCMLIT using the `make' program.") + ("build.scm" Scheme core "database for compiling and linking new SCM programs.") ("build.bat" MS-DOS-batch platform-specific "invokes build.scm for MS-DOS") - ("mkimpcat.scm" Scheme required "build SCM-specific catalog for SLIB.") + ("mkimpcat.scm" Scheme core "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 "Dynamic link/loading.") - ("compile.scm" Scheme required "Hobbit compilation to C.") - ("Macro.scm" Scheme required "Supports Syntax-Rules 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.") - ("continue.h" c-header required "continuations.") - ("continue.c" c-source required "continuations.") - ("scm.h" c-header required "data type and external definitions of SCM.") - ("scm.c" c-source required "initialization, interrupts, and non-IEEE utility functions.") - ("scmmain.c" c-source required "initialization, 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") - ("eval.c" c-source required "evaluator, apply, map, and foreach.") - ("sys.c" c-source required "call-with-current-continuation, opening and closing files, storage allocation and garbage collection.") - ("subr.c" c-source required "the rest of IEEE functions.") - ("debug.c" c-source required "debugging, printing code.") - ("unif.c" c-source required "uniform vectors.") - ("rope.c" c-source required "C interface functions.") + ("Init.scm" Scheme core "Scheme initialization.") + ("Transcen.scm" Scheme core "inexact builtin procedures.") + ("Link.scm" Scheme core "Dynamic link/loading.") + ("compile.scm" Scheme core "Hobbit compilation to C.") + ("Macro.scm" Scheme core "Supports Syntax-Rules Macros.") + ("scmfig.h" c-header core "contains system dependent definitions.") + ("patchlvl.h" c-header core "patchlevel of this release.") + ("setjump.h" c-header core "continuations, stacks, and memory allocation.") + ("continue.h" c-header core "continuations.") + ("continue.c" c-source core "continuations.") + ("scm.h" c-header core "data type and external definitions of SCM.") + ("scm.c" c-source core "initialization, interrupts, and non-IEEE utility functions.") + ("scmmain.c" c-source core "initialization, interrupts, and non-IEEE utility functions.") + ("findexec.c" c-source core "find the executable file function.") + ("script.c" c-source core "utilities for running as `#!' script.") + ("time.c" c-source core "functions dealing with time.") + ("repl.c" c-source core "error, read-eval-print loop, read, write and load.") + ("scl.c" c-source core "inexact arithmetic") + ("eval.c" c-source core "evaluator, apply, map, and foreach.") + ("sys.c" c-source core "call-with-current-continuation, opening and closing files, storage allocation and garbage collection.") + ("subr.c" c-source core "the rest of IEEE functions.") + ("debug.c" c-source core "debugging, printing code.") + ("unif.c" c-source core "uniform vectors.") + ("rope.c" c-source core "C interface functions.") ("ramap.c" c-source optional "array mapping") ("dynl.c" c-source optional "dynamically load object files.") ("sc2.c" c-source linkable "procedures from R2RS and R3RS not in R4RS.") @@ -122,6 +122,8 @@ ("split.scm" Scheme test "example use of crs.c. Input, output, and diagnostic output directed to separate windows.") ("edline.c" c-source linkable "Gnu readline input editing (get ftp.sys.toronto.edu:/pub/rc/editline.shar).") ("Iedline.scm" Scheme optional "Gnu readline input editing.") + ("differ.c" c-source linkable "Linear-space O(PN) sequence comparison.") + ("Idiffer.scm" Scheme optional "Linear-space O(PN) sequence comparison.") ("record.c" c-source linkable "proposed `Record' user definable datatypes.") ("gsubr.c" c-source linkable "make_gsubr for arbitrary (< 11) arguments to C functions.") ("ioext.c" c-source linkable "system calls in common between PC compilers and unix.") @@ -146,9 +148,9 @@ (o-proc symbol) (spec expression) (documentation string)) - ((exe required compile-c-files link-c-program #f + ((exe core compile-c-files link-c-program #f "executable program") - (lib required compile-c-files make-archive ((c-lib lib)) + (lib core compile-c-files make-archive ((c-lib lib)) "library module") (dlls linkable compile-dll-c-files make-dll-archive ((define "DLL")) "archived dynamically linked library object files") @@ -356,7 +358,8 @@ 'regex '((c-file "rgx.c") (c-lib regex) (compiled-init "init_rgx"))) -#;BSD @dfn{socket} interface. +#;BSD @dfn{socket} interface. Socket addr functions require +#;inexacts or bignums for 32-bit precision. (define-build-feature 'socket '((c-lib socket) (c-file "socket.c") (compiled-init "init_socket"))) @@ -374,6 +377,11 @@ 'unix '((c-file "unix.c") (compiled-init "init_unix"))) +#;Sequence comparison +(define-build-feature + 'differ + '((c-file "differ.c") (compiled-init "init_differ"))) + #;Microsoft Windows executable. (define-build-feature 'windows @@ -414,6 +422,14 @@ 'cheap-continuations '((define "CHEAP_CONTINUATIONS"))) +#;WB database with relational wrapper. +(define-build-feature + 'wb + '((c-file "../wb/blink.c" "../wb/blkio.c" "../wb/del.c" "../wb/ent.c" + "../wb/handle.c" "../wb/prev.c" "../wb/scan.c" "../wb/stats.c" + "../wb/wbsys.c" "../wb/db.c") + (scm-srcdir "../scm/") + (compiled-init "init_db"))) ;;;; The rest is about building on specific platforms. @@ -519,7 +535,8 @@ (m gnu-win32 "" "" "" () ()) (c gnu-win32 "" "" "" () ()) - (dlll gnu-win32 "-DSCM_DLL" "" #f () ("posix.c" "unix.c" "socket.c")) + (dlll gnu-win32 "-DSCM_WIN_DLL" "" #f () ("posix.c" "unix.c" "socket.c")) + (m linux-aout "" "-lm" "/usr/lib/libm.sa" () ()) (c linux-aout "" "-lc" "/usr/lib/libc.sa" () ()) (dlll linux-aout "-DDLD -DDLD_DYNCM" "-ldld" #f () ("findexec.c")) @@ -599,7 +616,7 @@ (m microsoft-c "" "" #f () ()) (c microsoft-c-nt "" "" #f () ("findexec.c")) (m microsoft-c-nt "" "" #f () ()) - (dlll microsoft-c-nt "-DSCM_DLL -MD" "" #f () ("posix.c" "unix.c" "socket.c")) + (dlll microsoft-c-nt "-DSCM_WIN_DLL -MD" "" #f () ("posix.c" "unix.c" "socket.c")) (debug microsoft-c-nt "-Zi" "/debug" #f () ()) (c microsoft-quick-c "" "" #f () ("findexec.c")) (m microsoft-quick-c "" "" #f () ()) @@ -625,7 +642,7 @@ (c freebsd "" "-export-dynamic" #f () ()) (m freebsd "" "-lm" #f () ()) (curses freebsd "" "-lncurses" "/usr/lib/libncurses.a" () ()) - (regex freebsd "" "-lgnuregex" "" () ()) + (regex freebsd "-I/usr/include/gnu" "-lgnuregex" "" () ()) (editline freebsd "" "-lreadline" "" () ()) (dlll freebsd "-DSUN_DL" "-export-dynamic" "" () ()) (nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c") ()) @@ -635,7 +652,9 @@ (graphics netbsd "-I/usr/X11R6/include -DX11" "-lX11" "-Wl,-rpath -Wl,/usr/X11R6/lib -L/usr/X11R6/lib" () ()) (m netbsd "" "-lm" #f () ()) (m openbsd "" "-lm" #f () ()) + (dlll openbsd "-DSUN_DL" "" "" () ()) (curses openbsd "" "-lcurses" "/usr/lib/libcurses.a" () ()) + (regex openbsd "" "" #f () ()) )) '(compile-commands @@ -754,20 +773,16 @@ (c-includes parms) (c-flags parms) c-files) - (let ((results - (map - (lambda (fname) - (and (batch:try-command - parms "link" "/dll" "/nologo" - (string-append "/out:" fname ".dll") - (string-append "/implib:" fname ".lib") - fname - (map (lambda (l) (build:lib-ld-flag l platform)) - (parameter-list-ref parms 'c-lib)) - "scm.lib") - (string-append fname ".dll"))) - (map c-> c-files)))) - (and (apply and? results) results)))))) + (let ((fnames (map c-> c-files))) + (and (batch:try-command + parms "link" "/dll" "/nologo" + (string-append "/out:" (car fnames) ".dll") + (string-append "/implib:" (car fnames) ".lib") + fnames + (map (lambda (l) (build:lib-ld-flag l platform)) + (parameter-list-ref parms 'c-lib)) + "scm.lib") + (list (string-append (car fnames) ".dll")))))))) (defcommand make-dll-archive microsoft-c-nt (lambda (oname objects libs parms) objects)) (defcommand make-archive microsoft-c-nt @@ -955,23 +970,18 @@ (lambda (files parms) (and (batch:try-chopped-command parms "cc" "+O1" "-Wl,-E" "+z" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) - (let ((results - (map - (lambda (fname) - (batch:rename-file - parms - (string-append fname ".sl") - (string-append fname ".sl~")) - (and (batch:try-command - parms "ld" "-b" "-o" - (string-append fname ".sl") - (string-append fname ".o")) - (string-append fname ".sl"))) - (truncate-up-to (map c-> files) #\/)))) - (and (apply and? results) results))))) + (let ((fnames (truncate-up-to (map c-> files) #\/))) + (define fname.sl (string-append (car fnames) ".sl")) + (batch:rename-file parms fname.sl (string-append fname.sl "~")) + (and (batch:try-command + parms "ld" "-b" "-o" + fname.sl + (map (lambda (fname) (string-append fname ".o")) fnames)) + (list fname.sl)))))) ; (make-dll-archive HP-UX ; (lambda (oname objects libs parms) ; (and (batch:try-command @@ -994,6 +1004,7 @@ (and (batch:try-chopped-command parms "gcc" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) @@ -1018,28 +1029,24 @@ (lambda (files parms) (and (batch:try-chopped-command - parms - "gcc" "-fpic" "-c" (c-includes parms) - (c-flags parms) - files) + parms "gcc" "-fpic" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) (let* ((platform (car (parameter-list-ref parms 'platform))) - (ld-opts - (map (lambda (l) (build:lib-ld-flag l platform)) - (parameter-list-ref parms 'c-lib))) - (results - (map - (lambda (fname) - (and (batch:try-command - parms - "gcc" "-shared" "-o" - (string-append fname ".so") - (string-append fname ".o") - ld-opts) - (batch:delete-file - parms (string-append fname ".o")) - (string-append fname ".so"))) - (truncate-up-to (map c-> files) #\/)))) - (and (apply and? results) results))))) + (fnames (truncate-up-to (map c-> files) #\/)) + (fname.so (string-append (car fnames) ".so")) + (result + (and (batch:try-command + parms + "gcc" "-shared" "-o" fname.so + (map (lambda (fname) (string-append fname ".o")) fnames) + (map (lambda (l) (build:lib-ld-flag l platform)) + (parameter-list-ref parms 'c-lib))) + (list fname.so)))) + (for-each (lambda (fname) + (batch:delete-file + parms (string-append fname ".o"))) + fnames) + result)))) (defcommand make-dll-archive linux (lambda (oname objects libs parms) (let ((platform (car (parameter-list-ref @@ -1135,6 +1142,7 @@ (lambda (files parms) (and (batch:try-chopped-command parms "gcc" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) @@ -1160,27 +1168,20 @@ (define c-files (remove-if (lambda (file) (member file suppressors)) files)) (and (batch:try-chopped-command - parms - "gcc" "-c" - (include-spec "-I" parms) - (c-includes parms) - (c-flags parms) - c-files) - (let ((results - (map - (lambda (fname) - (and (batch:try-command - parms "dllwrap" - "--output-lib" (string-append fname ".lib") - "-dllname" (string-append fname ".dll") - "--output-def" (string-append fname ".def") - (string-append fname ".o") - (map (lambda (l) (build:lib-ld-flag l platform)) - (parameter-list-ref parms 'c-lib)) - "scm.lib") - (string-append fname ".dll"))) - (map c-> c-files)))) - (and (apply and? results) results)))))) + parms "gcc" "-c" (include-spec "-I" parms) + (c-includes parms) (c-flags parms) c-files) + (let ((fnames (map c-> c-files))) + (and (batch:try-command + parms "dllwrap" + "--output-lib" (string-append (car fnames) ".lib") + "-dllname" (string-append (car fnames) ".dll") + "--output-def" (string-append (car fnames) ".def") + (map (lambda (fname) (string-append fname ".o")) + fnames) + (map (lambda (l) (build:lib-ld-flag l platform)) + (parameter-list-ref parms 'c-lib)) + "scm.lib") + (list (string-append (car fnames) ".dll")))))))) (defcommand make-dll-archive gnu-win32 (lambda (oname objects libs parms) objects)) (defcommand make-archive gnu-win32 @@ -1231,25 +1232,19 @@ (lambda (files parms) (and (batch:try-chopped-command - parms "cc" "-std1" "-c" (c-includes parms) (c-flags parms) files) + parms "cc" "-std1" "-c" (c-includes parms) + (include-spec "-I" parms) (c-flags parms) files) (let* ((platform (car (parameter-list-ref parms 'platform))) - (ld-opts + (fnames (truncate-up-to (map c-> files) #\/))) + (and (batch:try-command + parms "cc" "-shared" "-o" (string-append (car fnames) ".so") + (map (lambda (fname) (string-append fname ".o")) fnames) (map (lambda (l) (build:lib-ld-flag l platform)) (parameter-list-ref parms 'c-lib))) - (results - (map - (lambda (fname) - (and (batch:try-command - parms - "cc" "-shared" "-o" - (string-append fname ".so") - (string-append fname ".o") - ld-opts) - (batch:delete-file - parms (string-append fname ".o")) - (string-append fname ".so"))) - (truncate-up-to (map c-> files) #\/)))) - (and (apply and? results) results))))) + (for-each (lambda (fname) + (batch:delete-file parms (string-append fname ".o"))) + fnames) + (list (string-append (car fnames) ".so"))))))) (defcommand make-dll-archive osf1 (lambda (oname objects libs parms) (let ((platform (car (parameter-list-ref @@ -1292,30 +1287,20 @@ (defcommand compile-dll-c-files svr4-gcc-sun-ld (lambda (files parms) (and - (batch:try-chopped-command - parms - "gcc" - "-fpic" "-c" (c-includes parms) - (c-flags parms) - files) + (batch:try-chopped-command parms "gcc" "-fpic" "-c" + (include-spec "-I" parms) + (c-includes parms) (c-flags parms) files) (let* ((platform (car (parameter-list-ref parms 'platform))) - (ld-opts + (fnames (truncate-up-to (map c-> files) #\/))) + (and (batch:try-command + parms "ld" "-G" "-o" (string-append (car fnames) ".so") + (map (lambda (fname) (string-append fname ".o")) fnames) (map (lambda (l) (build:lib-ld-flag l platform)) (parameter-list-ref parms 'c-lib))) - (results - (map - (lambda (fname) - (and (batch:try-command - parms - "ld" "-G" "-o" - (string-append fname ".so") - (string-append fname ".o") - ld-opts) - (batch:delete-file - parms (string-append fname ".o")) - (string-append fname ".so"))) - (truncate-up-to (map c-> files) #\/)))) - (and (apply and? results) results))))) + (for-each (lambda (fname) + (batch:delete-file parms (string-append fname ".o"))) + fnames) + (list (string-append (car fnames) ".so"))))))) (defcommand compile-c-files svr4 (lambda (files parms) @@ -1569,6 +1554,7 @@ (lambda (files parms) (and (batch:try-chopped-command parms "cc" "-c" + (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) @@ -1588,6 +1574,8 @@ (lambda (files parms) (and (batch:try-chopped-command parms +;;; gcc 3.4.2 for FreeBSD does not allow options other than default i.e. -O0 if NO -DGCC_SPARC_BUG - dai 2004-10-30 + ;;"cc" "-O3 -pipe -DGCC_SPARC_BUG " "-c" "cc" "-O3 -pipe " "-c" (c-includes parms) (c-flags parms) @@ -1608,29 +1596,22 @@ (defcommand compile-dll-c-files freebsd (lambda (files parms) (and (batch:try-chopped-command - parms - "cc" "-O3 -pipe " - "-fPIC" "-c" (c-includes parms) - (c-flags parms) - files) - (let ((results - (map - (lambda (fname) - (and (batch:try-command - parms - "cc" "-shared" - (cond - ((equal? fname "edline") "-lreadline") - ((equal? fname "x") "-L/usr/X11R6/lib -lSM -lICE -lXext -lX11 -lxpg4") - (else "")) - "-o" - (string-append fname ".so") - (string-append fname ".o")) - (batch:delete-file - parms (string-append fname ".o")) - (string-append fname ".so"))) - (truncate-up-to (map c-> files) #\/)))) - (and (apply and? results) results))))) + parms "cc" "-O3 -pipe " "-fPIC" "-c" + (c-includes parms) (c-flags parms) files) + (let ((fnames (truncate-up-to (map c-> files) #\/))) + (and (batch:try-command + parms "cc" "-shared" + (cond + ((equal? (car fnames) "edline") "-lreadline") + ((equal? (car fnames) "x") "-L/usr/X11R6/lib -lSM -lICE -lXext -lX11 -lxpg4") + (else "")) + "-o" (string-append (car fnames) ".so") + (map (lambda (fname) (string-append fname ".o")) fnames)) + (for-each (lambda (fname) + (batch:delete-file + parms (string-append fname ".o"))) + fnames) + (list (string-append (car fnames) ".so"))))))) (defcommand make-dll-archive freebsd (lambda (oname objects libs parms) (and (batch:try-command @@ -1667,7 +1648,7 @@ (lambda (files parms) (and (batch:try-chopped-command parms - "cc" "-c" + "cc" "-c" (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) @@ -1687,23 +1668,12 @@ (defcommand compile-dll-c-files netbsd (lambda (files parms) (and (batch:try-chopped-command - parms - "cc" "-fPIC" "-c" - (string-append - "-I" (parameter-list-ref parms 'scm-srcdir)) - (c-includes parms) - (c-flags parms) - files) + parms "cc" "-fPIC" "-c" (include-spec "-I" parms) + (c-includes parms) (c-flags parms) files) (let ((objs (map c->o files))) - (every - (lambda (f) - (and (batch:try-command - parms "gcc" "-shared" "-fPIC" f) - (batch:try-command - parms "mv" "a.out" f))) - objs) - objs)))) - + (and (batch:try-command parms "gcc" "-shared" "-fPIC" objs) + (batch:try-command parms "mv" "a.out" (car objs)) + (list (car objs))))))) (defcommand make-dll-archive netbsd (lambda (oname objects libs parms) (and (batch:try-command @@ -1722,7 +1692,7 @@ (lambda (files parms) (and (batch:try-chopped-command parms - "cc" "-c" + "cc" "-c" (include-spec "-I" parms) (c-includes parms) (c-flags parms) files) @@ -1737,27 +1707,17 @@ '("-nostartfiles" "pre-crt0.o" "crt0.o" "/usr/lib/crt0.o") - (append libs objects))) + (append objects libs))) oname))) (defcommand compile-dll-c-files openbsd (lambda (files parms) (and (batch:try-chopped-command - parms - "cc" "-fPIC" "-c" - (string-append - "-I" (parameter-list-ref parms 'scm-srcdir)) - (c-includes parms) - (c-flags parms) - files) + parms "cc" "-fPIC" "-c" (include-spec "-I" parms) + (c-includes parms) (c-flags parms) files) (let ((objs (map c->o files))) - (every - (lambda (f) - (and (batch:try-command - parms "gcc" "-shared" "-fPIC" f) - (batch:try-command - parms "mv" "a.out" f))) - objs) - objs)))) + (and (batch:try-command parms "gcc" "-shared" "-fPIC" objs) + (batch:try-command parms "mv" "a.out" (car objs)) + (list (car objs))))))) (defcommand make-dll-archive openbsd (lambda (oname objects libs parms) @@ -1959,9 +1919,7 @@ parms (cons 'batch-dialect (list (os->batch-dialect os))))))) (adjoin-parameters! - parms - (cons 'c-defines c-defines) - (cons 'c-includes c-includes)) + parms (cons 'c-defines c-defines) (cons 'c-includes c-includes)) (set! parms (cons (cons 'operating-system @@ -1975,9 +1933,7 @@ name (lambda (batch-port) (define o-files #f) - (adjoin-parameters! - parms - (list 'batch-port batch-port)) + (adjoin-parameters! parms (list 'batch-port batch-port)) (let ((options-file (parameter-list-ref parms 'options-file))) (and (not (null? options-file)) @@ -1996,17 +1952,14 @@ (let ((suppressors (apply append (map (lambda (l) (build:c-suppress l platform)) - (parameter-list-ref parms 'c-lib)))) - (ssdir (car (parameter-list-ref parms 'scm-srcdir)))) + (parameter-list-ref parms 'c-lib))))) (c-proc - (map (lambda (file) (in-vicinity ssdir file)) - (apply - append - (remove-if (lambda (file) (member file suppressors)) - (parameter-list-ref parms 'c-file)) - (map - (lambda (l) (build:c-lib-support l platform)) - (parameter-list-ref parms 'c-lib)))) + (apply + append + (remove-if (lambda (file) (member file suppressors)) + (parameter-list-ref parms 'c-file)) + (map (lambda (l) (build:c-lib-support l platform)) + (parameter-list-ref parms 'c-lib))) parms))) (cond ((not o-files) |