2004-05-04 15:36:17 -04:00
|
|
|
(define-package "ldap" (0 1 0)
|
|
|
|
((install-lib-version (1 0))
|
|
|
|
(options (ldap-prefix "Use LDAP library with prefix" "<dir>" #t #f #f)))
|
2004-02-09 08:55:35 -05:00
|
|
|
|
2004-05-04 15:36:17 -04:00
|
|
|
|
|
|
|
(define (display-bold text)
|
|
|
|
(display "\033[1m")
|
|
|
|
(display text)
|
|
|
|
(display "\033[m"))
|
|
|
|
|
|
|
|
(newline)
|
|
|
|
(display-bold "Generating Scheme stub code")
|
|
|
|
(newline)
|
|
|
|
|
|
|
|
(run (scsh -lel ffi-tools/load.scm
|
|
|
|
-lm scheme/ldap-constants.scm
|
|
|
|
-o ldap-constants
|
|
|
|
-c "(make-scm-files command-line-arguments)"
|
|
|
|
scheme))
|
|
|
|
|
|
|
|
(newline)
|
|
|
|
(display-bold "Generating C stub code")
|
|
|
|
(newline)
|
|
|
|
|
|
|
|
(run (scsh -lel ffi-tools/load.scm
|
|
|
|
-lm scheme/ldap-constants.scm
|
|
|
|
-o ldap-constants
|
|
|
|
-c "(make-c-files command-line-arguments)"
|
|
|
|
c))
|
|
|
|
|
2004-02-09 08:55:35 -05:00
|
|
|
(newline)
|
2004-05-04 15:36:17 -04:00
|
|
|
(display-bold "Configuring, compiling and installing C-stubs")
|
2004-02-09 08:55:35 -05:00
|
|
|
(newline)
|
|
|
|
|
|
|
|
(let* ((scsh-includes (include-dir))
|
|
|
|
(build-host (get-option-value 'build))
|
|
|
|
(prefix (string-append (get-directory 'lib #f) "/" build-host))
|
2004-05-04 15:36:17 -04:00
|
|
|
(ffi-tools-path
|
|
|
|
(run/string (scsh -lel ffi-tools/load.scm -o ffi-tools-path
|
|
|
|
-c "(display (ffi-tools-lib-path))")))
|
2004-02-09 08:55:35 -05:00
|
|
|
(configure (append
|
|
|
|
(list "./configure"
|
|
|
|
(string-append "--prefix=" prefix)
|
|
|
|
(string-append "--with-scsh-includes=" scsh-includes)
|
2004-05-04 15:36:17 -04:00
|
|
|
(string-append "--with-ffi-tools=" ffi-tools-path)
|
2004-02-12 07:45:39 -05:00
|
|
|
(string-append "--enable-static=no")
|
2004-02-09 08:55:35 -05:00
|
|
|
(string-append "--build=" build-host))
|
|
|
|
(cond ((get-option-value 'ldap-prefix)
|
|
|
|
=> (lambda (prefix)
|
|
|
|
(list
|
|
|
|
(string-append "--with-ldap-prefix=" prefix))))
|
|
|
|
(else '()))))
|
|
|
|
(make `(make install
|
|
|
|
,(string-append "DESTDIR=" (get-option-value 'dest-dir)))))
|
|
|
|
(if (get-option-value 'dry-run)
|
|
|
|
(begin
|
|
|
|
(display configure) (newline)
|
|
|
|
(display make) (newline))
|
|
|
|
(if (not (and (zero? (run ,configure))
|
|
|
|
(zero? (run ,make))))
|
|
|
|
(exit))))
|
|
|
|
|
|
|
|
(newline)
|
2004-05-04 15:36:17 -04:00
|
|
|
(display-bold "Creating load.scm")
|
2004-02-09 08:55:35 -05:00
|
|
|
(newline)
|
|
|
|
|
|
|
|
(let ((schemedir (get-directory 'scheme #f))
|
|
|
|
(libdir (get-directory 'lib #f)))
|
|
|
|
(write-to-load-script
|
|
|
|
`((user)
|
|
|
|
(load-package 'dynamic-externals)
|
|
|
|
(open 'dynamic-externals)
|
|
|
|
(open 'external-calls)
|
|
|
|
(open 'configure)
|
|
|
|
(open 'signals)
|
|
|
|
,@(map (lambda (x) `(run ',x)) tmpl-libtool-la-reader)
|
|
|
|
(run '(let* ((lib-dir (string-append ,libdir "/" (host)))
|
|
|
|
(la-file-name (string-append lib-dir "/libscshldap.la"))
|
2004-02-10 10:24:43 -05:00
|
|
|
(initializer-name "scsh_init_ldap_bindings"))
|
2004-02-09 08:55:35 -05:00
|
|
|
(let ((la-alist (read-libtool-la la-file-name)))
|
|
|
|
(cond
|
|
|
|
((assoc 'dlname la-alist)
|
|
|
|
=> (lambda (p)
|
|
|
|
(let ((module-file (string-append lib-dir "/" (cdr p))))
|
|
|
|
(dynamic-load module-file)
|
|
|
|
(call-external (get-external initializer-name)))))
|
|
|
|
(else
|
|
|
|
(error "Could not figure out libscshldap's name" la-file-name))))))
|
|
|
|
(config)
|
|
|
|
(load ,(string-append schemedir "/interfaces.scm"))
|
|
|
|
(load ,(string-append schemedir "/packages.scm"))
|
|
|
|
(user))))
|
|
|
|
|
2004-05-04 15:36:17 -04:00
|
|
|
(newline)
|
|
|
|
(display-bold "Installing Scheme files")
|
|
|
|
(newline)
|
|
|
|
|
2004-02-09 08:55:35 -05:00
|
|
|
(install-directory-contents "scheme" 'scheme)
|
2004-05-04 15:36:17 -04:00
|
|
|
)
|