Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jl2
Last active April 15, 2019 06:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jl2/a6420f0355c5a453b130109df202805f to your computer and use it in GitHub Desktop.
Save jl2/a6420f0355c5a453b130109df202805f to your computer and use it in GitHub Desktop.
#!/usr/bin/lisp --script
;;-*-lisp-*-
(let* ((git-out-string (make-array '(0) :element-type 'base-char :fill-pointer 0 :adjustable t))
(done-str "Already up-to-date")
(len-done (length done-str))
(emacs-dir (merge-pathnames "oss_src/emacs" (user-homedir-pathname)))
(force-build (string= "--force" (second sb-ext:*posix-argv*))))
(with-output-to-string (s git-out-string)
;; Update Git repo
(run-program "git" (list "pull")
:search t :output s :input t :error :output :wait t :directory emacs-dir))
;; Check if a rebuild is necessary
(when (not (or force-build (not (string= done-str (subseq git-out-string 0 len-done)))))
(format t "Already up to date!~%")
(quit))
;; Clean
(run-program "make" '("maintainer-clean") :search t :output t :input t :error :output :wait t :directory emacs-dir)
;; Configure
(run-program (format nil "~a/configure" emacs-dir)
(list "--with-sound=no" "--with-wide-int" "--enable-link-time-optimization")
:search t :output t :input t :error :output :wait t :directory emacs-dir)
;; Build
(run-program "make" '()
:search t :output t :input t :error :output :wait t :directory emacs-dir)
;; Install
(run-program "sudo" (list "make" "install")
:search t :output t :input t :error :output :wait t :directory emacs-dir))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment