Commit bc377ae4 authored by Pascal J. Bourguignon's avatar Pascal J. Bourguignon

Made manifest.lisp independent from script.lisp, for abcl.

parent dc6116d5
......@@ -38,14 +38,11 @@
(declaim (also-use-packages "ASDF"))
......@@ -132,12 +129,37 @@ stdout in a string (going thru a file)."
(defun prepare-options (options)
(mapcar (lambda (option)
(typecase option
(keyword (format nil "-~(~A~)" option))
(symbol (string-downcase option))
(string option)
(t (prin1-to-string option))))
(declaim (inline trim))
(defun trim (string) (string-trim #(#\space #\tab #\newline) string))
(defun uname (&rest options)
"Without OPTIONS, return a keyword naming the system (:LINUX, :DARWIN, etc).
With options, returns the first line output by uname(1)."
(flet ((first-line (text) (subseq text 0 (position #\newline text))))
(let ((uname (shell-command-to-string "uname ~{~A~^ ~}" (prepare-options options))))
(if (and uname (plusp (length (trim uname))))
(values (if options
(first-line uname)
(intern (string-upcase (first-line uname))
(defun distribution ()
"Return a list identifying the system, distribution and release.
RETURN: (system distrib release)
System and distrib are keywords, release is a string."
(flet ((trim (string) (string-trim #(#\space #\tab #\newline) string))
(words (string) (split-sequence-if (lambda (ch) (find ch #(#\space #\tab)))
(flet ((words (string) (split-sequence-if (lambda (ch) (find ch #(#\space #\tab)))
string :remove-empty-subseqs t)))
(let ((system #+windows :windows
;; #+(and ccl windows-target)
......@@ -145,15 +167,9 @@ System and distrib are keywords, release is a string."
#+linux :linux
#+darwin :darwin
#+(and unix (not (or linux darwin)))
(let ((uname (shell-command-to-string "uname")))
(if (and uname (plusp (length (trim uname))))
(with-input-from-string (inp uname)
(let ((*package* (find-package "KEYWORD"))
(*read-eval* nil))
(read file inp)))
#-(or windows linux darwin unix)
(distrib :unknown)
(release :unknown))
(case system
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment