forked from rdowinton/homebrew-x11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libxkbcommon.rb
47 lines (42 loc) · 1.55 KB
/
libxkbcommon.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class Libxkbcommon < Formula
desc "Keyboard handling library"
homepage "http://xkbcommon.org/"
url "http://xkbcommon.org/download/libxkbcommon-0.5.0.tar.xz"
sha256 "90bd7824742b9a6f52a6cf80e2cadd6f5349cf600a358d08260772615b89d19c"
head "https://github.com/xkbcommon/libxkbcommon.git"
bottle do
sha256 "c138b2459677414251a3a904d51a3151a90f0a32909641b7ca003241c70ceb1c" => :yosemite
sha256 "65335a728e42b65b02d50508c1dcfea2f1173ab675b319d7060dcab464d9aa11" => :mavericks
sha256 "b04ed8bb44caee806c2fdb8a7b364ca556d26495a28099ce918f5a9ac3d73885" => :mountain_lion
end
depends_on :x11
depends_on "bison" => :build
depends_on "pkg-config" => :build
def install
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", "-L#{lib}", "-lxkbcommon", "-o", "test"
system "./test"
end
end