Commit af8192d3 authored by rdubner's avatar rdubner

Release 3.6 candidate

Switching over to embedding just the filename 'cobcd.py' instead of the entire Python script.
'make install' offers up a suggesting for .gdbinit so that things will work.
parent 35c4cba5
......@@ -45,6 +45,17 @@ install:
$(MAKE) -C cobcd-st install
$(MAKE) -C cobcd-sfix install
$(MAKE) -C python install
@echo "\033[0;33m"
@echo "In order for gdb to be able to load the Python script that displays COBOL variables,"
@echo "you will have to create a ~/.gdbinit file that has the following lines in it:"
@echo ""
@echo " add-auto-load-safe-path $(DESTDIR)/bin"
@echo " set directories $(DESTDIR)/bin"
@echo " set auto-load python-scripts on"
@echo ""
@echo "See https://sourceware.org/gdb/onlinedocs/gdb/Auto_002dloading-safe-path.html for more information"
@echo "\033[0m"
.PHONY : uninstall
uninstall:
......
#!/bin/sh
#!/bin/sh
#######################################################################
# Copyright (c) 2019-2020 COBOLworx
......@@ -159,21 +158,24 @@ if [ "$COBCDEVEL" ]; then
COBST=$SCRIPTDIR/cobcd-st/cobcd-st
SFIX=$SCRIPTDIR/cobcd-sfix/cobcd-sfix
PYTHON=$SCRIPTDIR/python/cobcd.py
# for COBCDEVEL, we embed the script
DASH_F=""
DASH_S=-s
else
# In normal operation, the executables are found in the same folder
# as the cobcd script
COBST=$SCRIPTDIR/cobcd-st
SFIX=$SCRIPTDIR/cobcd-sfix
PYTHON=$SCRIPTDIR/cobcd.py
# In normal operation, we embed a pointer
DASH_F="-f"
DASH_S=""
fi
## Under centos7/rhel7, we don't allow cobcd-st to embed the Python code
## into the .sym.c module
case "$os_name" in
"rhel7")
COBST_FLAGS=-n
;;
esac
## We need to extract the COB_CFLAGS information from `cobc --info`
## in case we need to augment COB_CFLAGS when we actually use cobc.
......@@ -340,6 +342,9 @@ if [ $ECHO ]
then
echo "platform is $platform "
echo "os_name is $os_name "
echo "COBCDEVEL is $COBCDEVEL "
COBCDEVEL
echo "COBST is $COBST "
echo "SFIX is $SFIX "
echo "PYTHON is $PYTHON "
......@@ -365,19 +370,21 @@ if [ "$ECHO" ]
$COBC $DASH_V $OUR_COMMAND
result=$?
if [ X"$os_name" = X"rhel7" ]
then
DASH_N=-n
fi
## In the Windows universe, we can't embed anything into the executable
case "$os_name" in
"MINGW32_NT"|"MINGW64_NT"|"MSYS_NT")
DASH_F=""
DASH_S=""
esac
## We can now create the .sym.c file:
if [ "$result" = "0" ]
then
if [ "$ECHO" ]
then
echo $COBST -q $DASH_7 $DASH_N $FILE_ROOT $FILE_CBL
echo $COBST -q $DASH_F $DASH_S $FILE_ROOT $FILE_CBL
fi
$COBST -q $DASH_7 $DASH_N $FILE_ROOT $FILE_CBL
$COBST -q $DASH_F $DASH_S $FILE_ROOT $FILE_CBL
result=$?
fi
......@@ -442,35 +449,37 @@ if [ "$result" = "0" ]; then
## And we have a debuggable executable
## Some operating systems, notably Windows and RHEL7, require that a
## Some operating systems, notably Windows, require that a
## copy of the Python code be placed next to the executable:
if [ "$result" = "0" ]; then
case "$os_name" in
"MINGW32_NT"|"MINGW64_NT"|"MSYS_NT"|"centos7"|"rhel7")
if [ -f $PYTHON ]
then
if [ -z $PYTHON_DESTINATION ]
then
## The destination is the first thing after the -o:
PYTHON_DESTINATION=$(echo $FINAL_COMMAND | sed 's/.* -o //' | cut -d ' ' -f 1)
PYTHON_DESTINATION=$(realpath $PYTHON_DESTINATION)
PYTHON_DESTINATION=$(dirname $PYTHON_DESTINATION)
echo $PYTHON_DESTINATION
fi
if [ -z $PYTHON_NAME ]
then
PYTHON_NAME="$FILE_ROOT-gdb.py"
fi
if [ $ECHO ]
then
echo "cp $PYTHON $PYTHON_DESTINATION/$PYTHON_NAME"
fi
cp $PYTHON $PYTHON_DESTINATION/$PYTHON_NAME
else
echo ERROR: "Couldn't find a copy of cobcd.py"
if [ -z $DASH_S ] && [ -z $DASH_F ]
then
## Because we didn't embed a pointer or the script, we need to
## make a local copy
if [ -f $PYTHON ]
then
if [ -z $PYTHON_DESTINATION ]
then
## The destination is the first thing after the -o:
PYTHON_DESTINATION=$(echo $FINAL_COMMAND | sed 's/.* -o //' | cut -d ' ' -f 1)
PYTHON_DESTINATION=$(realpath $PYTHON_DESTINATION)
PYTHON_DESTINATION=$(dirname $PYTHON_DESTINATION)
echo $PYTHON_DESTINATION
fi
if [ -z $PYTHON_NAME ]
then
PYTHON_NAME="$FILE_ROOT-gdb.py"
fi
if [ $ECHO ]
then
echo "cp $PYTHON $PYTHON_DESTINATION/$PYTHON_NAME"
fi
cp $PYTHON $PYTHON_DESTINATION/$PYTHON_NAME
else
echo ERROR: "Couldn't find a copy of cobcd.py"
fi
esac
fi
fi
## clean up after ourselves, assuming that's desired
......
......@@ -203,12 +203,13 @@ static void
Usage()
{
cerr << "cobst: Cobol Symbol Table generator version: " << VERSION << endl;
cerr << "cobst [-v] [-q] [-n] root CobolSourceFilename\n";
cerr << "cobst [-v] [-q] [-f] [-s] root CobolSourceFilename\n";
cerr << "Reads various other files with the same root;\n";
cerr << "Generates root.sym.c containing the symbol table data\n";
cerr << "-q suppresses the one-line version announcement\n";
cerr << "-v generates the one-line version announcement and exits\n";
cerr << "-n suppresses the insertion of cobcb.py into SOURCE.sym.c\n";
cerr << "-f inserts a Type1 pointer to cobcd.py into SOURCE.sym.c\n";
cerr << "-n inserts a Type3 copy of cobcb.py into SOURCE.sym.c\n";
}
void
......@@ -242,12 +243,12 @@ PARAMETERS::GetParameters(int argc, char *argv[])
}
quiet = false;
insert_python = true;
insert_python = false;
insert_filename = false;
string root;
int c;
while ((c = getopt (argc, argv, "qvn7")) != -1) {
while ((c = getopt (argc, argv, "qvfs")) != -1) {
switch (c) {
case 'q':
quiet = true;
......@@ -257,10 +258,10 @@ PARAMETERS::GetParameters(int argc, char *argv[])
<< VERSION << endl;
exit(0);
break;
case 'n':
insert_python = false;
case 's':
insert_python = true;
break;
case '7':
case 'f':
insert_filename = true;
break;
case '?':
......
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