summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/gnucobol/APKBUILD55
-rw-r--r--user/gnucobol/big-endian.patch314
-rw-r--r--user/gnucobol/keep-debug-flags.patch43
-rw-r--r--user/gnucobol/tests-are-fatal.patch22
4 files changed, 434 insertions, 0 deletions
diff --git a/user/gnucobol/APKBUILD b/user/gnucobol/APKBUILD
new file mode 100644
index 000000000..c95083a7f
--- /dev/null
+++ b/user/gnucobol/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: Max Rees <maxcrees@me.com>
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=gnucobol
+pkgver=3.0_rc1
+_pkgver=3.0-rc1
+pkgrel=0
+pkgdesc="Free COBOL compiler"
+url="https://sourceforge.net/projects/open-cobol/"
+arch="all"
+license="GPL-3.0+ AND LGPL-3.0+ AND GFDL-1.3"
+# Since it compiles to C as an intermediate, the headers / libraries must
+# always be present and thus there is no -dev subpackage.
+depends="db-dev gmp-dev ncurses-dev"
+makedepends="help2man texinfo"
+subpackages="$pkgname-doc $pkgname-lang"
+source="https://downloads.sourceforge.net/project/open-cobol/gnu-cobol/3.0/$pkgname-$_pkgver.tar.xz
+ https://dev.sick.bike/dist/newcob.val.Z
+ keep-debug-flags.patch
+ big-endian.patch
+ tests-are-fatal.patch"
+builddir="$srcdir/$pkgname-$_pkgver"
+
+prepare() {
+ default_prepare
+ autoreconf -vif
+ # For "make test"
+ cp "$srcdir/newcob.val.Z" "$builddir/tests/cobol85"
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --enable-debug
+ make
+}
+
+check() {
+ make check
+ make test
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="da669f7bef0c6664723dc88c20e28236ea31d5c933d9129b0132e929eb66f723995d3428b056164cf105bc22b38b8bc5fbf9d0d5b76df4ce6c08045837930fa0 gnucobol-3.0-rc1.tar.xz
+eb784866d1a335834074fbe103b5c5f5da810d847ae14a64316ecbb2c0f95ef751d2f2ec609b8fa21ef0b775817dc61115a574608ec89750d779ae0afbb95379 newcob.val.Z
+f45611c1298680b0c763094af662b3d1925d32379d33faff77862d7eaa3bf6225f68d5160a39a0822f54b570c923a53bc72dec54cff4f04f1162515834a40be2 keep-debug-flags.patch
+f7c1249db9d0f8d3a4eda732db93970f73fe649d1725b0b73c92af4885bc816d8727dbbcb8e9a1fb998997f3beed7de2812202749f05bbe1471b907737645648 big-endian.patch
+ca5ba1e19e5ff8740008b45ffcea4c1e8e34fc62246f3e635424ae1ec374c5cd9d7cc94d371690c021ccf82e293db7235143ebcaadb20ae5e4fc258749ff56c4 tests-are-fatal.patch"
diff --git a/user/gnucobol/big-endian.patch b/user/gnucobol/big-endian.patch
new file mode 100644
index 000000000..848300e15
--- /dev/null
+++ b/user/gnucobol/big-endian.patch
@@ -0,0 +1,314 @@
+From 99cfa96676db1fcb6e4a5db89110c4991782eab6 Mon Sep 17 00:00:00 2001
+From: sf-mensch <sf-mensch@ed166372-6744-4ac0-a67f-bb1ae9efa102>
+Date: Mon, 25 Mar 2019 21:34:35 +0000
+Subject: [PATCH] testsuite.src/run_misc.at: fixed test that expected
+ little-endian values in dump to not check the dump content *FIXME: still
+ expecting ASCII*
+
+git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3054 ed166372-6744-4ac0-a67f-bb1ae9efa102
+---
+ tests/testsuite.src/run_misc.at | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/tests/testsuite.src/run_misc.at b/tests/testsuite.src/run_misc.at
+index 2ef4a86..173ac48 100644
+--- a/tests/testsuite.src/run_misc.at
++++ b/tests/testsuite.src/run_misc.at
+@@ -6185,6 +6185,10 @@ AT_CLEANUP
+ AT_SETUP([MF FIGURATIVE to NUMERIC])
+ AT_KEYWORDS([MOVE])
+
++# FIXME: This test will NOT work on EBCDIC machines,
++# either add it explicit here and split into two or add
++# a pre-test and check the expected "native" result
++
+ AT_DATA([prog.cob], [
+ IDENTIFICATION DIVISION.
+ PROGRAM-ID. prog.
+@@ -6230,12 +6234,16 @@ AT_DATA([prog.cob], [
+ DISPLAY "MOVE HIGH-VALUES TO BIGFLT"
+ MOVE HIGH-VALUES TO BIGFLT.
+ PERFORM SHOW-BIG.
++ CALL "dump" USING BIGFLT.
+ DISPLAY "MOVE QUOTE TO BIGFLT"
+ MOVE QUOTE TO BIGFLT.
+ PERFORM SHOW-BIG.
++ CALL "dump" USING BIGFLT.
+ DISPLAY "MOVE ALL * TO BIGFLT"
+ MOVE ALL '*' TO BIGFLT.
+ PERFORM SHOW-BIG.
++ *> Note: the next results are dependant on endianess
++ *> therefore no dump here
+ DISPLAY "MOVE ALL '21' TO BIGFLT"
+ MOVE ALL '21' TO BIGFLT.
+ PERFORM SHOW-BIG.
+@@ -6244,7 +6252,6 @@ AT_DATA([prog.cob], [
+ CALL "dump" USING MYFLD.
+ SHOW-BIG.
+ DISPLAY "BIGFLT is " BIGFLT.
+- CALL "dump" USING BIGFLT.
+ ])
+
+ AT_DATA([cmod.c], [[
+@@ -6303,10 +6310,8 @@ BIGFLT is 2.1973164E-18
+ 22222222 .
+ MOVE ALL * TO BIGFLT
+ BIGFLT is 5.4312347E+12
+-DA119E54 .
+ MOVE ALL '21' TO BIGFLT
+ BIGFLT is 2.1212121E+37
+-E5547F7D .
+ ], [])
+
+ AT_CLEANUP
+--
+2.15.3
+
+From e0d02d05d50804d6fefe3f01d7eee8c943cb07e4 Mon Sep 17 00:00:00 2001
+From: sf-mensch <sf-mensch@ed166372-6744-4ac0-a67f-bb1ae9efa102>
+Date: Mon, 25 Mar 2019 21:41:12 +0000
+Subject: [PATCH] testsuite.src/run_misc.at: fixed test that expected
+ little-endian values in dump to not check the dump content *FIXME: still
+ expecting ASCII*
+
+git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3055 ed166372-6744-4ac0-a67f-bb1ae9efa102
+
+diff --git a/tests/testsuite.src/run_misc.at b/tests/testsuite.src/run_misc.at
+index 173ac48..51f4b84 100644
+--- a/tests/testsuite.src/run_misc.at
++++ b/tests/testsuite.src/run_misc.at
+@@ -6275,7 +6275,7 @@ prog.cob:28: warning: numeric value is expected
+ prog.cob:6: warning: 'MYFLD' defined here as PIC 9(4)
+ prog.cob:34: warning: numeric value is expected
+ prog.cob:6: warning: 'MYFLD' defined here as PIC 9(4)
+-prog.cob:50: warning: numeric value is expected
++prog.cob:52: warning: numeric value is expected
+ prog.cob:7: warning: 'BIGFLT' defined here as USAGE FLOAT
+ ])
+
+--
+2.15.3
+
+From 71b65c9fe2c6997e33c56457977d79fd10c3a8f2 Mon Sep 17 00:00:00 2001
+From: sf-mensch <sf-mensch@ed166372-6744-4ac0-a67f-bb1ae9efa102>
+Date: Mon, 15 Apr 2019 21:29:54 +0000
+Subject: [PATCH] Partially merged r525 from branches/reportwriter and r3106
+ from branches/pangaea: libcob/common.c (cob_sys_getopt_long_long): fix ENDIAN
+ problem with CBL_GC_GETOPT
+
+also applied minor reformatting to keep the function formatted consistently
+
+
+git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3115 ed166372-6744-4ac0-a67f-bb1ae9efa102
+
+diff --git a/libcob/common.c b/libcob/common.c
+index 5262282..d99c533 100644
+--- a/libcob/common.c
++++ b/libcob/common.c
+@@ -5275,9 +5275,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo
+
+ COB_CHK_PARMS (CBL_GC_GETOPT, 6);
+
+- /*
+- * Read in sizes of some parameters
+- */
++ /* read in sizes of some parameters */
+ if (COB_MODULE_PTR->cob_procedure_params[1]) {
+ lo_size = COB_MODULE_PTR->cob_procedure_params[1]->size;
+ }
+@@ -5288,9 +5286,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo
+ opt_val_size = COB_MODULE_PTR->cob_procedure_params[5]->size;
+ }
+
+- /*
+- * Buffering longoptions (COBOL), target format (struct option)
+- */
++ /* buffering longoptions (COBOL), target format (struct option) */
+ if (lo_size % sizeof (longoption_def) == 0) {
+ lo_amount = (int)lo_size / sizeof (longoption_def);
+ longoptions_root = (struct option*) cob_malloc (sizeof (struct option) * (lo_amount + 1U));
+@@ -5305,9 +5301,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo
+ }
+ longind = cob_get_int (COB_MODULE_PTR->cob_procedure_params[2]);
+
+- /*
+- * Add 0-termination to strings.
+- */
++ /* add 0-termination to strings */
+ shortoptions = cob_malloc (so_size + 1U);
+ if (COB_MODULE_PTR->cob_procedure_params[0]) {
+ cob_field_to_string (COB_MODULE_PTR->cob_procedure_params[0], shortoptions, so_size);
+@@ -5333,9 +5327,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo
+ longoptions = longoptions + 1;
+ }
+
+- /*
+- * Appending final record, so getopt can spot the end of longoptions
+- */
++ /* appending final record, so getopt can spot the end of longoptions */
+ longoptions->name = NULL;
+ longoptions->has_arg = 0;
+ longoptions->flag = NULL;
+@@ -5348,17 +5340,42 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo
+ return_value = cob_getopt_long_long (cob_argc, cob_argv, shortoptions, longoptions, &longind, long_only);
+ temp = (char *) &return_value;
+
+- /*
+- * Write data back to COBOL
+- */
+- if (temp[0] == '?' || temp[0] == ':' || temp[0] == 'W'
+- || temp[0] == -1 || temp[0] == 0) exit_status = return_value;
+- else exit_status = 3;
++ /* write data back to COBOL */
++#ifdef WORDS_BIGENDIAN
++ if (temp[3] == '?'
++ || temp[3] == ':'
++ || temp[3] == 'W'
++ || temp[3] == 0) {
++ exit_status = temp[3] & 0xFF;
++ } else if (return_value == -1) {
++ exit_status = -1;
++ } else {
++ exit_status = 3;
++ }
++ /* cob_getopt_long_long sometimes returns and 'int' value and sometimes a 'x ' in the int */
++ if (temp[0] == 0
++ && temp[1] == 0
++ && temp[2] == 0) {
++ /* Move option value to 1st byte and SPACE fill the 'int' */
++ temp[0] = temp[3];
++ temp[1] = temp[2] = temp[3] = ' ';
++ }
++#else
++ if (temp[0] == '?'
++ || temp[0] == ':'
++ || temp[0] == 'W'
++ || temp[0] == -1
++ || temp[0] == 0) {
++ exit_status = return_value;
++ } else {
++ exit_status = 3;
++ }
+
+ for (i = 3; i > 0; i--) {
+- if (temp[i] == 0x00) temp[i] = 0x20;
++ if (temp[i] == 0) temp[i] = ' ';
+ else break;
+ }
++#endif
+
+ cob_set_int (COB_MODULE_PTR->cob_procedure_params[2], longind);
+ memcpy (return_char, &return_value, 4);
+--
+2.15.3
+
+From 9151800276cff454f11d250cb19d267def883978 Mon Sep 17 00:00:00 2001
+From: sf-mensch <sf-mensch@ed166372-6744-4ac0-a67f-bb1ae9efa102>
+Date: Mon, 15 Apr 2019 21:38:53 +0000
+Subject: [PATCH] Partially merged r525 from branches/reportwriter:
+ libcob/fileio.c (cob_sys_create_file, cob_sys_open_file): fix ENDIAN problem
+ with CBL_CREATE_FILE, CBL_OPEN_FILE
+
+also applied minor reformatting to keep the function formatted consistently
+
+
+git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3116 ed166372-6744-4ac0-a67f-bb1ae9efa102
+
+diff --git a/libcob/fileio.c b/libcob/fileio.c
+index 885cd48..521e245 100644
+--- a/libcob/fileio.c
++++ b/libcob/fileio.c
+@@ -5633,6 +5633,22 @@ cob_sys_open_file (unsigned char *file_name, unsigned char *file_access,
+
+ COB_CHK_PARMS (CBL_OPEN_FILE, 5);
+
++#ifdef WORDS_BIGENDIAN
++ /* if value is passed as numeric literal, it becomes an 'int' so value is in 4th byte */
++ if (file_access[0] == 0
++ && file_access[1] == 0
++ && file_access[2] == 0)
++ file_access += 3;
++ if (file_lock[0] == 0
++ && file_lock[1] == 0
++ && file_lock[2] == 0)
++ file_lock += 3;
++ if (file_dev[0] == 0
++ && file_dev[1] == 0
++ && file_dev[2] == 0)
++ file_dev += 3;
++#endif
++
+ return open_cbl_file (file_name, file_access, file_handle, 0);
+ }
+
+@@ -5647,6 +5663,24 @@ cob_sys_create_file (unsigned char *file_name, unsigned char *file_access,
+ * @param: file_dev : not implemented, set 0
+ */
+
++ COB_CHK_PARMS (CBL_CREATE_FILE, 5);
++
++#ifdef WORDS_BIGENDIAN
++ /* if value is passed as numeric literal, it becomes an 'int' so value is in 4th byte */
++ if (file_access[0] == 0
++ && file_access[1] == 0
++ && file_access[2] == 0)
++ file_access += 3;
++ if (file_lock[0] == 0
++ && file_lock[1] == 0
++ && file_lock[2] == 0)
++ file_lock += 3;
++ if (file_dev[0] == 0
++ && file_dev[1] == 0
++ && file_dev[2] == 0)
++ file_dev += 3;
++#endif
++
+ if (*file_lock != 0) {
+ cob_runtime_warning (_("call to CBL_CREATE_FILE with wrong file_lock: %d"), *file_lock);
+ }
+@@ -5654,8 +5688,6 @@ cob_sys_create_file (unsigned char *file_name, unsigned char *file_access,
+ cob_runtime_warning (_("call to CBL_CREATE_FILE with wrong file_dev: %d"), *file_dev);
+ }
+
+- COB_CHK_PARMS (CBL_CREATE_FILE, 5);
+-
+ return open_cbl_file (file_name, file_access, file_handle, O_CREAT | O_TRUNC);
+ }
+
+--
+2.15.3
+
+From f6ff480b71da490476abc84699558bddef6b9a56 Mon Sep 17 00:00:00 2001
+From: sf-mensch <sf-mensch@ed166372-6744-4ac0-a67f-bb1ae9efa102>
+Date: Tue, 18 Jun 2019 20:09:46 +0000
+Subject: [PATCH] tests: * atlocal.in explicit disable BDB internal locking by
+ unsetting DB_HOME to work around issues in different environments and to not
+ pollute the users's general BDB locking files * skip UDF recursion test
+ previously marked as expected fail as the current implementation may or may
+ not work depending on the underlying C compiler/library in use (including the
+ exact version...)
+
+git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3194 ed166372-6744-4ac0-a67f-bb1ae9efa102
+
+diff --git a/tests/testsuite.src/run_functions.at b/tests/testsuite.src/run_functions.at
+index 7c3c660..5ddbd58 100644
+--- a/tests/testsuite.src/run_functions.at
++++ b/tests/testsuite.src/run_functions.at
+@@ -1,4 +1,4 @@
+-## Copyright (C) 2003-2012, 2014-2018 Free Software Foundation, Inc.
++## Copyright (C) 2003-2012, 2014-2019 Free Software Foundation, Inc.
+ ## Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart
+ ##
+ ## This file is part of GnuCOBOL.
+@@ -4254,7 +4254,7 @@ AT_CLEANUP
+ AT_SETUP([UDF with recursion])
+ AT_KEYWORDS([functions LOCAL-STORAGE])
+
+-AT_XFAIL_IF(true) # see bug #222 and r2291 - postponed
++AT_SKIP_IF(true) # see bug #222 and r2291 - postponed
+
+ AT_DATA([prog.cob], [
+ IDENTIFICATION DIVISION.
+--
+2.15.3
+
diff --git a/user/gnucobol/keep-debug-flags.patch b/user/gnucobol/keep-debug-flags.patch
new file mode 100644
index 000000000..40c188802
--- /dev/null
+++ b/user/gnucobol/keep-debug-flags.patch
@@ -0,0 +1,43 @@
+--- gnucobol-3.0-rc1/configure.ac 2018-04-22 22:00:19.000000000 +0000
++++ gnucobol-3.0-rc1/configure.ac 2019-06-28 12:09:56.160772995 +0000
+@@ -1216,40 +1216,6 @@
+ fi
+
+
+-# Include CFLAGS / CPPFLAGS in COB_CFLAGS without optimization/debug options.
+-
+-if test "x$CFLAGS" != "x"; then
+- cob_temp_flags="$CFLAGS"
+-else
+- cob_temp_flags=""
+-fi
+-if test "x$CPPFLAGS" != "x"; then
+- if test "x$cob_temp_flags" != "x"; then
+- cob_temp_flags="$CPPFLAGS $cob_temp_flags"
+- else
+- cob_temp_flags="$CPPFLAGS"
+- fi
+-fi
+-if test "x$cob_temp_flags" != "x"; then
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-g3//' -e 's/-g//' -e 's/ $//' -e 's/^ //'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/@<:@+-@:>@O@<:@0-9s@:>@//' -e 's/ $//' -e 's/^ //'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-O//' -e 's/ $//' -e 's/^ //'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fmessage-length=0//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-D_FORTIFY_SOURCE=.//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fstack-protector-strong//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fstack-protector-all//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fstack-protector//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-funwind-tables//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fasynchronous-unwind-tables//'`
+- cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/ */ /g' -e 's/ $//' -e 's/^ //'`
+-fi
+-
+-if test "x$cob_temp_flags" != "x"; then
+- COB_CFLAGS="$COB_CFLAGS $cob_temp_flags"
+-fi
+-unset cob_temp_flags
+-
+-
+ # Special stuff
+
+ AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
diff --git a/user/gnucobol/tests-are-fatal.patch b/user/gnucobol/tests-are-fatal.patch
new file mode 100644
index 000000000..933c1128d
--- /dev/null
+++ b/user/gnucobol/tests-are-fatal.patch
@@ -0,0 +1,22 @@
+Backport of r3183
+
+--- gnucobol-3.0-rc1/tests/Makefile.am 2018-04-22 19:55:51.000000000 +0000
++++ gnucobol-3.0-rc1/tests/Makefile.am 2019-06-28 16:49:23.740928336 +0000
+@@ -74,7 +74,7 @@
+ check-local: $(TESTSUITE)
+ @echo testing for working diff && diff - "$(TESTSUITE)" < "$(TESTSUITE)" \
+ || (echo "Error: no working 'diff' in PATH" && false)
+- @$(TESTSUITE) $(TESTSUITEFLAGS) || rm -f testsuite.dir/at-job-fifo
++ @$(TESTSUITE) $(TESTSUITEFLAGS) || (rm -f testsuite.dir/at-job-fifo; exit 1)
+ @rm -f testsuite.dir/at-job-fifo
+
+ clean-local:
+@@ -84,7 +84,7 @@
+ @cp $(srcdir)/run_prog_manual.sh.in $@
+
+ checkmanual: $(TESTSUITE_MANUAL) ./run_prog_manual.sh
+- @$(TESTSUITE_MANUAL) $(TESTSUITEFLAGS) || rm -f testsuite_manual.dir/at-job-fifo
++ @$(TESTSUITE_MANUAL) $(TESTSUITEFLAGS) || (rm -f testsuite_manual.dir/at-job-fifo; exit 1)
+ @rm -f testsuite_manual.dir/at-job-fifo
+
+ # targets that are only logical targets instead of files