Skip to content

Instantly share code, notes, and snippets.

@jl2
Created November 26, 2014 01:01
Show Gist options
  • Save jl2/d6b0f0829ee45c5e8e5f to your computer and use it in GitHub Desktop.
Save jl2/d6b0f0829ee45c5e8e5f to your computer and use it in GitHub Desktop.
updateemacs
#!/usr/bin/lisp --script
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(let* ((bzr-out-string (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t))
(done-str "No revisions or tags to pull.")
(emacs-dir "/home/jeremiah/oss_src/emacs")
(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 "/home/jeremiah/oss_src/emacs")
(force-build (string= "--force" (second sb-ext:*posix-argv*))))
(with-output-to-string (s git-out-string)
(run-program "git" (list "pull") :search t :output s :input t :error :output :wait t :directory emacs-dir))
(if (or force-build (not (string= done-str (subseq git-out-string 0 len-done))))
(progn
(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)
(run-program "make" '() :search t :output t :input t :error :output :wait t :directory emacs-dir)
(run-program "sudo" (list "make" "install") :search t :output t :input t :error :output :wait t :directory emacs-dir))
(format t "Already up to date!~%")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment