From: Matt Birkholz Date: Tue, 15 Oct 2013 16:15:54 +0000 (-0700) Subject: ffi: Add DESTDIR support. X-Git-Tag: release-9.2.0~62 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=926cf63d2ddd82ca7607ecae7845c53c5794c799;p=mit-scheme.git ffi: Add DESTDIR support. --- diff --git a/src/blowfish/Makefile.in b/src/blowfish/Makefile.in index 659df8974..4db21fc6a 100644 --- a/src/blowfish/Makefile.in +++ b/src/blowfish/Makefile.in @@ -36,8 +36,8 @@ check: install: ( echo '(begin'; \ - echo ' (install-shim "blowfish")'; \ - echo ' (install-load-option "blowfish"))' ) \ + echo ' (install-shim "$(DESTDIR)" "blowfish")'; \ + echo ' (install-load-option "$(DESTDIR)" "blowfish"))' ) \ | $(exe) -- *.com *.bci *.pkd make.scm clean: diff --git a/src/ffi/build.scm.in b/src/ffi/build.scm.in index 10ea8e745..4f094f572 100644 --- a/src/ffi/build.scm.in +++ b/src/ffi/build.scm.in @@ -33,27 +33,37 @@ USA. (define (link-shim) (run-command (append CCLD LDFLAGS (command-line) MODULE_LDFLAGS))) -(define (install-shim libname) +(define (install-shim destdir libname) + (guarantee-string destdir 'INSTALL-SHIM) + (guarantee-string libname 'INSTALL-SHIM) (run-command (list "install" "-m" "644" (string-append libname "-shim.so") (string-append libname "-types.bin") (string-append libname "-const.bin") - (->namestring (system-library-directory-pathname))))) + (string-append destdir + (->namestring + (system-library-directory-pathname)))))) -(define (install-load-option name #!optional directory) - (guarantee-string name 'INSTALL-OPTION) +(define (install-load-option destdir name #!optional directory) + (guarantee-string destdir 'INSTALL-LOAD-OPTION) + (guarantee-string name 'INSTALL-LOAD-OPTION) (let ((dir (if (default-object? directory) name directory))) - (guarantee-string dir 'INSTALL-OPTION) - (let ((library-dir (->namestring - (merge-pathnames (pathname-as-directory dir) - (system-library-directory-pathname))))) + (guarantee-string dir 'INSTALL-LOAD-OPTION) + (let ((library-dir + (string-append destdir (->namestring + (merge-pathnames + (pathname-as-directory dir) + (system-library-directory-pathname)))))) (run-command (list "rm" "-rf" library-dir)) (run-command (list "mkdir" library-dir)) (run-command (list "chmod" "755" library-dir)) - (run-command (append (list "install" "-m" "644") + (run-command (append (list "install" "-m644") (command-line) (list library-dir)))) - (rewrite-file (merge-pathnames "optiondb.scm" - (system-library-directory-pathname)) + (rewrite-file (string-append + destdir + (->namestring + (merge-pathnames "optiondb.scm" + (system-library-directory-pathname)))) (lambda (in out) (rewrite-optiondb name dir in out))))) diff --git a/src/gdbm/Makefile b/src/gdbm/Makefile index f3340dbe2..727829fb4 100644 --- a/src/gdbm/Makefile +++ b/src/gdbm/Makefile @@ -31,8 +31,8 @@ check: install: ( echo '(begin'; \ - echo ' (install-shim "gdbm")'; \ - echo ' (install-load-option "gdbm2" "gdbm"))' ) \ + echo ' (install-shim "$(DESTDIR)" "gdbm")'; \ + echo ' (install-load-option "$(DESTDIR)" "gdbm2" "gdbm"))' ) \ | $(exe) -- *.com *.bci *.pkd make.scm clean distclean maintainer-clean: diff --git a/src/md5/Makefile.in b/src/md5/Makefile.in index 7a2b387cc..cfc8fc72f 100644 --- a/src/md5/Makefile.in +++ b/src/md5/Makefile.in @@ -36,8 +36,8 @@ check: install: ( echo '(begin'; \ - echo ' (install-shim "md5")'; \ - echo ' (install-load-option "md5"))' ) \ + echo ' (install-shim "$(DESTDIR)" "md5")'; \ + echo ' (install-load-option "$(DESTDIR)" "md5"))' ) \ | $(exe) -- *.com *.bci *.pkd make.scm clean: diff --git a/src/mhash/Makefile.in b/src/mhash/Makefile.in index 594a5dcfb..66d2e9b9e 100644 --- a/src/mhash/Makefile.in +++ b/src/mhash/Makefile.in @@ -36,8 +36,8 @@ check: install: ( echo '(begin'; \ - echo ' (install-shim "mhash")'; \ - echo ' (install-load-option "mhash"))' ) \ + echo ' (install-shim "$(DESTDIR)" "mhash")'; \ + echo ' (install-load-option "$(DESTDIR)" "mhash"))' ) \ | $(exe) -- *.com *.bci *.pkd make.scm clean: diff --git a/src/runtime/ffi.scm b/src/runtime/ffi.scm index 29e0c7ba7..371c80df1 100644 --- a/src/runtime/ffi.scm +++ b/src/runtime/ffi.scm @@ -537,14 +537,14 @@ USA. (load-ffi-quietly) ((environment-lookup (->environment '(ffi)) 'link-shim))) -(define (install-shim library) +(define (install-shim destdir library) (load-ffi-quietly) - ((environment-lookup (->environment '(ffi)) 'install-shim) library)) + ((environment-lookup (->environment '(ffi)) 'install-shim) destdir library)) -(define (install-load-option name #!optional directory) +(define (install-load-option destdir name #!optional directory) (load-ffi-quietly) ((environment-lookup (->environment '(ffi)) 'install-load-option) - name directory)) + destdir name directory)) (define (load-ffi-quietly) (if (not (name->package '(FFI)))