32 | | configure.args-append --infodir=${prefix}/share/info |
33 | | configure.cppflags-append -I${prefix}/include/gnugetopt -Wno-pointer-sign \ |
34 | | -I${prefix}/include/db44 |
35 | | configure.ldflags-append -lgnugetopt -L${prefix}/lib/db44 |
| 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 | } |