Mac – Homebrew Formula for emacs’ VM (View Mail)

emacsemailhomebrew

Can anyone help with a homebrew formula to install emacs' VM ("View Mail"), located:

http://www.nongnu.org/viewmail/
https://code.launchpad.net/vm

I can get as far as a script, that should look like this:

bzr get lp:vm
cd vm
./configure --with-emacs=~/.homebrew/bin/emacs --prefix=~/.homebrew 
make
make install

This clearly depends on emacs & bzr. It should also be updated any time emacs is and any time "bzr get" returns a new version. I have looked at a few example formulae which include a url for wget and a sha1sum of the downloaded file, but since this script doesn't involve these, I'm having trouble knowing where to start.

Here's what I have looking at those example formulae, but as I say, I don't know what to do with the "url" and "sha1" methods:

require "formula"

class ViewMail < Formula
  homepage "http://www.nongnu.org/viewmail/"
  url "what do I do with this when download uses bzr get ...?"
  sha1 "ditto"

 depends_on :emacs
 depends_on :bzr

  def install
    system "bzr", "get", "lp:vm"
    system "cd", "vm"
    system "./configure", "--with-emacs=#{prefix}/bin/emacs", "--prefix=#{prefix}" 
    system "make"
    system "make", "install"
  end

end

Best Answer

This works:

class Vm < Formula
  desc "VM is a mail reader that runs under XEmacs and GNU Emacs."
  homepage "https://launchpad.net/vm"
  url "https://launchpad.net/vm/8.2.x/8.1.93a/+download/vm-8.1.93a.tgz"
  version "8.1.93a"
  sha256 "9eab4cca6d8e4f3c5b2ab0293caecda3207b8f7e5d1e620d067898c35204235e"

  depends_on :emacs => ["23", :build]

  def install
    system "./configure", "--with-emacs=#{HOMEBREW_PREFIX}/bin/emacs",
            "--prefix=#{prefix}"
    system "make"
    system "make install"
 end

def caveats; <<-EOS.undent
  To use add to .emacs:
  (add-to-list 'load-path "/usr/local/Cellar/vm/8.1.93a/share/emacs/site-lisp/vm")
  (require 'vm-autoloads)
  EOS
end

Though I'm not sure how to dynamically list the necessary prefix for the load-path in the caveats.