From 74e953f891b065428f5216199633f6a9e8218972 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 25 Jan 2017 10:24:17 +0000 Subject: [PATCH] libxkbcommon: import from homebrew/x11. --- Formula/libxkbcommon.rb | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Formula/libxkbcommon.rb diff --git a/Formula/libxkbcommon.rb b/Formula/libxkbcommon.rb new file mode 100644 index 0000000000..d6e9a41911 --- /dev/null +++ b/Formula/libxkbcommon.rb @@ -0,0 +1,50 @@ +class Libxkbcommon < Formula + desc "Keyboard handling library" + homepage "https://xkbcommon.org/" + url "https://xkbcommon.org/download/libxkbcommon-0.7.1.tar.xz" + sha256 "ba59305d2e19e47c27ea065c2e0df96ebac6a3c6e97e28ae5620073b6084e68b" + + head do + url "https://github.com/xkbcommon/libxkbcommon.git" + + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "libtool" => :build + end + + depends_on :x11 + depends_on "bison" => :build + depends_on "pkg-config" => :build + + def install + system "./autogen.sh" if build.head? + inreplace "configure" do |s| + s.gsub! "-version-script $output_objdir/$libname.ver", "" + s.gsub! "$wl-version-script", "" + end + inreplace %w[Makefile.in Makefile.am] do |s| + s.gsub! "-Wl,--version-script=${srcdir}/xkbcommon.map", "" + s.gsub! "-Wl,--version-script=${srcdir}/xkbcommon-x11.map", "" + end + + system "./configure", "--disable-dependency-tracking", + "--disable-silent-rules", + "--prefix=#{prefix}" + system "make", "install" + end + + test do + (testpath/"test.c").write <<-EOS.undent + #include + #include + int main() { + return (xkb_context_new(XKB_CONTEXT_NO_FLAGS) == NULL) + ? EXIT_FAILURE + : EXIT_SUCCESS; + } + EOS + system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lxkbcommon", + "-o", "test" + system "./test" + end +end