2010-01-15 00:59:03 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Calc < Formula
|
2013-01-27 02:03:35 +00:00
|
|
|
homepage 'http://www.isthe.com/chongo/tech/comp/calc/'
|
2013-08-23 04:09:00 +00:00
|
|
|
url 'http://www.isthe.com/chongo/src/calc/calc-2.12.4.8.tar.bz2'
|
|
|
|
sha1 'c92740e891b88561e8884bfa2238a7591be914ae'
|
|
|
|
|
|
|
|
devel do
|
|
|
|
url 'http://www.isthe.com/chongo/src/calc/calc-2.12.4.10.tar.bz2'
|
|
|
|
sha1 '25e52d49d8c292283130282c44d9d7ec45a31598'
|
|
|
|
end
|
2010-01-15 00:59:03 +00:00
|
|
|
|
2012-11-11 03:12:26 +00:00
|
|
|
depends_on 'readline'
|
2010-01-15 00:59:03 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.deparallelize
|
|
|
|
|
2010-09-06 18:48:21 +00:00
|
|
|
ENV['EXTRA_CFLAGS'] = ENV.cflags
|
|
|
|
ENV['EXTRA_LDFLAGS'] = ENV.ldflags
|
2010-01-15 00:59:03 +00:00
|
|
|
|
2014-02-25 04:40:53 +00:00
|
|
|
readline = Formula['readline']
|
2010-01-15 00:59:03 +00:00
|
|
|
inreplace "Makefile" do |s|
|
|
|
|
s.change_make_var! "INCDIR", include
|
|
|
|
s.change_make_var! "BINDIR", bin
|
|
|
|
s.change_make_var! "LIBDIR", lib
|
|
|
|
s.change_make_var! "MANDIR", man1
|
|
|
|
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}"
|
2013-08-30 18:49:50 +00:00
|
|
|
s.change_make_var! 'CC',
|
|
|
|
"MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} #{ENV.cc}"
|
2014-02-25 07:13:11 +00:00
|
|
|
s.change_make_var! 'MACOSX_DEPLOYMENT_TARGET', MacOS.version
|
2010-01-15 00:59:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
system "make"
|
|
|
|
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
|