Commit 5901be54 authored by rdubner's avatar rdubner
Browse files

Move msys\ from cbl-gdb repo to the camelian-packages repo

parent 3ed77c7b
#!/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
gnucobol/
pkg/
src/
*.log
*.zst
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Jürgen Pfeifer <juergen@familiepfeifer.de>
# Contributor: Simon Sobisch <simonsobisch@gnu.org>
_realname=gnucobol
pkgbase=mingw-w64-${_realname}-svn
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}-svn
pkgver=.r3538
_specialversion=-dev
pkgrel=1
pkgdesc="GnuCOBOL, a free and modern COBOL compiler (mingw-w64)"
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-gnu-cobol-svn")
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-gnu-cobol-svn")
arch=('any')
url="https://www.gnu.org/software/gnucobol/"
options=('strip')
license=('GPL3' 'LGPL3')
makedepends=("subversion"
"bison"
"flex"
"rsync" # for translation updates...
"help2man"
"texinfo"
)
checkdepends=("diffutils" "wget" "perl")
# note: the final binaries will call GCC, therefore it is a dependency
depends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-gmp"
"${MINGW_PACKAGE_PREFIX}-gettext"
"${MINGW_PACKAGE_PREFIX}-ncurses"
"${MINGW_PACKAGE_PREFIX}-db"
"${MINGW_PACKAGE_PREFIX}-libxml2"
#"${MINGW_PACKAGE_PREFIX}-"cjson" <-- not available yet
)
# the optional depencies cannot be used for creating the binary packages, moved to depends
#optdepends=("${MINGW_PACKAGE_PREFIX}-gettext: support for internationalization"
# "${MINGW_PACKAGE_PREFIX}-libxml2: support for XML handling"
# "${MINGW_PACKAGE_PREFIX}-cjson: support for JSON handling"
# "${MINGW_PACKAGE_PREFIX}-ncurses: support for extended screenio"
# "${MINGW_PACKAGE_PREFIX}-pdcurses: support for screenio")
source=(
# "${_realname}::svn://svn.code.sf.net/p/open-cobol/code/trunk"
"${_realname}::svn://svn.code.sf.net/p/open-cobol/code/branches/gnucobol-3.x"
"001-mingw-gnucobol-2.2-fixformatwarnings.patch"
"cobenv.sh" "cobenv.cmd")
sha256sums=('SKIP'
'3FBFDAF61EB6EC125258DE62B404C97BF6DCCF39BD3B9152510F794B5383CA33'
'E55ED37EA93DFB7911B4CAD7F9F45422D831092668991120EA0CD0BCF79605AC'
'37F0848BCC386179D24986D17102F318AAF534D25682A09969B349916B56726B')
pkgver() {
cd "${srcdir}/${_realname}"
local ver="$(svnversion)"
printf "%s.r%s" "${_base_ver}" "${ver//[[:alpha:]]}"
}
prepare() {
cd "${srcdir}/${_realname}"
#patch -Np1 -i ${srcdir}/001-mingw-gnucobol-2.2-fixformatwarnings.patch
chmod u+x autogen.sh && ./autogen.sh
chmod u+x po/update_linguas.sh && po/update_linguas.sh
}
build() {
export lt_cv_deplibs_check_method='pass_all' # libncurses with unconforming name
[[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH}
cp -rf ${_realname} build-${CARCH}
cd ${srcdir}/build-${CARCH}
./configure \
CPPLAGS="-D__USE_MINGW_ANSI_STDIO=1" \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--prefix=${MINGW_PREFIX} \
--infodir=${MINGW_PREFIX}/share/info \
--mandir=${MINGW_PREFIX}/share/man \
--disable-rpath \
--enable-shared \
--disable-static
# --> as using the static libcob would be the builtin default,
# all generated COBOL modules would be GPLed (and big)...
make -j1
# make -j1 -C doc gnucobol.pdf note: needs more entries in makedepends
}
check() {
cd ${srcdir}/build-${CARCH}
# make check
# make test || true # note: may fail, but this is the SVN version...
}
package() {
cd ${srcdir}/build-${CARCH}
make DESTDIR="${pkgdir}" install
cd ${srcdir}
install -p -m777 cobenv.* "${pkgdir}${MINGW_PREFIX}/bin"
cd ${_realname}
install -d "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
install -p -m644 COPYING* "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
install -d "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
install -p -m644 README NEWS "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
# the manual may not be build as PDF (maybe come back later and add to makedepends + do an explicit make as noted above)
#cd doc
#install -p -m644 gnucobol.pdf "${pkgdir}${MINGW_PREFIX}/share/doc/${_realname}"
}
This folder is intended to provide a standalone GnuCOBOL compiler with
Symas/Camelian debugging capability that runs natively on Windows.
It was built on Windows 10 Profession with the MSYS2/MINGW32 toolchain,
so the cobc.exe program and the Camelian programs -- cobst.exe and
sfix.exe -- are all i686 32-bit executables.
The included gcc compiler is version 9.3, and the gdb debugger is 9.1; they
are the latest versions, as of this writing, provided by the MINGW32 toolchain.
You probably received this package as a 7-zip self-extracting executable,
and you probably let it install itself as C:\cblgdb\
The way you use it is to execute
C:\cblgdb\bin\cobenv.cmd
That sets up the execution path and the environment variables for
GnuCOBOL. You can then compile a COBOL program like this
cobcd -x your_program.cbl
You can then debug it with
gdb your_program
When you do that, you'll be confronted with a (gdb) prompt. Use the "list"
command to look at the code. Use the "break" command to set a breakpoint, and
use the "run" command to start the program.
The Camelian debugging package intercepts the "print" command in order to
allow the display of COBOL variables.
"print *" shows you all the variables in the current execution context.
"print 4" shows you the fourth variable in the "print *" list.
"print num" shows you all variables with "num" in their name.
There is a /d switch that shows debugging information for a variable: Use
the name (or the number) like this:
print/d specific_name
print/d 4
There is also a "watch" capability, where the code traps when a variable
changes. The command for that is "cwatch":
cwatch my-counter
Please contact me at rdubner@symas.com with questions, comments, complaints,
bugs, or (with any luck!) accolades.
Special thanks go to Arnold Trembley and Simon Sobisch. Putting this package
together involved a number of procedures and concepts that were new to me, and
the effort would have been much harder without Simon's help and Arnold's
documenation.
Bob Dubner
April 26, 2020
Bob Dubner, 2020-05-15
The enclosed PKGBUILD file was provided by Simon Sobisch.
To get the build to work, I had to modify a couple of things:
In PKGBUILD, line 25: change "diff" to "diffutils"
line 89: comment out 'make check'
line 90: comment out 'make test'
Following those changes:
makepkg-mingw -sCLf
@echo off
:: cobenv.cmd
:: Batch for setting GnuCOBOL Environment in Windows
:: from MSYS2 MINGW32/MINGW64
::
:: Copyright (C) 2017 Free Software Foundation, Inc.
:: Written by Simon Sobisch
::
:: This file is part of GnuCOBOL.
::
:: The GnuCOBOL compiler is free software: you can redistribute it
:: and/or modify it under the terms of the GNU General Public License
:: as published by the Free Software Foundation, either version 3 of the
:: License, or (at your option) any later version.
::
:: GnuCOBOL is distributed in the hope that it will be useful,
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
:: GNU General Public License for more details.
::
:: You should have received a copy of the GNU General Public License
:: along with GnuCOBOL. If not, see <http://www.gnu.org/licenses/>.
goto :evaluate_opts
:help
echo.
echo %_ce_myname% - set, show, store or restore GnuCOBOL environment
echo.
echo usage: %_ce_myextname% [options]
echo note: if no option is given %_ce_myname% defaults to --setenv
echo.
echo options:
echo --help, -h display this information
echo --verbose, -v print the environment variables set / restored
echo --quiet, -q don't print anything
echo --setenv store current environment and set environment
echo according to MSYS2 package structure
echo --save store current environment
echo --restore restore environment to previous saved point
echo --showenv show current environment
goto :eof
:output
if %_ce_verbose% lss 0 goto :eof
if %_ce_verbose% equ 0 (
echo %*
goto :eof
)
echo %*:
echo PATH=%PATH%
echo COB_LIBRARY_PATH=%COB_LIBRARY_PATH%
echo COB_CONFIG_DIR=%COB_CONFIG_DIR%
echo COB_COPY_DIR=%COB_COPY_DIR%
goto :eof
:save
set "_ce_restore_path=%PATH%"
set "_ce_restore_library_path=%COB_LIBRARY_PATH%"
set "_ce_restore_copy=%COB_COPY_DIR%"
set "_ce_restore_config=%COB_CONFIG_DIR%"
call :output environment saved
goto :eof
:setenv
if %_ce_verbose% geq 0 (
echo Setup GnuCOBOL environment - MinGW
)
if "%_ce_restore_path%"=="" (
call :save
) else (
call :restore silent
)
set "PATH=%MINGW_ROOT_PATH%bin;%PATH%"
if not "%COB_LIBRARY_PATH%"=="" set "COB_LIBRARY_PATH=;%COB_LIBRARY_PATH%"
set "COB_LIBRARY_PATH=%MINGW_ROOT_PATH%lib\gnucobol%COB_LIBRARY_PATH%"
set "COB_COPY_DIR=%MINGW_ROOT_PATH%share\gnucobol\copy"
set "COB_CONFIG_DIR=%MINGW_ROOT_PATH%share\gnucobol\config"
if %_ce_verbose% lss 0 goto :eof
call :output environment set
goto :eof
:unset_restore
set "_ce_restore_path="
set "_ce_restore_library_path="
set "_ce_restore_copy="
set "_ce_restore_config="
goto :eof
:restore
if "%_ce_restore_path%"=="" (
if %_ce_verbose% geq 0 (
echo nothing to restore
)
set "COB_LIBRARY_PATH="
set "COB_COPY_DIR="
set "COB_CONFIG_DIR="
)
set "PATH=%_ce_restore_path%"
set "COB_LIBRARY_PATH=%_ce_restore_library_path%"
set "COB_COPY_DIR=%_ce_restore_copy%"
set "COB_CONFIG_DIR=%_ce_restore_config%"
if [%1]==[] (
call :output environment restored
)
goto :eof
:showenv
set _ce_verbose=1
call :output current environment
goto :eof
:setcleanroot
set "MINGW_ROOT_PATH=%~dp1"
goto :eof
:evaluate_opts
set "_ce_myname=cobenv.bat"
set "_ce_myextname=%0"
call :setcleanroot "%~dp0..\"
set _ce_verbose=0
if /i [%2]==[--verbose] (
set _ce_verbose=1
) else if /i [%2]==[-v] (
set _ce_verbose=1
) else if /i [%2]==[--quiet] (
set _ce_verbose=-1
) else if /i [%2]==[-q] (
set _ce_verbose=-1
) else if not [%2]==[] (
shift
) else (
if /i [%1]==[--verbose] (
set _ce_verbose=1 && shift
) else if /i [%1]==[-v] (
set _ce_verbose=1 && shift
) else if /i [%1]==[--quiet] (
set _ce_verbose=-1 && shift
) else if /i [%1]==[-q] (
set _ce_verbose=-1 && shift
)
)
if [%1]==[--restore] (
call :restore
call :unset_restore
) else if /i [%1]==[/restore] (
call :restore
call :unset_restore
) else if /i [%1]==[--save] (
call :save
) else if /i [%1]==[/save] (
call :save
) else if /i [%1]==[--setenv] (
call :setenv
) else if /i [%1]==[/setenv] (
call :setenv
) else if [%1]==[] (
call :setenv
) else if /i [%1]==[--showenv] (
call :showenv
) else if /i [%1]==[/showenv] (
call :showenv
) else if /i [%1]==[--help] (
call :help
) else if /i [%1]==[/help] (
call :help
) else if /i [%1]==[-h] (
call :help
) else if /i [%1]==[/?] (
call :help
) else (
echo unrecognized or misplaced option "%1"
call :help
)
set "_ce_verbose="
set "_ce_myname="
set "_ce_myextname="
#!/bin/sh
#
# cobenv.sh
# Shell script for setting GnuCOBOL Environment
# in MSYS2 MINGW32/MINGW64
#
# Copyright (C) 2017 Free Software Foundation, Inc.
# Written by Simon Sobisch
#
# This file is part of GnuCOBOL.
#
# The GnuCOBOL compiler is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# GnuCOBOL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GnuCOBOL. If not, see <http://www.gnu.org/licenses/>.
_ce_help () {
echo
echo "$_ce_myname - set, show, store or restore GnuCOBOL environment"
echo
echo "usage: source $_ce_myextname [options]"
echo " or: . $_ce_myextname [options]"
echo " note: if no option is given $_ce_myname defaults to --setenv"
echo
echo "options:"
echo " --help, -h display this information"
echo " --verbose, -v print the environment variables set / restored"
echo " --quiet, -q don't print anything"
echo " --setenv store current environment and set environment"
echo " according to MSYS2 package structure"
echo " --save store current environment"
echo " --restore restore environment to previous saved point"
echo " --showenv show current environment"
}
_ce_output () {
if test $_ce_verbose -lt 0; then return; fi
if test $_ce_verbose -eq 0; then
echo "$1"
else
echo "$1:"
echo " COB_LIBRARY_PATH=$COB_LIBRARY_PATH"
echo " COB_CONFIG_DIR=$COB_CONFIG_DIR"
echo " COB_COPY_DIR=$COB_COPY_DIR"
fi
}
_ce_save () {
export "_ce_restore_library_path=$COB_LIBRARY_PATH"
export "_ce_restore_config=$COB_CONFIG_DIR"
export "_ce_restore_copy=$COB_COPY_DIR"
if test $_ce_verbose -lt 0; then return; fi
_ce_output "environment saved"
}
_ce_setenv () {
if test $_ce_verbose -ge 0; then
echo "Setup GnuCOBOL environment (MinGW within MSYS2)..."
fi
if test "-z ${_ce_restore_config+x}"; then
_ce_save
else
_ce_restore silent
fi
export "COB_CONFIG_DIR=`cygpath.exe -pw $MINGW_PREFIX/share/gnucobol/config`"
export "COB_COPY_DIR=`cygpath.exe -pw $MINGW_PREFIX/share/gnucobol/copy`"
if test "x$COB_LIBRARY_PATH" != "x"; then
"COB_LIBRARY_PATH=:$COB_LIBRARY_PATH"
fi
export "COB_LIBRARY_PATH=`cygpath.exe -pw $MINGW_PREFIX/lib/gnucobol`$COB_LIBRARY_PATH"
if test $_ce_verbose -lt 0; then return; fi
_ce_output "environment set"
}
_ce_unset_restore () {
unset "_ce_restore_library_path"
unset "_ce_restore_config"
unset "_ce_restore_copy"
}
_ce_restore () {
if test "-z ${_ce_restore_config+x}"; then
if test $_ce_verbose -ge 0; then
echo nothing to restore, environment is cleaned
fi
unset "COB_LIBRARY_PATH"
unset "COB_CONFIG_DIR"
unset "COB_COPY_DIR"
else
export "COB_LIBRARY_PATH=$_ce_restore_library_path"
export "COB_CONFIG_DIR=$_ce_restore_config"
export "COB_COPY_DIR=$_ce_restore_copy"
if test "-z ${1+x}"; then
_ce_output "environment restored"
fi
fi
}
_ce_showenv () {
_ce_verbose=1
_ce_output "current environment"
}