xform support in setup-extension
svn: r967
This commit is contained in:
parent
cfbc057729
commit
bda88101f8
File diff suppressed because it is too large
Load Diff
21
collects/compiler/xform.ss
Normal file
21
collects/compiler/xform.ss
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
(module xform mzscheme
|
||||
(require (lib "compile.ss" "dynext")
|
||||
(prefix xform: "private/xform.ss"))
|
||||
|
||||
(provide xform)
|
||||
|
||||
(define (xform src dest header-dirs)
|
||||
(let ([exe (current-extension-compiler)]
|
||||
[flags (expand-for-compile-variant
|
||||
(current-extension-preprocess-flags))]
|
||||
[headers (apply append
|
||||
(map (current-make-compile-include-strings)
|
||||
header-dirs))])
|
||||
(xform:xform (cons exe
|
||||
(append flags headers))
|
||||
src
|
||||
dest
|
||||
#f #t #t
|
||||
#f #f
|
||||
#f #f))))
|
|
@ -214,7 +214,8 @@ inspecting "/usr/lib". More generally, the "last chance" argument to
|
|||
unix-libs
|
||||
windows-libs
|
||||
extra-depends
|
||||
last-chance-k)
|
||||
last-chance-k
|
||||
[3m-too? #t])
|
||||
|
||||
The arguments are as follows:
|
||||
|
||||
|
@ -277,3 +278,7 @@ The arguments are as follows:
|
|||
add parameterizations before the final build. For example, the
|
||||
"readline" installer adds an AIX-specific compile flag in this
|
||||
step when under AIX.
|
||||
|
||||
* 3m-too?--- a boolean. If true, when MzScheme3m is installed, use
|
||||
the equivalent to mzc --xform to transform the source file and
|
||||
then compile and link for 3m.
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
(lib "file.ss")
|
||||
(lib "list.ss")
|
||||
(lib "process.ss")
|
||||
(lib "etc.ss")
|
||||
(lib "launcher.ss" "launcher")
|
||||
(lib "xform.ss" "compiler")
|
||||
(rename (lib "plthome.ss" "setup") plthome* plthome))
|
||||
|
||||
(provide pre-install
|
||||
|
@ -28,7 +31,46 @@
|
|||
(define (string-path->string s)
|
||||
(if (string? s) s (path->string s)))
|
||||
|
||||
(define (pre-install plthome collection-dir file.c . rest)
|
||||
(define pre-install
|
||||
(opt-lambda (plthome
|
||||
collection-dir
|
||||
file.c
|
||||
default-lib-dir
|
||||
include-subdirs
|
||||
find-unix-libs
|
||||
find-windows-libs
|
||||
unix-libs
|
||||
windows-libs
|
||||
extra-depends
|
||||
last-chance-k
|
||||
3m-too?)
|
||||
;; Compile and link one file:
|
||||
(define (go file.c xform-src.c)
|
||||
(pre-install/check-precompiled plthome
|
||||
collection-dir
|
||||
file.c
|
||||
default-lib-dir
|
||||
include-subdirs
|
||||
find-unix-libs
|
||||
find-windows-libs
|
||||
unix-libs
|
||||
windows-libs
|
||||
extra-depends
|
||||
last-chance-k
|
||||
xform-src.c))
|
||||
;; Do normal mode:
|
||||
(go file.c #f)
|
||||
;; Maybe do 3m mode:
|
||||
(when (and 3m-too?
|
||||
(memq '3m (available-mzscheme-variants)))
|
||||
(let ([3m-dir (build-path "compiled" "native" (system-library-subpath #f) "3m")])
|
||||
(make-directory* 3m-dir)
|
||||
(parameterize ([link-variant '3m])
|
||||
(go (build-path 3m-dir (let-values ([(base name dir?) (split-path file.c)])
|
||||
name))
|
||||
file.c))))))
|
||||
|
||||
(define (pre-install/check-precompiled plthome collection-dir file.c . rest)
|
||||
(let* ([base-dir (build-path collection-dir
|
||||
"precompiled"
|
||||
"native"
|
||||
|
@ -66,7 +108,8 @@
|
|||
unix-libs
|
||||
windows-libs
|
||||
extra-depends
|
||||
last-chance-k)
|
||||
last-chance-k
|
||||
xform-src.c)
|
||||
(parameterize ([current-directory collection-dir])
|
||||
(define mach-id (string->symbol (path->string (system-library-subpath #f))))
|
||||
(define is-win? (eq? mach-id 'win32\\i386))
|
||||
|
@ -177,27 +220,36 @@
|
|||
(last-chance-k
|
||||
(lambda ()
|
||||
(make/proc
|
||||
(list (list file.so
|
||||
(list file.o)
|
||||
(lambda ()
|
||||
(link-extension #f (append (list file.o)
|
||||
(if is-win?
|
||||
null
|
||||
(map (lambda (l)
|
||||
(string-append "-l" (string-path->string l)))
|
||||
(append find-unix-libs unix-libs))))
|
||||
file.so)))
|
||||
|
||||
(list file.o
|
||||
(append (list file.c)
|
||||
(filter (lambda (x)
|
||||
(regexp-match #rx#"mzdyn[a-z0-9]*[.]o"
|
||||
(if (string? x)
|
||||
x
|
||||
(path->string x))))
|
||||
(expand-for-link-variant (current-standard-link-libraries)))
|
||||
headers
|
||||
extra-depends)
|
||||
(lambda ()
|
||||
(compile-extension #f file.c file.o ()))))
|
||||
(append
|
||||
(list (list file.so
|
||||
(list file.o)
|
||||
(lambda ()
|
||||
(link-extension #f (append (list file.o)
|
||||
(if is-win?
|
||||
null
|
||||
(map (lambda (l)
|
||||
(string-append "-l" (string-path->string l)))
|
||||
(append find-unix-libs unix-libs))))
|
||||
file.so)))
|
||||
|
||||
(list file.o
|
||||
(append (list file.c)
|
||||
(filter (lambda (x)
|
||||
(regexp-match #rx#"mzdyn[a-z0-9]*[.]o"
|
||||
(if (string? x)
|
||||
x
|
||||
(path->string x))))
|
||||
(expand-for-link-variant (current-standard-link-libraries)))
|
||||
headers
|
||||
extra-depends)
|
||||
(lambda ()
|
||||
(compile-extension #f file.c file.o null))))
|
||||
(if xform-src.c
|
||||
(list (list file.c
|
||||
(append (list xform-src.c)
|
||||
headers
|
||||
extra-depends)
|
||||
(lambda ()
|
||||
(xform xform-src.c file.c (list mz-inc-dir)))))
|
||||
null))
|
||||
#()))))))))))))
|
||||
|
|
|
@ -3,113 +3,44 @@
|
|||
(require (lib "setup-extension.ss" "make")
|
||||
(lib "compile.ss" "dynext")
|
||||
(lib "link.ss" "dynext")
|
||||
(lib "restart.ss")
|
||||
(lib "launcher.ss" "launcher")
|
||||
(lib "file.ss"))
|
||||
|
||||
(define (pre-installer plthome openssl-dir)
|
||||
(define (go file)
|
||||
(pre-install plthome
|
||||
openssl-dir
|
||||
file
|
||||
(build-path openssl-dir
|
||||
"openssl")
|
||||
;; header subdirs
|
||||
(list "openssl")
|
||||
;; unix libs
|
||||
(list "ssl" "crypto")
|
||||
;; windows libs
|
||||
(let* ([default-paths
|
||||
(list (build-path openssl-dir "openssl"))]
|
||||
[paths
|
||||
(let ([v (getenv "PLT_EXTENSION_LIB_PATHS")])
|
||||
(if v
|
||||
(path-list-string->path-list v default-paths)
|
||||
default-paths))])
|
||||
(if (ormap (lambda (path)
|
||||
(and (file-exists? (build-path path "lib" "libeay32xxxxxxx.lib"))
|
||||
(file-exists? (build-path path "lib" "ssleay32xxxxxxx.lib"))))
|
||||
paths)
|
||||
;; Use mangleable names:
|
||||
(list "libeay32xxxxxxx" "ssleay32xxxxxxx")
|
||||
;; Use simple names:
|
||||
(list "libeay32" "ssleay32")))
|
||||
;; unix extra libs (assume always there)
|
||||
null
|
||||
;; Windows extra libs (assume always there)
|
||||
(list "wsock32.lib")
|
||||
;; Extra depends:
|
||||
(list "mzssl.ss")
|
||||
;; Last-chance k:
|
||||
(lambda (k) (k))))
|
||||
(go "mzssl.c")
|
||||
|
||||
;; Build for 3m when it looks like we can/should.
|
||||
;; This is a hack --- hopefully temporary!
|
||||
(let ([3m-dir (build-path "compiled" "native" (system-library-subpath #f) "3m")]
|
||||
[mzssl.so (case (system-type)
|
||||
[(windows) "mzssl.dll"]
|
||||
[(macosx) "mzssl.dylib"]
|
||||
[else "mzssl.so"])])
|
||||
(parameterize ([current-directory openssl-dir])
|
||||
(when (and (memq (system-type) '(unix macosx windows))
|
||||
(memq '3m (available-mzscheme-variants))
|
||||
(directory-exists? (build-path 'up 'up "src" "mzscheme" "gc2")))
|
||||
(when (or (not (file-exists? (build-path 3m-dir mzssl.so)))
|
||||
(not (file-exists? (build-path 3m-dir "mzssl.c")))
|
||||
((file-or-directory-modify-seconds (build-path 3m-dir 'up mzssl.so))
|
||||
. > .
|
||||
(file-or-directory-modify-seconds (build-path 3m-dir mzssl.so))))
|
||||
(make-directory* 3m-dir)
|
||||
(restart-mzscheme #()
|
||||
(lambda (x) x)
|
||||
(list->vector
|
||||
(list
|
||||
"-qr"
|
||||
(path->string
|
||||
(build-path 'up 'up "src" "mzscheme" "gc2" "xform.ss"))
|
||||
(let* ([inc (build-path 'up 'up "include")]
|
||||
[fix-path (lambda (s)
|
||||
(regexp-replace* " " (path->string s) "\" \""))]
|
||||
[extras (cond ((getenv "PLT_EXTENSION_LIB_PATHS") =>
|
||||
(lambda (ext)
|
||||
(apply string-append
|
||||
(map (lambda (p)
|
||||
(format
|
||||
" ~a~s"
|
||||
(if (eq? 'windows (system-type))
|
||||
" /I"
|
||||
" -I")
|
||||
(fix-path
|
||||
(build-path p "include"))))
|
||||
(path-list-string->path-list ext '())))))
|
||||
(else ""))])
|
||||
(if (eq? 'windows (system-type))
|
||||
(format "cl.exe /MT /E /I~a /I~a~a"
|
||||
(fix-path inc)
|
||||
(fix-path
|
||||
(build-path openssl-dir "openssl" "include"))
|
||||
extras)
|
||||
(format "gcc -E ~a-I~a~a"
|
||||
(if (eq? 'macosx (system-type))
|
||||
"-DOS_X "
|
||||
"")
|
||||
(fix-path inc)
|
||||
extras)))
|
||||
"mzssl.c"
|
||||
(path->string
|
||||
(build-path 3m-dir "mzssl.c"))))
|
||||
void))
|
||||
(parameterize ([link-variant '3m])
|
||||
(with-new-flags current-extension-compiler-flags
|
||||
(if (eq? 'windows (system-type))
|
||||
'("/Zi")
|
||||
null)
|
||||
(with-new-flags current-extension-linker-flags
|
||||
(if (eq? 'windows (system-type))
|
||||
'("/Zi")
|
||||
null)
|
||||
(go (build-path 3m-dir "mzssl.c"))))))))
|
||||
(pre-install plthome
|
||||
openssl-dir
|
||||
"mzssl.c"
|
||||
(build-path openssl-dir
|
||||
"openssl")
|
||||
;; header subdirs
|
||||
(list "openssl")
|
||||
;; unix libs
|
||||
(list "ssl" "crypto")
|
||||
;; windows libs
|
||||
(let* ([default-paths
|
||||
(list (build-path openssl-dir "openssl"))]
|
||||
[paths
|
||||
(let ([v (getenv "PLT_EXTENSION_LIB_PATHS")])
|
||||
(if v
|
||||
(path-list-string->path-list v default-paths)
|
||||
default-paths))])
|
||||
(if (ormap (lambda (path)
|
||||
(and (file-exists? (build-path path "lib" "libeay32xxxxxxx.lib"))
|
||||
(file-exists? (build-path path "lib" "ssleay32xxxxxxx.lib"))))
|
||||
paths)
|
||||
;; Use mangleable names:
|
||||
(list "libeay32xxxxxxx" "ssleay32xxxxxxx")
|
||||
;; Use simple names:
|
||||
(list "libeay32" "ssleay32")))
|
||||
;; unix extra libs (assume always there)
|
||||
null
|
||||
;; Windows extra libs (assume always there)
|
||||
(list "wsock32.lib")
|
||||
;; Extra depends:
|
||||
(list "mzssl.ss")
|
||||
;; Last-chance k:
|
||||
(lambda (k) (k))
|
||||
;; 3m, too:
|
||||
#t)
|
||||
|
||||
;; Under windows, put "{lib,sll}eay32" into the system folder when
|
||||
;; they're in a "precompiled" dir.
|
||||
|
|
Loading…
Reference in New Issue
Block a user