public
Last active

  • Download Gist
build-emacs-osx.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#!/bin/env ruby
require 'fileutils'
 
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 --with-jpeg=no --with-gif=no --with-tiff=no --with-ns"
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."

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.