Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man-db: symlink commands without 'g' prefix into libexec/bin #36769

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Formula/man-db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class ManDb < Formula
homepage "http://man-db.nongnu.org/"
url "https://download.savannah.gnu.org/releases/man-db/man-db-2.8.5.tar.xz"
sha256 "b64d52747534f1fe873b2876eb7f01319985309d5d7da319d2bc52ba1e73f6c1"
revision 1

bottle do
sha256 "4d1631d07729c3bc4187b3cdd2d617719dc1c50dfb8b54c4327b31e4634064d0" => :mojave
Expand Down Expand Up @@ -57,6 +58,20 @@ def install
system "make", "CFLAGS=#{ENV.cflags}"
system "make", "install"

# Symlink commands without 'g' prefix into libexec/bin and
# man pages into libexec/man
%w[apropos catman lexgrog man mandb manpath whatis].each do |cmd|
(libexec/"bin").install_symlink bin/"g#{cmd}" => cmd
end
(libexec/"sbin").install_symlink sbin/"gaccessdb" => "accessdb"
%w[apropos lexgrog man manconv manpath whatis zsoelim].each do |cmd|
(libexec/"man"/"man1").install_symlink man1/"g#{cmd}.1" => "#{cmd}.1"
end
(libexec/"man"/"man5").install_symlink man5/"gmanpath.5" => "manpath.5"
%w[accessdb catman mandb].each do |cmd|
(libexec/"man"/"man8").install_symlink man8/"g#{cmd}.8" => "#{cmd}.8"
end

# Symlink non-conflicting binaries and man pages
%w[catman lexgrog mandb].each do |cmd|
bin.install_symlink "g#{cmd}" => cmd
Expand All @@ -69,6 +84,14 @@ def install
man1.install_symlink "glexgrog.1" => "lexgrog.1"
end

def caveats; <<~EOS
Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "bin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/bin:$PATH"
EOS
end

test do
ENV["PAGER"] = "cat"
output = shell_output("#{bin}/gman true")
Expand Down