Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (80 sloc) 3.34 KB
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 2
bottle do
sha256 "03544fbc2da911adbd75ef5c15e7de3fad5860734edb7163f612d8e8ee2d2435" => :el_capitan
sha256 "2ee55629127590c4e676649eb7e1bdc76f596fb69a632b0afde2e4f34ec14b1d" => :yosemite
sha256 "ebab4ef644c3ef62e6406a636baca078a3c09254671d7cd8ef48db05bd7b11d0" => :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"
ENV.deparallelize
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/panel.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