Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mig
Forked from wfarr/build-emacs-osx.rb
Created December 24, 2008 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mig/39590 to your computer and use it in GitHub Desktop.
Save mig/39590 to your computer and use it in GitHub Desktop.
build and install osx emacs from source
#!/bin/env ruby
require 'fileutils'
config_opts = ["--with-jpeg=no", "--with-gif=no", "--with-tiff=no", "--with-ns"]
source_dir = "#{ENV['HOME']}/Source"
repo_dir = "#{source_dir}/emacs"
install_dir = "#{repo_dir}/nextstep/Emacs.app"
install_target = "/Applications/Emacs.app"
def git(command); system "git #{command}"; end
def make(command); system "make #{command}"; end
unless File.directory?(repo_dir)
puts "Need to clone emacs repo first"
Dir.mkdir(source_dir) unless File.directory?(source_dir)
Dir.chdir(source_dir)
git "clone git://repo.or.cz/emacs.git"
first_time = true
end
Dir.chdir(repo_dir)
pull = `git pull`
if (pull =~ /Already up-to-date\./) && (!first_time)
puts "No commits to pull in. Not building."
exit
else
puts "There are new commits. Building."
end
make "clean"
system "./configure #{config_opts.join(' ')}"
make "-j2"
make "install"
puts "Installing Emacs.app"
FileUtils.rm_rf(install_target) if File.directory?(install_target)
FileUtils.move(install_dir, "/Applications/")
puts "All done. Just run Emacs.app from your Applications folder."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment