aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/gnu-cobol.rb
diff options
context:
space:
mode:
authorGerrit Beine2014-09-04 17:59:04 +0200
committerMike McQuaid2014-09-08 09:33:32 +0100
commit2b5978601acfcfb5dbca449a9827bf461d764e31 (patch)
tree40a0158991563a40e52fa9109ed7346891d206d2 /Library/Formula/gnu-cobol.rb
parent5a99c1d91f095957236e20c25811d44064b73c35 (diff)
downloadhomebrew-2b5978601acfcfb5dbca449a9827bf461d764e31.tar.bz2
gnu-cobol 1.1 (new formula)
OpenCOBOL is an open source COBOL compiler. OpenCOBOL implements a substantial part of the COBOL 85 and COBOL 2002 standards, as well as many extensions of the existent COBOL compilers.
Diffstat (limited to 'Library/Formula/gnu-cobol.rb')
-rw-r--r--Library/Formula/gnu-cobol.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/Formula/gnu-cobol.rb b/Library/Formula/gnu-cobol.rb
new file mode 100644
index 000000000..9178306be
--- /dev/null
+++ b/Library/Formula/gnu-cobol.rb
@@ -0,0 +1,47 @@
+require "formula"
+
+class GnuCobol < Formula
+ homepage "http://www.opencobol.org/"
+ url 'https://downloads.sourceforge.net/project/open-cobol/gnu-cobol/1.1/gnu-cobol-1.1.tar.gz'
+ sha1 "86e928c43cb3372f1f4564f3fd5e1dde668e8c1f"
+
+ depends_on "autoconf" => :build
+ depends_on "automake" => :build
+ depends_on "berkeley-db4"
+ depends_on "gmp"
+
+ def install
+ gmp = Formula["gmp"]
+ bdb = Formula["berkeley-db4"]
+
+ # both environment variables are needed to be set
+ # the cobol compiler takes these variables for calling cc during its run
+ # if the paths to gmp and bdb are not provided, the run of cobc fails
+ ENV.append "CPPFLAGS", "-I#{gmp.opt_include} -I#{bdb.opt_include}"
+ ENV.append "LDFLAGS", "-L#{gmp.opt_lib} -L#{bdb.opt_lib}"
+
+ args = ["--prefix=#{prefix}", "--infodir=#{info}"]
+ args << "--with-libiconv-prefix=/usr"
+ args << "--with-libintl-prefix=/usr"
+
+ system "aclocal"
+
+ # fix referencing of libintl and libiconv for ld
+ # bug report can be found here: https://sourceforge.net/p/open-cobol/bugs/93/
+ inreplace "configure", "-R$found_dir", "-L$found_dir"
+
+ system "./configure", *args
+
+ system "make", "install"
+ end
+
+ test do
+ (testpath/'hello.cob').write(' IDENTIFICATION DIVISION.
+ PROGRAM-ID. hello.
+ PROCEDURE DIVISION.
+ DISPLAY "Hello World!".
+ STOP RUN.')
+ system "#{bin}/cobc", "-x", testpath/'hello.cob'
+ system testpath/'hello'
+ end
+end