homebrew-core/Formula/libosinfo.rb
2019-02-04 19:38:21 +01:00

72 lines
1.9 KiB
Ruby

class Libosinfo < Formula
desc "The Operating System information database"
homepage "https://libosinfo.org/"
url "https://releases.pagure.org/libosinfo/libosinfo-1.3.0.tar.gz"
sha256 "2159b969fe90715ee779eb3921365a9148e862e1ed60328ef1ba57714e511da5"
bottle do
sha256 "f58ae2f93837a243b8618018e61507420533ca22eb211e8358d10417a8ea0de0" => :mojave
sha256 "0e8ee2dc06d18db71b4fff7034fa3cef8f2b486f4915d872f7cc6c9d134acd7c" => :high_sierra
sha256 "a21fee88638e7ee314dd50f81e7db67e0c60fce70fed0a481727ae65f24aec1d" => :sierra
end
depends_on "gobject-introspection" => :build
depends_on "intltool" => :build
depends_on "pkg-config" => :build
depends_on "check"
depends_on "gettext"
depends_on "glib"
depends_on "libsoup"
depends_on "libxml2"
def install
# avoid wget dependency
inreplace "Makefile.in", "wget -q -O", "curl -o"
args = %W[
--prefix=#{prefix}
--localstatedir=#{var}
--mandir=#{man}
--sysconfdir=#{etc}
--disable-silent-rules
--disable-udev
--disable-vala
--enable-introspection
--enable-tests
]
system "./configure", *args
# Compilation of docs doesn't get done if we jump straight to "make install"
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <osinfo/osinfo.h>
int main(int argc, char *argv[]) {
OsinfoPlatformList *list = osinfo_platformlist_new();
return 0;
}
EOS
gettext = Formula["gettext"]
glib = Formula["glib"]
flags = %W[
-I#{gettext.opt_include}
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{include}/libosinfo-1.0
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
-L#{lib}
-losinfo-1.0
-lglib-2.0
-lgobject-2.0
-lintl
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
end
end