Skip to content

Commit

Permalink
ncurses: update 6.5 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Sep 3, 2024
1 parent b916f1a commit d6e9229
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions Formula/n/ncurses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
class Ncurses < Formula
desc "Text-based UI library"
homepage "https://invisible-island.net/ncurses/announce.html"
url "https://ftp.gnu.org/gnu/ncurses/ncurses-6.5.tar.gz"
mirror "https://invisible-mirror.net/archives/ncurses/ncurses-6.5.tar.gz"
mirror "ftp://ftp.invisible-island.net/ncurses/ncurses-6.5.tar.gz"
mirror "https://ftpmirror.gnu.org/ncurses/ncurses-6.5.tar.gz"
sha256 "136d91bc269a9a5785e5f9e980bc76ab57428f604ce3e5a5a90cebc767971cc6"
license "MIT"

bottle do
root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/ncurses-6.5"
sha256 cellar: :any_skip_relocation, aarch64_linux: "ee975dcbe77d55480cf844f2dad13bde9a17bf8808ac8a524d9be0a9f9b42cd4"
end

keg_only :provided_by_macos

depends_on "pkg-config" => :build

on_linux do
depends_on "gpatch" => :build
end

def install
# Workaround for
# macOS: mkdir: /usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/12: Operation not permitted
# Linux: configure: error: expected a pathname, not ""
(lib/"pkgconfig").mkpath

args = [
"--prefix=#{prefix}",
"--enable-pc-files",
"--with-pkg-config-libdir=#{lib}/pkgconfig",
"--enable-sigwinch",
"--enable-symlinks",
"--enable-widec",
"--with-shared",
"--with-cxx-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

# Avoid hardcoding Cellar paths in client software.
inreplace bin/"ncursesw6-config", prefix, opt_prefix
pkgshare.install "test"
(pkgshare/"test").install "install-sh", "config.sub", "config.guess"
end

def make_libncurses_symlinks
major = version.major.to_s

%w[form menu ncurses panel ncurses++].each do |name|
lib.install_symlink shared_library("lib#{name}w", major) => shared_library("lib#{name}")
lib.install_symlink shared_library("lib#{name}w", major) => shared_library("lib#{name}", major)
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.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" => "ncurses"
include.install_symlink [
"ncursesw/curses.h", "ncursesw/form.h", "ncursesw/ncurses.h",
"ncursesw/panel.h", "ncursesw/term.h", "ncursesw/termcap.h"
]
end

test do
refute_match prefix.to_s, shell_output("#{bin}/ncursesw6-config --prefix")
refute_match share.to_s, shell_output("#{bin}/ncursesw6-config --terminfo-dirs")

ENV["TERM"] = "xterm"

system pkgshare/"test/configure", "--prefix=#{testpath}",
"--with-curses-dir=#{prefix}"
system "make", "install"
system testpath/"bin/ncurses-examples"
end
end

0 comments on commit d6e9229

Please sign in to comment.