Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/bin/env ruby
  2. require 'fileutils'
  3.  
  4. config_opts = ["--with-jpeg=no", "--with-gif=no", "--with-tiff=no", "--with-ns"]
  5.  
  6. source_dir = "#{ENV['HOME']}/Source"
  7. repo_dir = "#{source_dir}/emacs"
  8. install_dir = "#{repo_dir}/nextstep/Emacs.app"
  9. install_target = "/Applications/Emacs.app"
  10.  
  11. def git(command); system "git #{command}"; end
  12. def make(command); system "make #{command}"; end
  13.  
  14. unless File.directory?(repo_dir)
  15. puts "Need to clone emacs repo first"
  16. Dir.mkdir(source_dir) unless File.directory?(source_dir)
  17. Dir.chdir(source_dir)
  18. git "clone git://repo.or.cz/emacs.git"
  19. first_time = true
  20. end
  21.  
  22. Dir.chdir(repo_dir)
  23. pull = `git pull`
  24. if (pull =~ /Already up-to-date\./) && (!first_time)
  25. puts "No commits to pull in. Not building."
  26. exit
  27. else
  28. puts "There are new commits. Building."
  29. end
  30.  
  31. make "clean"
  32. system "./configure #{config_opts.join(' ')}"
  33. make "-j2"
  34. make "install"
  35.  
  36. puts "Installing Emacs.app"
  37. FileUtils.rm_rf(install_target) if File.directory?(install_target)
  38. FileUtils.move(install_dir, "/Applications/")
  39.  
  40. puts "All done. Just run Emacs.app from your Applications folder."
Add Comment
Please, Sign In to add comment