homebrew-core/Formula/expat.rb

67 lines
1.9 KiB
Ruby
Raw Normal View History

2011-03-10 05:11:03 +00:00
class Expat < Formula
homepage "http://www.libexpat.org"
url "https://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz"
sha1 "b08197d146930a5543a7b99e871cba3da614f6f0"
revision 1
head ":pserver:anonymous:@expat.cvs.sourceforge.net:/cvsroot/expat", :using => :cvs
2014-08-08 10:05:04 +00:00
bottle do
cellar :any
2015-01-02 16:58:33 +00:00
sha1 "94e147c1dd1016c67b5b6dad727b36cd64e9d210" => :yosemite
sha1 "07aad05b79918e64e806e34b5656dc4caf9706fc" => :mavericks
sha1 "b9c6747187fd1d38d207c5c40c94731a7a0b5a1e" => :mountain_lion
2014-08-08 10:05:04 +00:00
end
2014-08-21 18:15:45 +00:00
keg_only :provided_by_osx, "OS X includes Expat 1.5."
option :universal
def install
ENV.universal_binary if build.universal?
2010-04-01 19:16:24 +00:00
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <stdio.h>
#include "expat.h"
static void XMLCALL my_StartElementHandler(
void *userdata,
const XML_Char *name,
const XML_Char **atts)
{
printf("tag:%s|", name);
}
static void XMLCALL my_CharacterDataHandler(
void *userdata,
const XML_Char *s,
int len)
{
printf("data:%.*s|", len, s);
}
int main()
{
static const char str[] = "<str>Hello, world!</str>";
int result;
XML_Parser parser = XML_ParserCreate("utf-8");
XML_SetElementHandler(parser, my_StartElementHandler, NULL);
XML_SetCharacterDataHandler(parser, my_CharacterDataHandler);
result = XML_Parse(parser, str, sizeof(str), 1);
XML_ParserFree(parser);
return result;
}
EOS
system ENV.cc, "test.c", "-lexpat", "-o", "test"
assert_equal "tag:str|data:Hello, world!|", shell_output("./test")
end
end