testing/gnucobol: new aport

This commit is contained in:
J. Neuschäfer 2025-01-02 14:13:08 +01:00 committed by achill (fossdd)
parent 7bf223144f
commit 7ad82a5dfd
4 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,30 @@
See also:
* https://sourceforge.net/p/gnucobol/bugs/904/
diff -ur a/gnucobol-3.2/libcob/numeric.c b/gnucobol-3.2/libcob/numeric.c
--- a/libcob/numeric.c 2023-08-18 01:07:41.324059298 +0000
+++ b/libcob/numeric.c 2023-08-18 01:31:31.294137417 +0000
@@ -2739,17 +2739,12 @@
}
} else {
unsigned char *pos = fld2 + fld2_size - 1;
- if (COB_FIELD_HAVE_SIGN (f2)) {
- if (!fld1_sign) {
- *pos &= 0xF0;
- *pos |= 0x0C;
- } else {
- *pos &= 0xF0;
- *pos |= fld1_sign;
- }
- } else {
- *pos &= 0xF0;
+ if (!COB_FIELD_HAVE_SIGN (f2)) {
*pos |= 0x0F;
+ } else if (fld1_sign == 0x0D) {
+ *pos = (*pos & 0xF0) | 0x0D;
+ } else {
+ *pos = (*pos & 0xF0) | 0x0C;
}
if (!(COB_FIELD_DIGITS (f2) & 1) /* -> digits % 2 == 0 */) {
*fld2 &= 0x0F;

View File

@ -0,0 +1,26 @@
See also:
* https://git.adelielinux.org/adelie/packages/-/issues/1045#note_13472
--- a/cobc/cobc.c.gc32 Sat Jul 22 17:01:52 2023
+++ b/cobc/cobc.c Thu Aug 17 23:01:33 2023
@@ -2358,6 +2358,10 @@
DECLNORET static void COB_A_NORETURN
cobc_terminate (const char *str)
{
+ /* must be executed before anything that may adjust errno, ...
+ like the listing code below. */
+ const char *errno_str = cb_get_strerror ();
+
if (cb_src_list_file) {
set_listing_date ();
set_standard_title ();
@@ -2365,7 +2369,7 @@
cobc_elided_strcpy (cb_listing_filename, str, sizeof (cb_listing_filename), 0);
print_program_header ();
}
- cb_perror (0, "cobc: %s: %s", str, cb_get_strerror ());
+ cb_perror (0, "cobc: %s: %s", str, errno_str);
if (cb_src_list_file) {
print_program_trailer ();
}

View File

@ -0,0 +1,15 @@
libcob: Fix include for xmlCleanupParser
common.c uses xmlCleanupParser, which is defined in libxml/parser.h.
---
--- a/libcob/common.c 2025-01-01 03:03:49.762316279 +0100
+++ b/libcob/common.c 2025-01-01 03:01:56.632597306 +0100
@@ -136,6 +136,7 @@
#if defined (WITH_XML2)
#include <libxml/xmlversion.h>
#include <libxml/xmlwriter.h>
+#include <libxml/parser.h>
#endif
#if defined (WITH_CJSON)

91
testing/gnucobol/APKBUILD Normal file
View File

@ -0,0 +1,91 @@
# Contributor: J. Neuschäfer <j.ne@posteo.net>
# Maintainer: J. Neuschäfer <j.ne@posteo.net>
pkgname=gnucobol
pkgver=3.2
pkgrel=0
pkgdesc="GnuCOBOL compiler"
url="https://www.gnu.org/software/gnucobol/"
# s390x: disabled due to test failures
arch="all !s390x"
license="GPL-3.0-or-later AND LGPL-3.0-or-later AND GFDL-1.3"
# The generated C code may use GMP and libc headers.
depends="gcc gmp-dev musl-dev"
# Other libraries are only used for building libcob.
makedepends="diffutils db-dev gettext-dev libxml2-dev cjson-dev ncurses-dev"
subpackages="
$pkgname-doc
$pkgname-lang
libcob4
"
source="https://master.dl.sourceforge.net/project/gnucobol/gnucobol/$pkgver/gnucobol-$pkgver.tar.lz
https://master.dl.sourceforge.net/project/gnucobol/nist/newcob.val.tar.gz
0001-move-packed-decimal.patch
0002-errno.patch
0003-fix-libxml-include.patch"
case "$CARCH" in
# As of gnucobol 3.2 and db 5.2.28, ORGANIZATION INDEXED (using db)
# is broken on x86.
x86) _db="--without-db" ;;
*) _db="--with-db" ;;
esac
prepare() {
default_prepare
# Move NIST test suite where "make checkall" will find it
mv "$srcdir/newcob.val" "$builddir/tests/cobol85/"
}
build() {
# FIXME: C23 is WIP (https://github.com/OCamlPro/gnucobol/pull/229)
CFLAGS="$CFLAGS -std=gnu17" \
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--with-xml2 \
--with-json \
--with-curses \
"$_db"
make
}
check() {
# This test fails on musl-libc because it expects dlclose to unload
# shared libraries.
_exclude="!CALL with directory"
# These tests fail in abuild rootbld because there's no tty available.
_exclude="$_exclude,!ON EXCEPTION clause of DISPLAY"
_exclude="$_exclude,!EC-SCREEN-LINE-NUMBER and -STARTING-COLUMN"
_exclude="$_exclude,!LINE/COLUMN 0 exceptions"
make checkall TESTSUITEFLAGS="--jobs=$JOBS -k \"$_exclude\"" || \
make check TESTSUITEFLAGS="--recheck --verbose"
}
package() {
make DESTDIR="$pkgdir" install
}
libcob4() {
pkgdesc="GnuCOBOL runtime library"
depends=
amove usr/lib/libcob.so.4*
amove usr/lib/gnucobol/
amove usr/share/gnucobol/config/runtime*.cfg
amove usr/share/gnucobol/config/*.ttbl
}
sha512sums="
126d5b85ae486c558e2675c65f3fff4a5852aa71d307ec6cebaf352a5c607faac43018917c5d7b76e0f62d70f0d00d37ffe7aa44e58bb67fac86e2532f97d1ec gnucobol-3.2.tar.lz
0c10ff0823525053ee927a1529ecdacbb47782ac3dc8540d1880977701058c5106cd1129c206f8cb0cf35e91822cb2c5ad939fbc99d13f8185a92b8c749200f9 newcob.val.tar.gz
d913d314172b4476ac7488010a03d52aac4c25502333a146725d459655f128026b74b938a2224d15fbfbd91f91dad7202d1546e7f77c01e16e242341bbada62c 0001-move-packed-decimal.patch
caaaca806c04db9e89f535c31444c647da926b76bed421c44ed1ea199d75d2fc4e1a5141eeff9c0985c2430513d416756443e8ca807bda9c3a496171e22026f0 0002-errno.patch
0bbdf66f69fa4f230235b0b6b6d99390efc9f3c383e5afd9b6bbf758fe225f8afe3b2c85b4ebc2b156afd2e35e2c0da20e7a2a93bdaa834a8ebbaebcef315bb2 0003-fix-libxml-include.patch
"