- bindir is now extracted from scsh's "configure" module by default,
- better error handling.
This commit is contained in:
parent
83b497e65c
commit
4af56d67e8
25
pkg-def.scm
25
pkg-def.scm
|
@ -10,14 +10,9 @@ exec scsh -le ~a/load.scm -o install-lib -e install-main -s "$0" "$@"
|
||||||
END
|
END
|
||||||
)
|
)
|
||||||
|
|
||||||
(define-package "install-lib" (1 1 0)
|
(define-package "install-lib" (1 1 1)
|
||||||
((options (bindir "Destination directory for executables" "<dir>" #t #f #f
|
((options (bindir "Destination directory for executables" "<dir>" #t #f
|
||||||
,identity ,identity)))
|
,(bin-dir) ,identity ,identity)))
|
||||||
|
|
||||||
(let ((bindir (get-option-value 'bindir)))
|
|
||||||
(if (not bindir)
|
|
||||||
(display-error-and-exit
|
|
||||||
"no binary directory specified (use --bindir option)."))
|
|
||||||
|
|
||||||
;; Install "package" part (doc & Scheme code)
|
;; Install "package" part (doc & Scheme code)
|
||||||
(install-file "doc/install-lib.pdf" 'doc "pdf")
|
(install-file "doc/install-lib.pdf" 'doc "pdf")
|
||||||
|
@ -32,13 +27,21 @@ END
|
||||||
(user)))
|
(user)))
|
||||||
|
|
||||||
;; Install "program" part (scsh-install-pkg script).
|
;; Install "program" part (scsh-install-pkg script).
|
||||||
|
(let ((bindir (get-option-value 'bindir)))
|
||||||
(if (or (get-option-value 'dry-run) (get-option-value 'verbose))
|
(if (or (get-option-value 'dry-run) (get-option-value 'verbose))
|
||||||
(format #t "creating scsh-install-pkg script in ~a\n" bindir))
|
(format #t "creating scsh-install-pkg script in ~a\n" bindir))
|
||||||
|
|
||||||
(if (not (get-option-value 'dry-run))
|
(if (not (get-option-value 'dry-run))
|
||||||
(begin
|
(let ((wrapper-name (absolute-file-name "scsh-install-pkg" bindir)))
|
||||||
|
|
||||||
|
(with-errno-handler
|
||||||
|
((errno packet)
|
||||||
|
(else ((display-error-and-exit "cannot create wrapper script "
|
||||||
|
wrapper-name ":\n "
|
||||||
|
(first packet)))))
|
||||||
|
|
||||||
(create-directory&parents bindir #o755)
|
(create-directory&parents bindir #o755)
|
||||||
(call-with-output-file (absolute-file-name "scsh-install-pkg" bindir)
|
(call-with-output-file wrapper-name
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(format port scsh-install-pkg-template (get-directory 'base #f))
|
(format port scsh-install-pkg-template (get-directory 'base #f))
|
||||||
(set-file-mode port #o755)))))))
|
(set-file-mode port #o755))))))))
|
||||||
|
|
Loading…
Reference in New Issue