homebrew-core/Formula/libsecret.rb
2015-10-20 08:37:56 +01:00

81 lines
2.3 KiB
Ruby

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.3.tar.xz"
sha256 "f2bf1d0c5ab4640664f3e3c7ef6b086c180e50ff415720b5e22f96750dbf84c9"
bottle do
revision 1
sha256 "2d2521a8f0e7140e29fab70a32018e0d6232b1d3ed6df780a07afc11038e4591" => :el_capitan
sha256 "b10c996994f24dc95865a9d7d603b9ced6831f5db00458657eb411258a160d30" => :yosemite
sha256 "5acf286a422831b5fed6f2aef86497f9ff3f8ea048b5635d0c21ce7523e6e0ac" => :mavericks
end
depends_on "pkg-config" => :build
depends_on "gnu-sed" => :build
depends_on "intltool" => :build
depends_on "gettext" => :build
depends_on "docbook-xsl" => :build
depends_on "vala" => :optional
depends_on "gobject-introspection" => :recommended
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}
]
args << "--enable-gobject-introspection" if build.with? "gobject-introspection"
args << "--enable-vala" if build.with? "vala"
system "./configure", *args
# https://bugzilla.gnome.org/show_bug.cgi?id=734630
inreplace "Makefile", "sed", "gsed"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <libsecret/secret.h>
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();
}
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