homebrew-core/Formula/libsecret.rb

81 lines
2.3 KiB
Ruby
Raw Normal View History

2014-08-11 20:13:33 +00:00
class Libsecret < Formula
desc "Library for storing/retrieving passwords and other secrets"
2014-08-11 20:13:33 +00:00
homepage "https://wiki.gnome.org/Projects/Libsecret"
url "https://download.gnome.org/sources/libsecret/0.18/libsecret-0.18.4.tar.xz"
sha256 "0f29b51698198e6999c91f4adce3119c8c457f546b133a85baea5ea9010a19ed"
2014-08-11 20:13:33 +00:00
bottle do
2016-01-19 11:00:33 +00:00
sha256 "4d726f0a13c77ba0db1be9a8e6a033af5908e0dea0733ac20ec19bbf34d621b2" => :el_capitan
sha256 "9888c18e94b2e13588c5ff0d63890e2a9ae2ad3f301e92ca9a430da122d39a1b" => :yosemite
sha256 "73af85f9feaf25353d04347b047e9335bcdca4c165a19a001815213e27b68cb3" => :mavericks
end
2014-08-12 11:43:36 +00:00
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
2014-08-12 11:43:36 +00:00
depends_on "glib"
depends_on "libgcrypt"
2014-08-11 20:13:33 +00:00
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
2014-08-12 11:43:47 +00:00
# https://bugzilla.gnome.org/show_bug.cgi?id=734630
2014-08-12 11:43:36 +00:00
inreplace "Makefile", "sed", "gsed"
2014-08-12 11:43:47 +00:00
2014-08-11 20:13:33 +00:00
system "make", "install"
end
test do
2014-08-12 11:43:36 +00:00
(testpath/"test.c").write <<-EOS.undent
2014-08-11 20:13:33 +00:00
#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",
2014-08-11 20:13:33 +00:00
]
2014-08-12 11:43:36 +00:00
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
2014-08-11 20:13:33 +00:00
end
end