class Libsecret < Formula desc "Library for storing/retrieving passwords and other secrets" homepage "https://wiki.gnome.org/Projects/Libsecret" url "https://download.gnome.org/sources/libsecret/0.18/libsecret-0.18.8.tar.xz" sha256 "3bfa889d260e0dbabcf5b9967f2aae12edcd2ddc9adc365de7a5cc840c311d15" bottle do sha256 "2a7841ebb35b24339e28543b80f73113774dc297dac8e5b6c072cb0602eb3515" => :mojave sha256 "6c761141ef146223b516a600c99fa75bb4863e60b09aa6b65da4bb19df3109c3" => :high_sierra sha256 "a3c6bc66b02a4e4f4a554705e4dcc0e6fbc670f0fa71f485dbb2e6c9392b049f" => :sierra end depends_on "docbook-xsl" => :build depends_on "gettext" => :build depends_on "gobject-introspection" => :build depends_on "pkg-config" => :build depends_on "vala" => :build depends_on "glib" depends_on "libgcrypt" def install ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog" args = %W[ --disable-debug --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --enable-introspection --enable-vala ] system "./configure", *args system "make", "install" end test do (testpath/"test.c").write <<~EOS #include const SecretSchema * example_get_schema (void) G_GNUC_CONST; const SecretSchema * example_get_schema (void) { static const SecretSchema the_schema = { "org.example.Password", SECRET_SCHEMA_NONE, { { "number", SECRET_SCHEMA_ATTRIBUTE_INTEGER }, { "string", SECRET_SCHEMA_ATTRIBUTE_STRING }, { "even", SECRET_SCHEMA_ATTRIBUTE_BOOLEAN }, { "NULL", 0 }, } }; return &the_schema; } int main() { example_get_schema(); return 0; } EOS flags = [ "-I#{include}/libsecret-1", "-I#{HOMEBREW_PREFIX}/include/glib-2.0", "-I#{HOMEBREW_PREFIX}/lib/glib-2.0/include", ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end