2011-03-10 05:11:03 +00:00
|
|
|
class Confuse < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Configuration file parser library written in C"
|
2015-11-02 21:46:55 +00:00
|
|
|
homepage "https://github.com/martinh/libconfuse"
|
|
|
|
url "https://github.com/martinh/libconfuse/releases/download/v2.8/confuse-2.8.tar.xz"
|
|
|
|
sha256 "2a8102bfa3ccc846c14d94a81b0abfb4f5e855809f89ff3722aca1a9f314ea0d"
|
2010-05-21 16:33:41 +00:00
|
|
|
|
2014-10-22 14:41:51 +00:00
|
|
|
bottle do
|
2015-11-03 03:21:08 +00:00
|
|
|
cellar :any
|
|
|
|
sha256 "dac00feeb2cd3cb2897afab338d01e84e8132a89e2bbe5d23cf5169f6c92b3b0" => :el_capitan
|
|
|
|
sha256 "0998a46243bfb613e3cc0c7a7d2534e88dc0a89a69b820c0dea20da7f54ccee8" => :yosemite
|
|
|
|
sha256 "321babd2b297a0892906647860d8443487420b2ed36b62339cf2ae1bb5c9921f" => :mavericks
|
2014-10-22 14:41:51 +00:00
|
|
|
end
|
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "pkg-config" => :build
|
2010-05-21 16:33:41 +00:00
|
|
|
|
|
|
|
def install
|
2013-01-27 02:19:47 +00:00
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}"
|
2015-11-02 21:46:55 +00:00
|
|
|
system "make", "check"
|
2015-08-03 12:55:31 +00:00
|
|
|
system "make", "install"
|
2010-05-21 16:33:41 +00:00
|
|
|
end
|
2015-11-02 21:46:55 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
|
|
#include <confuse.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
cfg_opt_t opts[] =
|
|
|
|
{
|
|
|
|
CFG_STR("hello", NULL, CFGF_NONE),
|
|
|
|
CFG_END()
|
|
|
|
};
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
cfg_t *cfg = cfg_init(opts, CFGF_NONE);
|
|
|
|
if (cfg_parse_buf(cfg, "hello=world") == CFG_SUCCESS)
|
|
|
|
printf("%s\\n", cfg_getstr(cfg, "hello"));
|
|
|
|
cfg_free(cfg);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-lconfuse", "-o", "test"
|
|
|
|
assert_match /world/, shell_output("./test")
|
|
|
|
end
|
2010-05-21 16:33:41 +00:00
|
|
|
end
|