homebrew-core/Formula/mg3a.rb

52 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.160917.tar.gz"
sha256 "fece7142d7eb6ba4af74783734ec6847d30dcad9c2069602ca4687553a2340ec"
bottle do
cellar :any_skip_relocation
sha256 "36d90f731ec6051a22433443970401e99be952d72824799ba9037bd8109f982b" => :sierra
sha256 "35d0565ee73137a817bc3c702f187bc8e05d931913c43f14b4badf221ac6c1e0" => :el_capitan
sha256 "b2be99c8e905bf5ba17b5e42b8cfce97d573034d90ea4360cc1de421fdf75d41" => :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 = "-DALL" if build.with?("all")
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