forked from keitheis/homebrew-dupes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathncurses.rb
95 lines (78 loc) · 3 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
class Ncurses < Formula
desc "Text-based UI library"
homepage "https://www.gnu.org/s/ncurses/"
url "http://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
sha256 "3d608e7522a8855cb760ba8d8b3e7fa2e9896389844f6b89f67f652e710a08c6" => :el_capitan
sha256 "c22a8d91d717757fe2e1c8a84c41151bd81e1651368681fe20a0283d8e5e745f" => :yosemite
sha256 "87ebfc0fd5a86ac7a3a5d574f0cb513b5e8d856768b31609451d9e655ece8f19" => :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 http://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"
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]
cd lib do
%w[form menu ncurses panel].each do |name|
if OS.mac?
ln_s "lib#{name}w.#{major}.dylib", "lib#{name}.dylib"
ln_s "lib#{name}w.#{major}.dylib", "lib#{name}.#{major}.dylib"
else
ln_s "lib#{name}w.so.#{major}", "lib#{name}.so"
ln_s "lib#{name}w.so.#{major}", "lib#{name}.so.#{major}"
end
ln_s "lib#{name}w.a", "lib#{name}.a"
ln_s "lib#{name}w_g.a", "lib#{name}_g.a"
end
ln_s "libncurses++w.a", "libncurses++.a"
ln_s "libncurses.a", "libcurses.a"
if OS.mac?
ln_s "libncurses.dylib", "libcurses.dylib"
else
ln_s "libncurses.so", "libcurses.so"
end
end
cd bin do
ln_s "ncursesw#{major}-config", "ncurses#{major}-config"
end
ln_s [
"ncursesw/curses.h", "ncursesw/form.h", "ncursesw/ncurses.h",
"ncursesw/term.h", "ncursesw/termcap.h"], include
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