2012-11-12 01:35:09 +00:00
|
|
|
class Flex < Formula
|
2014-12-29 02:59:18 +00:00
|
|
|
homepage "http://flex.sourceforge.net"
|
2015-01-04 09:16:53 +00:00
|
|
|
url "https://downloads.sourceforge.net/flex/flex-2.5.39.tar.bz2"
|
|
|
|
sha1 "267794c709d5c50f2dcb48ff5d8dcbbfe40f953e"
|
2012-11-12 01:35:09 +00:00
|
|
|
|
2014-06-09 16:05:56 +00:00
|
|
|
bottle do
|
2014-10-22 01:39:08 +00:00
|
|
|
revision 1
|
|
|
|
sha1 "0a2bb0ce9a49330e5fd40b6e409a353972cf8840" => :yosemite
|
|
|
|
sha1 "0dd7fc9c36a6258b2e456e7dd0c5818d07e2a2ea" => :mavericks
|
|
|
|
sha1 "69b5f449a9c0bf5fd37f999dca5ccfd120a6f389" => :mountain_lion
|
2014-06-09 16:05:56 +00:00
|
|
|
end
|
|
|
|
|
2014-12-29 02:59:18 +00:00
|
|
|
keg_only :provided_by_osx, "Some formulae require a newer version of flex."
|
2012-11-12 01:35:09 +00:00
|
|
|
|
2014-12-29 02:59:18 +00:00
|
|
|
depends_on "gettext"
|
2012-11-12 01:35:09 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
2015-01-04 09:16:53 +00:00
|
|
|
"--disable-shared",
|
2012-11-12 01:35:09 +00:00
|
|
|
"--prefix=#{prefix}"
|
2014-12-29 02:59:18 +00:00
|
|
|
system "make", "install"
|
2012-11-12 01:35:09 +00:00
|
|
|
end
|
2014-12-29 03:11:41 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.flex").write <<-EOS.undent
|
|
|
|
CHAR [a-z][A-Z]
|
|
|
|
%%
|
|
|
|
{CHAR}+ printf("%s", yytext);
|
|
|
|
[ \\t\\n]+ printf("\\n");
|
|
|
|
%%
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
yyin = stdin;
|
|
|
|
yylex();
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system "#{bin}/flex", "test.flex"
|
|
|
|
system ENV.cc, "lex.yy.c", "-L#{lib}", "-lfl", "-o", "test"
|
|
|
|
assert_equal shell_output("echo \"Hello World\" | ./test"), <<-EOS.undent
|
|
|
|
Hello
|
|
|
|
World
|
|
|
|
EOS
|
|
|
|
end
|
2012-11-12 01:35:09 +00:00
|
|
|
end
|