Skip to content

Instantly share code, notes, and snippets.

@raven-rock
Created August 6, 2019 13:48
Show Gist options
  • Save raven-rock/c5e1ce646cd5fac254bc0c0a26ee9e5b to your computer and use it in GitHub Desktop.
Save raven-rock/c5e1ce646cd5fac254bc0c0a26ee9e5b to your computer and use it in GitHub Desktop.
(Trying to) Homebrew install `util-linux` with `column`
class UtilLinux < Formula
desc "Collection of Linux utilities"
homepage "https://github.com/karelzak/util-linux"
url "https://www.kernel.org/pub/linux/utils/util-linux/v2.34/util-linux-2.34.tar.xz"
sha256 "743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5"
bottle do
cellar :any
sha256 "3fb25026099ea42c1c54b80cad6bbdf9bf09b0e0e967ca4690698d0d2d379483" => :mojave
sha256 "7d7e421229cbf8b0ac5fbe1f0ffc7d18a3e0ce9dc09090bd346f676111cc2bb7" => :high_sierra
sha256 "1c0c0011db6ecf47a6ad673c38878b5265ce82f6aba4b6bf7d4733d4513b6c7a" => :sierra
end
keg_only "macOS provides the uuid.h header"
def install
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-wall", # already comes with macOS
"--enable-libuuid" # conflicts with ossp-uuid
# "--disable-libsmartcols" # macOS already ships 'column'
system "make", "install"
# Remove binaries already shipped by macOS
%w[cal col colcrt colrm getopt hexdump logger nologin look mesg more renice rev ul whereis].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}"
end
# install completions only for installed programs
Pathname.glob("bash-completion/*") do |prog|
if (bin/prog.basename).exist? || (sbin/prog.basename).exist?
bash_completion.install prog
end
end
end
test do
out = shell_output("#{bin}/namei -lx /usr").split("\n")
assert_equal ["f: /usr", "Drwxr-xr-x root wheel /", "drwxr-xr-x root wheel usr"], out
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment