homebrew-core/Formula/gnu-units.rb
2019-01-13 12:22:56 +01:00

46 lines
1.5 KiB
Ruby

class GnuUnits < Formula
desc "GNU unit conversion tool"
homepage "https://www.gnu.org/software/units/"
url "https://ftp.gnu.org/gnu/units/units-2.18.tar.gz"
mirror "https://ftpmirror.gnu.org/units/units-2.18.tar.gz"
sha256 "64959c231c280ceb4f3e6ae6a19b918247b6174833f7f1894704c444869c4678"
revision 1
bottle do
sha256 "d851d3123b6d3c7aa070bd54e7c93afdc4c489c9ee5e40dc181173eafe3e64ef" => :mojave
sha256 "5c3cd6c3c935208569b90f5747870d550337b447a155c651258c1eea91729978" => :high_sierra
sha256 "0479216ddee013129a2d365d7f8167acf54be841299d7c0b57c0f76d48500992" => :sierra
end
depends_on "readline"
def install
args = %W[
--prefix=#{prefix}
--with-installed-readline
--program-prefix=g
]
system "./configure", *args
system "make", "install"
(libexec/"gnubin").install_symlink bin/"gunits" => "units"
(libexec/"gnubin").install_symlink bin/"gunits_cur" => "units_cur"
(libexec/"gnuman/man1").install_symlink man1/"gunits.1" => "units.1"
libexec.install_symlink "gnuman" => "man"
end
def caveats; <<~EOS
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
end
test do
assert_equal "* 18288", shell_output("#{bin}/gunits '600 feet' 'cm' -1").strip
assert_equal "* 18288", shell_output("#{opt_libexec}/gnubin/units '600 feet' 'cm' -1").strip
end
end