homebrew-core/Formula/libxkbcommon.rb
2017-01-27 09:10:10 +00:00

56 lines
1.7 KiB
Ruby

class Libxkbcommon < Formula
desc "Keyboard handling library"
homepage "https://xkbcommon.org/"
url "https://xkbcommon.org/download/libxkbcommon-0.7.1.tar.xz"
sha256 "ba59305d2e19e47c27ea065c2e0df96ebac6a3c6e97e28ae5620073b6084e68b"
bottle do
sha256 "f315b5f0587687bfe2a859fc2440980820031a8d984c0b707f468f886953ab0c" => :sierra
sha256 "b28c61c01bf2b30c2d9250ef4ba8650d3a4040802e2184f1c3673ba717f09ea0" => :el_capitan
sha256 "87d2bf3128550c3fd80f8d91908c888aa8c19361a189c59a9478af925668710b" => :yosemite
end
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 <stdlib.h>
#include <xkbcommon/xkbcommon.h>
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