1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id$ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | name open-cobol |
---|
7 | version 2.0 |
---|
8 | revision 1 |
---|
9 | categories lang |
---|
10 | maintainers gwmail.gwu.edu:egall openmaintainer |
---|
11 | license GPL-2+ |
---|
12 | description OpenCOBOL, aka GNU Cobol |
---|
13 | long_description ${description}, is a free and open-source COBOL \ |
---|
14 | compiler. |
---|
15 | |
---|
16 | homepage http://www.opencobol.org/ |
---|
17 | platforms darwin |
---|
18 | |
---|
19 | master_sites sourceforge:project/${name}/${name}/${version}/ \ |
---|
20 | sourceforge |
---|
21 | |
---|
22 | distname ${name}-${version}-feb2012 |
---|
23 | worksrcdir ${name}-${version} |
---|
24 | |
---|
25 | checksums md5 58287e902f3b64dbac110d570c4aba4a \ |
---|
26 | sha1 5088e2ebc2549b4ca9f7daba4e309682d8067cde \ |
---|
27 | rmd160 39a1341a48b7e4addfaa545064849fe3dd29c881 |
---|
28 | |
---|
29 | # Mostly taken from the Fink package for open-cobol: |
---|
30 | depends_lib-append port:gmp \ |
---|
31 | port:libtool \ |
---|
32 | port:db44 \ |
---|
33 | port:ncurses \ |
---|
34 | port:libgnugetopt \ |
---|
35 | port:libiconv \ |
---|
36 | port:gettext \ |
---|
37 | port:mpfr |
---|
38 | |
---|
39 | # Patch to fix https://sourceforge.net/p/open-cobol/bugs/73/ until |
---|
40 | # upstream gets around to fixing it themselves: |
---|
41 | patchfiles-append patch-libcob_Makefile.am.diff |
---|
42 | patch.args-append --backup |
---|
43 | |
---|
44 | # since we are patching an automake Makefile, need to regenerate it: |
---|
45 | post-patch { |
---|
46 | # use_automake does not automatically call aclocal for us like |
---|
47 | # use_autoreconf does, so need to call it manually: |
---|
48 | ui_debug "running '${prefix}/bin/aclocal --force --warnings=all -I m4 --install' in ${worksrcpath}" |
---|
49 | system -W ${worksrcpath} "${prefix}/bin/aclocal --force --warnings=all -I m4 --install" |
---|
50 | } |
---|
51 | |
---|
52 | use_automake yes |
---|
53 | automake.args --add-missing --copy --force-missing --warnings=all |
---|
54 | |
---|
55 | # also mostly originally taken from Fink, but with some additions: |
---|
56 | configure.args-append --infodir=${prefix}/share/info \ |
---|
57 | --with-libiconv-prefix=${prefix} \ |
---|
58 | --with-libintl-prefix=${prefix} |
---|
59 | configure.cppflags-append -I${prefix}/include/gnugetopt \ |
---|
60 | -I${prefix}/include/db44 \ |
---|
61 | -Wno-pointer-sign |
---|
62 | configure.ldflags-append -L${prefix}/lib/db44 |
---|
63 | |
---|
64 | # try to override various environment variables that might contain an '-R', |
---|
65 | # and try to force libiconv to be used properly: |
---|
66 | configure.env-append COBC_LIBS='${configure.ldflags}' \ |
---|
67 | INTLLIBS='-lintl -liconv' \ |
---|
68 | LIBCOB_LIBS='-lm -lgmp -lmpfr -lncursesw -ldb' \ |
---|
69 | LIBINTL='-lintl -liconv' \ |
---|
70 | LIBS='-lgnugetopt' \ |
---|
71 | LTLIBICONV='-L/opt/local/lib -liconv' \ |
---|
72 | LTLIBINTL='-L/opt/local/lib -lintl -liconv' |
---|
73 | |
---|
74 | # temporarily disable ccache as I test as non-root: |
---|
75 | configure.ccache no |
---|
76 | |
---|
77 | # the configure script adds the '-pipe' flag anyway, so get rid of the |
---|
78 | # duplicate unconditionally: |
---|
79 | configure.pipe no |
---|
80 | |
---|
81 | # see: |
---|
82 | #https://sourceforge.net/p/open-cobol/discussion/help/thread/e1b4af35/#427c |
---|
83 | test.run yes |
---|
84 | test.target check |
---|
85 | # (tests 111, 112, 217 and 269 fail for me if I set |
---|
86 | # "configure.compiler=clang" from the command line, otherwise all tests |
---|
87 | # pass with gcc) |
---|
88 | |
---|
89 | post-test { |
---|
90 | if {[file exists ${prefix}/share/${name}/config/default.conf]} { |
---|
91 | ui_debug "${worksrcpath}/cobc/cobc -x ${filespath}/hello.cob" |
---|
92 | system -W ${worksrcpath} "./cobc/cobc -x ${filespath}/hello.cob 2>&1 || echo \"cobc failed\"" |
---|
93 | } else { |
---|
94 | ui_warn "cannot run cobc without an installed default.conf" |
---|
95 | } |
---|
96 | if {[file exists ${worksrcpath}/cobc/hello]} { |
---|
97 | ui_debug "${worksrcpath}/cobc/hello" |
---|
98 | system -W ${worksrcpath} "./hello" |
---|
99 | } else { |
---|
100 | ui_warn "cobc failed to produce any output" |
---|
101 | } |
---|
102 | ui_debug "${worksrcpath}/bin/cob-config --libs" |
---|
103 | system -W ${worksrcpath} "./bin/cob-config --libs" |
---|
104 | } |
---|
105 | |
---|
106 | # https://lists.macosforge.org/pipermail/macports-users/2014-May/035518.html |
---|
107 | if {[string match *clang* ${configure.compiler}]} { |
---|
108 | configure.args-append --disable-rpath |
---|
109 | configure.cppflags-append -std=gnu89 |
---|
110 | pre-configure { |
---|
111 | ui_warn "${name} has issues with clang" |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | variant debug description {enable debugging} { |
---|
116 | configure.args-append --enable-debug \ |
---|
117 | --enable-param-check |
---|
118 | # '--enable-debug' will add a '-g' of its own, but we need to override |
---|
119 | # the '-Os' that MacPorts would otherwise want to add as well: |
---|
120 | configure.optflags -g |
---|
121 | } |
---|