homebrew-core/Formula/ncurses.rb

100 lines
3.5 KiB
Ruby

class Ncurses < Formula
desc "Text-based UI library"
homepage "https://www.gnu.org/software/ncurses/"
url "https://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz"
mirror "https://ftpmirror.gnu.org/ncurses/ncurses-6.2.tar.gz"
sha256 "30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d"
license "MIT"
bottle do
rebuild 1
sha256 arm64_big_sur: "f71176d3a18401a49c1ef6da6e03987551161140c62353859f9db97d6520f5c5"
sha256 big_sur: "37587c0fbfd02b432e8a65522feadbb865fb754c3fe911b3a584abafb0f0effb"
sha256 catalina: "225b8df20eb79a762ea5163fb020c055a804d2c3289c676daa9277cc0c55f76f"
sha256 mojave: "66e1c57db9437cca11a5d6248e148a5ec00bbb0522c0d45b4fa3a95d5eba9783"
sha256 x86_64_linux: "b6d0a7fcd0b116c249ef3d07be0b240c6103881437b5cbaeb5c9174005ebc6e9"
end
keg_only :provided_by_macos
depends_on "pkg-config" => :build
on_linux do
depends_on "gpatch" => :build
end
def install
args = [
"--prefix=#{prefix}",
"--enable-pc-files",
"--with-pkg-config-libdir=#{lib}/pkgconfig",
"--enable-sigwinch",
"--enable-symlinks",
"--enable-widec",
"--with-shared",
"--with-gpm=no",
"--without-ada",
]
args << "--with-terminfo-dirs=#{share}/terminfo:/etc/terminfo:/lib/terminfo:/usr/share/terminfo" if OS.linux?
system "./configure", *args
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.major
%w[form menu ncurses panel].each do |name|
on_macos do
lib.install_symlink "lib#{name}w.#{major}.dylib" => "lib#{name}.dylib"
lib.install_symlink "lib#{name}w.#{major}.dylib" => "lib#{name}.#{major}.dylib"
end
on_linux do
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"
lib.install_symlink shared_library("libncurses") => shared_library("libcurses")
on_linux do
# libtermcap and libtinfo are provided by ncurses and have the
# same api. Help some older packages to find these dependencies.
# https://bugs.centos.org/view.php?id=11423
# https://bugs.launchpad.net/ubuntu/+source/ncurses/+bug/259139
lib.install_symlink "libncurses.so" => "libtermcap.so"
lib.install_symlink "libncurses.so" => "libtinfo.so"
end
(lib/"pkgconfig").install_symlink "ncursesw.pc" => "ncurses.pc"
(lib/"pkgconfig").install_symlink "formw.pc" => "form.pc"
(lib/"pkgconfig").install_symlink "menuw.pc" => "menu.pc"
(lib/"pkgconfig").install_symlink "panelw.pc" => "panel.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 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