From d6e92297af983a7316e0acd31ebf75fb05dd031c Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Wed, 4 Sep 2024 01:07:05 +0800 Subject: [PATCH] ncurses: update 6.5 bottle. --- Formula/n/ncurses.rb | 100 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Formula/n/ncurses.rb diff --git a/Formula/n/ncurses.rb b/Formula/n/ncurses.rb new file mode 100644 index 00000000000..a440fdeda6c --- /dev/null +++ b/Formula/n/ncurses.rb @@ -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