2014-05-21 00:33:35 +00:00
|
|
|
require "formula"
|
2010-01-15 00:59:03 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Calc < Formula
|
2014-05-21 00:33:35 +00:00
|
|
|
homepage "http://www.isthe.com/chongo/tech/comp/calc/"
|
2014-09-24 17:40:28 +00:00
|
|
|
url "http://www.isthe.com/chongo/src/calc/calc-2.12.4.14.tar.bz2"
|
|
|
|
sha1 "352192be34fc9c5194fffe94b8aef71dae15c2cb"
|
2010-01-15 00:59:03 +00:00
|
|
|
|
2014-05-21 00:33:35 +00:00
|
|
|
depends_on "readline"
|
2010-01-15 00:59:03 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.deparallelize
|
|
|
|
|
2014-05-21 00:33:35 +00:00
|
|
|
ENV["EXTRA_CFLAGS"] = ENV.cflags
|
|
|
|
ENV["EXTRA_LDFLAGS"] = ENV.ldflags
|
2010-01-15 00:59:03 +00:00
|
|
|
|
2014-05-21 00:33:35 +00:00
|
|
|
readline = Formula["readline"]
|
2010-01-15 00:59:03 +00:00
|
|
|
inreplace "Makefile" do |s|
|
2014-06-27 19:38:30 +00:00
|
|
|
s.change_make_var! "INCDIR", "#{MacOS.sdk_path}/usr/include"
|
2010-01-15 00:59:03 +00:00
|
|
|
s.change_make_var! "BINDIR", bin
|
|
|
|
s.change_make_var! "LIBDIR", lib
|
|
|
|
s.change_make_var! "MANDIR", man1
|
2014-06-27 19:38:30 +00:00
|
|
|
s.change_make_var! "CALC_INCDIR", "#{include}/calc"
|
2010-01-15 00:59:03 +00:00
|
|
|
s.change_make_var! "CALC_SHAREDIR", "#{share}/calc"
|
|
|
|
s.change_make_var! "USE_READLINE", "-DUSE_READLINE"
|
|
|
|
s.change_make_var! "READLINE_LIB", "-L#{readline.lib} -lreadline"
|
|
|
|
s.change_make_var! "READLINE_EXTRAS", "-lhistory -lncurses"
|
|
|
|
end
|
|
|
|
|
|
|
|
system "make"
|
2014-05-21 00:33:35 +00:00
|
|
|
system "make", "install"
|
2014-02-09 13:56:22 +00:00
|
|
|
libexec.install "#{bin}/cscript"
|
2010-01-15 00:59:03 +00:00
|
|
|
end
|
2014-02-05 21:11:28 +00:00
|
|
|
|
|
|
|
test do
|
2014-05-04 19:12:41 +00:00
|
|
|
assert_equal "11", shell_output("#{bin}/calc 0xA + 1").strip
|
2014-02-05 21:11:28 +00:00
|
|
|
end
|
2010-01-15 00:59:03 +00:00
|
|
|
end
|