2011-03-10 05:11:03 +00:00
|
|
|
class Expat < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "XML 1.0 parser"
|
2015-01-10 13:09:16 +00:00
|
|
|
homepage "http://www.libexpat.org"
|
|
|
|
url "https://downloads.sourceforge.net/project/expat/expat/2.1.0/expat-2.1.0.tar.gz"
|
2015-06-12 21:31:43 +00:00
|
|
|
mirror "https://fossies.org/linux/www/expat-2.1.0.tar.gz"
|
|
|
|
sha256 "823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86"
|
2015-01-02 15:53:41 +00:00
|
|
|
revision 1
|
2009-09-02 19:29:51 +00:00
|
|
|
|
2015-01-10 13:09:16 +00:00
|
|
|
head ":pserver:anonymous:@expat.cvs.sourceforge.net:/cvsroot/expat", :using => :cvs
|
|
|
|
|
2014-08-08 10:05:04 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-06-13 00:42:33 +00:00
|
|
|
revision 1
|
|
|
|
sha256 "159b1125406c697ec737f7ba548c2f43cde630e6c78ad02cb3071786f8799d6b" => :yosemite
|
|
|
|
sha256 "bfea179a87f894127f9a7454ef9bf31800b29f7579ec06cbed34aae02517f8f6" => :mavericks
|
|
|
|
sha256 "760375f5814e2b1b3c1f2f2c8b31b0ed37fdc5022b4ca484dc6b8f106d14a72a" => :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."
|
|
|
|
|
2014-01-30 09:21:03 +00:00
|
|
|
option :universal
|
|
|
|
|
2009-09-02 19:29:51 +00:00
|
|
|
def install
|
2014-01-30 09:21:03 +00:00
|
|
|
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}"
|
2015-01-10 13:09:16 +00:00
|
|
|
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")
|
2009-09-02 19:29:51 +00:00
|
|
|
end
|
|
|
|
end
|