util-linux: add linux-only dependency, make keg-only only on mac (#71854)

master
Michka Popoff 2021-04-03 10:00:39 +02:00 committed by GitHub
parent d625e886a6
commit 11091ea258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 47 deletions

View File

@ -20,63 +20,65 @@ class UtilLinux < Formula
sha256 mojave: "de7bfed47b70d497e2406b7813b966aad7a0436e6fd129d4e12f5df5757e3ef9"
end
keg_only "macOS provides the uuid.h header"
keg_only :shadowed_by_macos, "macOS provides the uuid.h header"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
uses_from_macos "ncurses"
uses_from_macos "zlib"
# These binaries are already available in macOS
def system_bins
%w[
cal col colcrt colrm
getopt
hexdump
logger look
mesg more
nologin
renice rev
ul
whereis
]
end
on_macos do
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
# Fix build for MacOS
# Remove in the next release
# Also remove autoconf/automake/libtool/pkg-config dependencies and autogen.sh call
patch do
url "https://github.com/karelzak/util-linux/commit/71ba2792ab3f96b5f5d5d3b0a68d35ecfd0f93a2.patch?full_index=1"
sha256 "bc5188d3f41a7f248ba622f51c8ab8fed0e05355cbe20a5d3b02bbc274e2c7b4"
# Fix build for MacOS
# Remove in >2.36.2
# Also remove autoconf/automake/libtool/pkg-config dependencies and autogen.sh call
patch do
url "https://github.com/karelzak/util-linux/commit/71ba2792ab3f96b5f5d5d3b0a68d35ecfd0f93a2.patch?full_index=1"
sha256 "bc5188d3f41a7f248ba622f51c8ab8fed0e05355cbe20a5d3b02bbc274e2c7b4"
end
end
def install
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-ipcs", # does not build on macOS
"--disable-ipcrm", # does not build on macOS
"--disable-libmount", # does not build on macOS
"--disable-wall", # already comes with macOS
"--enable-libuuid" # conflicts with ossp-uuid
system "make", "install"
# Remove binaries already shipped by macOS
system_bins.each do |prog|
rm_f bin/prog
rm_f sbin/prog
rm_f man1/"#{prog}.1"
rm_f man8/"#{prog}.8"
rm_f share/"bash-completion/completions/#{prog}"
on_macos do
system "./autogen.sh"
end
args = [
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
]
on_macos do
args << "--disable-ipcs" # does not build on macOS
args << "--disable-ipcrm" # does not build on macOS
args << "--disable-wall" # already comes with macOS
args << "--disable-libmount" # does not build on macOS
args << "--enable-libuuid" # conflicts with ossp-uuid
args << "--disable-wall" # already comes with macOS
end
on_linux do
args << "--disable-use-tty-group" # Fix chgrp: changing group of 'wall': Operation not permitted
args << "--disable-kill" # Conflicts with coreutils.
args << "--disable-cal" # Conflicts with bsdmainutils
args << "--without-systemd" # Do not install systemd files
args << "--with-bashcompletiondir=#{bash_completion}"
args << "--disable-chfn-chsh"
args << "--disable-login"
args << "--disable-su"
args << "--disable-runuser"
args << "--disable-makeinstall-chown"
args << "--disable-makeinstall-setuid"
args << "--without-python"
end
system "./configure", *args
system "make", "install"
# install completions only for installed programs
Pathname.glob("bash-completion/*") do |prog|
bash_completion.install prog if (bin/prog.basename).exist? || (sbin/prog.basename).exist?
@ -109,8 +111,6 @@ class UtilLinux < Formula
<<~EOS
The following tools are not supported for macOS, and are therefore not included:
#{Formatter.columns(linux_only_bins)}
The following tools are shipped by macOS, and are therefore not included:
#{Formatter.columns(system_bins)}
EOS
end
end