2014-09-04 15:59:04 +00:00
|
|
|
require "formula"
|
|
|
|
|
|
|
|
class GnuCobol < Formula
|
|
|
|
homepage "http://www.opencobol.org/"
|
2014-10-21 07:05:57 +00:00
|
|
|
|
|
|
|
stable do
|
|
|
|
url "https://downloads.sourceforge.net/project/open-cobol/gnu-cobol/1.1/gnu-cobol-1.1.tar.gz"
|
|
|
|
sha1 "86e928c43cb3372f1f4564f3fd5e1dde668e8c1f"
|
|
|
|
|
|
|
|
fails_with :clang do
|
|
|
|
cause <<-EOS.undent
|
|
|
|
Building with Clang configures GNU-COBOL to use Clang as its compiler,
|
|
|
|
which causes subsequent GNU-COBOL-based builds to fail.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
2014-09-04 15:59:04 +00:00
|
|
|
|
2014-09-08 20:45:11 +00:00
|
|
|
devel do
|
|
|
|
version "2.0_nightly_r411"
|
|
|
|
url "https://downloads.sourceforge.net/project/open-cobol/gnu-cobol/2.0/gnu-cobol-2.0_nightly_r411.tar.gz"
|
|
|
|
sha1 "009215c090b9a90fbf02bbc913095ce2a9b31910"
|
|
|
|
end
|
|
|
|
|
2014-09-08 08:21:39 +00:00
|
|
|
bottle do
|
2014-09-10 07:48:28 +00:00
|
|
|
revision 1
|
|
|
|
sha1 "0faef373e0364a8c92e32b828904e0fc10198aab" => :mavericks
|
|
|
|
sha1 "cf08ce9301cfb80a882b37587ef0b9cb5c96f70b" => :mountain_lion
|
|
|
|
sha1 "fc50ad8ec550f6d347044778b795688e4f18ad24" => :lion
|
2014-09-08 08:21:39 +00:00
|
|
|
end
|
|
|
|
|
2014-09-04 15:59:04 +00:00
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "berkeley-db4"
|
|
|
|
depends_on "gmp"
|
2015-01-06 08:14:31 +00:00
|
|
|
depends_on "gcc"
|
2014-09-04 15:59:04 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# 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
|
2014-09-08 08:33:18 +00:00
|
|
|
gmp = Formula["gmp"]
|
|
|
|
bdb = Formula["berkeley-db4"]
|
2014-09-04 15:59:04 +00:00
|
|
|
ENV.append "CPPFLAGS", "-I#{gmp.opt_include} -I#{bdb.opt_include}"
|
|
|
|
ENV.append "LDFLAGS", "-L#{gmp.opt_lib} -L#{bdb.opt_lib}"
|
|
|
|
|
2014-09-08 08:33:18 +00:00
|
|
|
args = ["--prefix=#{prefix}", "--infodir=#{info}"]
|
|
|
|
args << "--with-libiconv-prefix=/usr"
|
|
|
|
args << "--with-libintl-prefix=/usr"
|
2014-09-08 20:45:11 +00:00
|
|
|
|
|
|
|
if build.stable?
|
|
|
|
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"
|
|
|
|
|
|
|
|
args << "--with-cc=#{ENV.cc}"
|
|
|
|
end
|
|
|
|
|
2014-09-04 15:59:04 +00:00
|
|
|
system "./configure", *args
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2014-09-08 08:33:18 +00:00
|
|
|
(testpath/"hello.cob").write <<-EOS
|
|
|
|
IDENTIFICATION DIVISION.
|
2014-09-04 15:59:04 +00:00
|
|
|
PROGRAM-ID. hello.
|
|
|
|
PROCEDURE DIVISION.
|
|
|
|
DISPLAY "Hello World!".
|
2014-09-08 08:33:18 +00:00
|
|
|
STOP RUN.
|
|
|
|
EOS
|
|
|
|
system "#{bin}/cobc", "-x", testpath/"hello.cob"
|
|
|
|
system testpath/"hello"
|
2014-09-04 15:59:04 +00:00
|
|
|
end
|
|
|
|
end
|