Commit 6f9722a4 authored by rdubner's avatar rdubner
Browse files

On the way to a minimal MSYS2/MINGW32 just-for-Windows cobc package

parent 28d8078a
......@@ -54,6 +54,10 @@ if grep -qs centos /etc/os-release ; then
os_name=centos
fi
if uname | grep -q MINGW32_NT ; then
os_name=MINGW32_NT
fi
if uname | grep -q MINGW64_NT ; then
os_name=MINGW64_NT
fi
......@@ -382,7 +386,7 @@ if test X$result = X"0" ; then
fi
$GCC -shared -o $TARGET $BASENAME-2.o $BASENAME.sym.o -lcob $POSTOPTIONS
if test X$os_name = X"MINGW64_NT" ; then
if test X$os_name = X"MINGW32_NT" || test X$os_name = X"MINGW64_NT" ; then
mv $TARGET $BASENAME.dll
fi
fi
......@@ -392,7 +396,7 @@ if test X$result = X"0" ; then
## if it is necessary:
if test X$result = X"0" ; then
if test X$os_name = X"MINGW64_NT" ; then
if test X$os_name = X"MINGW32_NT" || test X$os_name = X"MINGW64_NT" ; then
if test -f $DIR/cprint.py ; then
cp $DIR/cprint.py ./$BASENAME-gdb.py
elif test -f $DIR/python/cprint.py ; then
......
#!/bin/sh
# The purpose of this folder is to be the MSYS2/MINGW32 build directory
# for the creation of a stand-alone version of GnucCOBOL
# The target is a /gc32 folder (translates to a c:\msys2\gc32 folder
# in the Windows environment) that contains everything needed.
#Run ./configure here to run the whole process.
set -x
## These are the packages I need to compile cobc
pacman --noconfirm -S base-devel
pacman --noconfirm -S mingw-w64-i686-gcc
pacman --noconfirm -S mingw-w64-i686-db
pacman --noconfirm -S mingw-w64-i686-libxml2
pacman --noconfirm -S mingw-w64-i686-ncurses
pacman --noconfirm -S vim
svn checkout https://svn.code.sf.net/p/open-cobol/code/branches/gnucobol-3.x
cd gnucobol-3.x
patch -Np1 -i ../rjd-mingw-gnucobol-3.1-fixformatwarnings.patch
./autogen.sh
mkdir -p build
cd build
../configure \
--prefix=/gc32 \
--infodir=/gc32/share/info \
--mandir=/gc32/share/man \
--disable-rpath \
--enable-shared \
--disable-static
#patch common.h at line 407 and 414 to make the if defined(_WIN32) test fail
make
make install
## When things fail, be aware of the incredibly useful $ echo | gcc -Wp,-v -x c - -fsyntax-only
## Likewise, there is much information to be garnered with a gcc -v ...
## Haveing done all that, a successful compilation seems to require
## cobc -x rtest.cbl -lintl -lxml2 -lncurses -lgmp -ldb
##
exit 0
#!/bin/sh
# The purpose of this folder is to be the MSYS2/MINGW32 build directory
# for the creation of a stand-alone version of GnucCOBOL
# The target is a /gc32 folder (translates to a c:\msys2\gc32 folder
# in the Windows environment) that contains everything needed.
#Run ./configure here to run the whole process.
set -x
## These are the packages I need to compile cobc
#pacman --noconfirm -S base-devel
#pacman --noconfirm -S mingw-w64-i686-gcc
#pacman --noconfirm -S mingw-w64-i686-db
#pacman --noconfirm -S mingw-w64-i686-libxml2
#pacman --noconfirm -S mingw-w64-i686-ncurses
#pacman --noconfirm -S vim
pacman --noconfirm -S mingw-w64-i686-gcc
## libintl-8
pacman --noconfirm -S libintl
## libdb-6.0.dll
pacman --noconfirm -S mingw-w64-i686-db
pacman --noconfirm -S mingw-w64-i686-libxml2
pacman --noconfirm -S mingw-w64-i686-ncurses
pacman --noconfirm -S mingw-w64-i686-gdb
\ No newline at end of file
diff -Naur ./libcob/common.h.orig ./libcob/common.h
--- ./libcob/common.h.orig 2017-09-06 20:37:28.000000000 +0200
+++ ./libcob/common.h 2017-10-25 23:26:58.208945700 +0200
@@ -50,7 +50,7 @@
#endif
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__) /* hack for msys2 patch */
#define CB_FMT_LLD "%I64d"
#define CB_FMT_LLU "%I64u"
--- common.h.orig 2020-04-22 15:22:13.942466300 -0400
+++ common.h 2020-04-22 16:40:12.616272800 -0400
@@ -62,7 +62,7 @@
#endif
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__) /* hack for msys2 patch */
#define CB_FMT_LLD "%I64d"
#define CB_FMT_LLU "%I64u"
@@ -404,14 +404,14 @@
#include <setjmp.h>
#ifndef COB_EXT_EXPORT
-#if ((defined(_WIN32) || defined(__CYGWIN__)) && !defined(__clang__))
+#if ((defined(_WIN32x) || defined(__CYGWIN__x)) && !defined(__clang__))
#define COB_EXT_EXPORT __declspec(dllexport) extern
#else
#define COB_EXT_EXPORT extern
#endif
#endif
#ifndef COB_EXT_IMPORT
-#if ((defined(_WIN32) || defined(__CYGWIN__)) && !defined(__clang__))
+#if ((defined(_WIN32x) || defined(__CYGWIN__x)) && !defined(__clang__))
#define COB_EXT_IMPORT __declspec(dllimport) extern
#else
#define COB_EXT_IMPORT extern
......@@ -5,7 +5,7 @@
_realname=gnucobol
pkgbase=mingw-w64-${_realname}-svn
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}-svn
pkgver=.r3534
pkgver=.r3538
_specialversion=-dev
pkgrel=1
pkgdesc="GnuCOBOL, a free and modern COBOL compiler (mingw-w64)"
......
#!/bin/sh
# This process will compile a cobol module for debugging under
# windows, using COBC compiled with the MSYS2 x86_64 toolchain.
#
# cobst will have to be modified to not include the .debug_gdb_scripts
# section, which doesn't exist in the COFF/PE+ executable file format.
#
# When you launch gdb 9.1, it will just exit when you enter the l command
# for a listing. You;ll have to do a "l rtest.cbl:1" to "prime the pump",
# as it were.
#
# At the point I stopped working on this, the python script was sort of
# working, but not completely. Some variables in optfde01 were not being
# displayed, and others didn't seem right. I suspect length problems,
# but it does need to be debugged.
#
SOURCEFILE=rtest.cbl
# Extract the extension
EXT="${SOURCEFILE##*.}"
# Extract the basename
BASENAME=`basename $SOURCEFILE .$EXT`
COBCDXM=-x
COBC=cobc
COBST=../../cobst/cobst
SFIX=../../sfix/sfix
GCC=gcc
CC1=`$GCC --print-prog-name cc1`
ASSEMBLER=`$GCC --print-prog-name as`
LOADER=`$GCC --print-prog-name ld`
## Create the .s file from the COBOL $SOURCEFILE
COB_CFLAGS="-Wa,-L,-anchls=$BASENAME.lst" $COBC $COBCDFLAGS -d -S $COBCDXM -g \
--fgen-c-line-directives --fgen-c-labels \
-T $BASENAME.cbl.lst --tlines=0 --tsymbols $PREOPTIONS $SOURCEFILE
## Create the .c file from the COBOL $SOURCEFILE
COB_CFLAGS="-Wa,-L,-anchls=$BASENAME.lst" $COBC $COBCDFLAGS -d -c $COBCDXM -g \
--fgen-c-line-directives --fgen-c-labels \
-T $BASENAME.cbl.lst --tlines=0 --tsymbols $PREOPTIONS $SOURCEFILE
#rm *.o
## Create the .sym.c file from the .i, .h, and .lst files
$COBST -q $BASENAME
##Compile the .sym.c file
$GCC -c -o $BASENAME.sym.o $BASENAME.sym.c
# Remove all .c and .h references from the .s file:
$SFIX -q $BASENAME.s $BASENAME-2.s $BASENAME.c $SOURCEFILE
# Assemble the modified .s file:
$ASSEMBLER -L -anchls=$BASENAME-2.lst -o $BASENAME-2.o $BASENAME-2.s
# put everything together
$COBC $COBCDXM -o $BASENAME $BASENAME-2.o $BASENAME.sym.o -lintl -lncurses -lgmp -ldb
start to bootstrap GnuCOBOL
creating tarstamp.h...
ensure that we have executable scripts...
running autoreconf...
./bootstrap: line 91: autoreconf: command not found
ERROR, autoreconf returned 127 - aborting bootstrap
==> ERROR:(B A failure occurred in prepare().(B
 Aborting...(B
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment