homebrew-core/Formula/mg3a.rb
2016-10-17 14:41:59 +01:00

51 lines
1.8 KiB
Ruby

class Mg3a < Formula
desc "Small Emacs-like editor inspired by mg with UTF8 support"
homepage "http://www.bengtl.net/files/mg3a/"
url "http://www.bengtl.net/files/mg3a/mg3a.161017.tar.gz"
sha256 "e97951850f9755e5f754e46f5d198b9d99a5b55a2a67deb0b9159f22b4ff39be"
bottle do
cellar :any_skip_relocation
sha256 "e257022f63f28ed08c7302fa1fd53ec1dd473280927b6cbea5a7c22e077c4ab2" => :sierra
sha256 "dd3e30d9e1b1cf19e3ec54414a295b155d908dd30e76c728b53e91f72b43d1c2" => :el_capitan
sha256 "f2f3e4ca89f9c90b57a47ecd7d5a29ab674da7bc9341fdc31b09a09bf99de372" => :yosemite
end
option "with-c-mode", "Include the original C mode"
option "with-clike-mode", "Include the C mode that also handles Perl and Java"
option "with-python-mode", "Include the Python mode"
option "with-most", "Include c-like and python modes, user modes and user macros"
option "with-all", "Include all fancy stuff"
conflicts_with "mg", :because => "both install `mg`"
def install
if build.with?("all")
mg3aopts = %w[-DALL]
else
mg3aopts = %w[-DDIRED -DPREFIXREGION -DUSER_MODES -DUSER_MACROS]
mg3aopts << "-DLANGMODE_C" if build.with?("c-mode")
mg3aopts << "-DLANGMODE_PYTHON" if build.with?("python-mode") || build.with?("most")
mg3aopts << "-DLANGMODE_CLIKE" if build.with?("clike-mode") || build.with?("most")
end
system "make", "CDEFS=#{mg3aopts * " "}", "LIBS=-lncurses", "COPT=-O3"
bin.install "mg"
doc.install Dir["bl/dot.*"]
doc.install Dir["README*"]
end
test do
(testpath/"command.sh").write <<-EOS.undent
#!/usr/bin/expect -f
set timeout -1
spawn #{bin}/mg
match_max 100000
send -- "\u0018\u0003"
expect eof
EOS
(testpath/"command.sh").chmod 0755
system testpath/"command.sh"
end
end