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/"
|
|
|
|
url "http://www.isthe.com/chongo/src/calc/calc-2.12.4.8.tar.bz2"
|
|
|
|
sha1 "c92740e891b88561e8884bfa2238a7591be914ae"
|
2013-08-23 04:09:00 +00:00
|
|
|
|
|
|
|
devel do
|
2014-05-21 00:33:35 +00:00
|
|
|
url "http://www.isthe.com/chongo/src/calc/calc-2.12.4.13.tar.bz2"
|
|
|
|
sha1 "4d48fb78c903f10e9bcd05c42105498637dea834"
|
2013-08-23 04:09:00 +00:00
|
|
|
end
|
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"
|
2010-04-07 05:58:35 +00:00
|
|
|
s.change_make_var! "LIBCALC_SHLIB",
|
|
|
|
"-single_module -undefined dynamic_lookup -dynamiclib -install_name ${LIBDIR}/libcalc${LIB_EXT_VERSION}"
|
|
|
|
s.change_make_var! "LIBCUSTCALC_SHLIB",
|
|
|
|
"-single_module -undefined dynamic_lookup -dynamiclib -install_name ${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"
|
2014-06-27 19:38:30 +00:00
|
|
|
s.change_make_var! "LCC", "MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} #{ENV.cc}"
|
2014-05-21 00:33:35 +00:00
|
|
|
s.change_make_var! "MACOSX_DEPLOYMENT_TARGET", MacOS.version
|
2010-01-15 00:59:03 +00:00
|
|
|
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
|
|
|
|
output = `#{bin}/calc 0xA + 1`.strip
|
|
|
|
assert_equal "11", output
|
|
|
|
assert_equal 0, $?.exitstatus
|
|
|
|
end
|
2010-01-15 00:59:03 +00:00
|
|
|
end
|