forked from keitheis/homebrew-dupes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ncurses.rb
96 lines (78 loc) · 3.29 KB
/
ncurses.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
class Ncurses < Formula
desc "Text-based UI library"
homepage "https://www.gnu.org/s/ncurses/"
url "https://ftpmirror.gnu.org/ncurses/ncurses-6.0.tar.gz"
mirror "https://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz"
sha256 "f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260"
revision 1
bottle do
revision 1
sha256 "ace4b172a3be12aa38e7bcedb4693ce560b2735c119c6ac549284e08b4fd3684" => :el_capitan
sha256 "8e630a740f6930195ee6f292e6ed9585ce3318d946abac976131e6092524044c" => :yosemite
sha256 "b37af8a27570fb44ae539a02e66d5e5391ddf3eae37d5ca93a020f9a12b32cca" => :mavericks
end
keg_only :provided_by_osx
option :universal
depends_on "pkg-config" => :build
def install
ENV.universal_binary if build.universal?
# Fix the build for GCC 5.1
# error: expected ')' before 'int' in definition of macro 'mouse_trafo'
# See https://lists.gnu.org/archive/html/bug-ncurses/2014-07/msg00022.html
# and http://trac.sagemath.org/ticket/18301
# Disable linemarker output of cpp
ENV.append "CPPFLAGS", "-P"
(lib/"pkgconfig").mkpath
system "./configure", "--prefix=#{prefix}",
"--enable-pc-files",
"--with-pkg-config-libdir=#{lib}/pkgconfig",
"--enable-sigwinch",
"--enable-symlinks",
"--enable-widec",
"--mandir=#{man}",
"--with-manpage-format=normal",
"--with-shared",
"--with-gpm=no"
system "make", "install"
make_libncurses_symlinks
prefix.install "test"
(prefix/"test").install "install-sh", "config.sub", "config.guess"
end
def make_libncurses_symlinks
major = version.to_s.split(".")[0]
%w[form menu ncurses panel].each do |name|
if OS.mac?
lib.install_symlink "lib#{name}w.#{major}.dylib" => "lib#{name}.dylib"
lib.install_symlink "lib#{name}w.#{major}.dylib" => "lib#{name}.#{major}.dylib"
else
lib.install_symlink "lib#{name}w.so.#{major}" => "lib#{name}.so"
lib.install_symlink "lib#{name}w.so.#{major}" => "lib#{name}.so.#{major}"
end
lib.install_symlink "lib#{name}w.a" => "lib#{name}.a"
lib.install_symlink "lib#{name}w_g.a" => "lib#{name}_g.a"
end
lib.install_symlink "libncurses++w.a" => "libncurses++.a"
lib.install_symlink "libncurses.a" => "libcurses.a"
if OS.mac?
lib.install_symlink "libncurses.dylib" => "libcurses.dylib"
else
lib.install_symlink "libncurses.so" => "libcurses.so"
lib.install_symlink "libncurses.so" => "libtinfo.so"
end
(lib/"pkgconfig").install_symlink "ncursesw.pc" => "ncurses.pc"
bin.install_symlink "ncursesw#{major}-config" => "ncurses#{major}-config"
include.install_symlink [
"ncursesw/curses.h", "ncursesw/form.h", "ncursesw/ncurses.h",
"ncursesw/term.h", "ncursesw/termcap.h"]
end
test do
ENV["TERM"] = "xterm"
system bin/"tput", "cols"
system prefix/"test/configure", "--prefix=#{testpath}/test",
"--with-curses-dir=#{prefix}"
system "make", "install"
system testpath/"test/bin/keynames"
system testpath/"test/bin/test_arrays"
system testpath/"test/bin/test_vidputs"
end
end