Project

General

Profile

CoCoALib-0.99800_qt5gui+buildscriptpatches.sh

Ulrich von der Ohe, 24 Oct 2022 08:54

 
1
#!/bin/sh
2

    
3
# In the CoCoALib-0.99800 release some files necessary for building the GUI
4
# are missing. See https://cocoa.dima.unige.it/redmine/issues/1393#note-13
5
# This script copies these files from the previous release 0.99718 and patches
6
# them for Qt5 support.
7
#
8
# Executing this script in an empty folder will download both releases of
9
# CoCoALib (0.99718 and 0.99800); releases already present will not be
10
# downloaded again.
11
#
12
# Additionally, various patches to the build system are applied, also
13
# described in https://cocoa.dima.unige.it/redmine/issues/1393
14
#
15
# The files in the folder CoCoALib-0.99800_patched will afterwards be patched.
16
#
17
# The patched configure script automatically determines if the Qt5 GUI can be
18
# built. For building without the GUI pass the option --no-qt-gui to the
19
# configure script.
20

    
21
VER1='0.99718'
22
VER2='0.99800'
23
VERS="$VER1 $VER2"
24

    
25
COCOALIB_VER1_DIR="CoCoALib-$VER1"
26
COCOALIB_VER2_DIR="CoCoALib-$VER2"
27
COCOALIB_PATCHED_DIR="${COCOALIB_VER2_DIR}_patched"
28
DIRS="$COCOALIB_VER1_DIR $COCOALIB_VER2_DIR $COCOALIB_PATCHED_DIR"
29

    
30
COCOALIB_VER1_SHA256=\
31
'1b822387c4482c1e81b1d060abca726a27507702c7c642c10c094527fc0e7bbc'
32
COCOALIB_VER2_SHA256=\
33
'f8bb227e2e1729e171cf7ac2008af71df25914607712c35db7bcb5a044a928c6'
34

    
35
# Check if directory is clean enough:
36
printf '%s' "Checking directory... "
37
for dir in $DIRS; do
38
    if [ -e "$dir" ]; then
39
        printf '\n%s\n' "Error: $dir already exists, exiting" > /dev/stderr
40
        exit 1
41
    fi
42
done
43
printf '%s\n' "done"
44

    
45
SHA256PRG="$(command -v sha256sum || command -v sha256)"
46

    
47
# Download CoCoALib and check SHA256 sums:
48
for i in $VERS; do
49
    if [ "$i" = "$VER1" ]; then
50
        SHA256SUM="$COCOALIB_VER1_SHA256"
51
    elif [ "$i" = "$VER2" ]; then
52
        SHA256SUM="$COCOALIB_VER2_SHA256"
53
    else
54
        printf '%s\n' "An error occured: \$i = $i" > /dev/stderr
55
        exit 1
56
    fi
57
    if [ ! -e "CoCoALib-$i.tgz" ]; then
58
        printf '%s' "Downloading CoCoALib-$i.tgz... "
59
        wget -q "https://cocoa.dima.unige.it/cocoa/cocoalib/tgz/CoCoALib-$i.tgz"
60
        printf '%s\n' "done"
61
    fi
62
    printf '%s' "Verifying CoCoALib-$i.tgz... "
63
    if ! { "$SHA256PRG" -c <<- EOF
64
	$SHA256SUM  CoCoALib-$i.tgz
65
	EOF
66
        } > /dev/null; then
67
        printf '\n%s\n' "Error: CoCoALib-$i.tgz invalid" > /dev/stderr
68
        exit 1
69
    fi
70
    printf '%s\n' "done"
71
done
72

    
73
# Unpack CoCoALib:
74
for i in $VERS; do
75
    printf '%s' "Unpacking CoCoALib-$i... "
76
    tar xzf "CoCoALib-$i.tgz"
77
    printf '%s\n' "done"
78
done
79

    
80
# Copy the missing files from the old release to the new one:
81
printf '%s' "Copying files... "
82
SRC="$COCOALIB_VER1_DIR"
83
DST="$COCOALIB_VER2_DIR"
84

    
85
mkdir -p "$DST/src/CoCoA-5"
86
cp -p \
87
"$SRC/src/CoCoA-5/C5.pro.in" \
88
"$SRC/src/CoCoA-5/C5.qrc" \
89
"$SRC/src/CoCoA-5/Console.ui" \
90
"$SRC/src/CoCoA-5/Debugger.ui" \
91
"$SRC/src/CoCoA-5/MainWindow.ui" \
92
"$SRC/src/CoCoA-5/make-c5makefile.sh" \
93
"$SRC/src/CoCoA-5/make-gui-finish.sh" \
94
"$SRC/src/CoCoA-5/make-qcodeeditmakefile.sh" \
95
"$SRC/src/CoCoA-5/SourceEditor.ui" \
96
"$DST/src/CoCoA-5"
97

    
98
mkdir -p "$DST/src/CoCoA-5/images"
99
cp -p \
100
"$SRC/src/CoCoA-5/images/applications-graphics.png" \
101
"$SRC/src/CoCoA-5/images/CoCoALogo-icon.png" \
102
"$SRC/src/CoCoA-5/images/dialog-information.png" \
103
"$SRC/src/CoCoA-5/images/document-new.png" \
104
"$SRC/src/CoCoA-5/images/document-open.png" \
105
"$SRC/src/CoCoA-5/images/document-save-as.png" \
106
"$SRC/src/CoCoA-5/images/document-save.png" \
107
"$SRC/src/CoCoA-5/images/emblem-system.png" \
108
"$SRC/src/CoCoA-5/images/go-jump.png" \
109
"$SRC/src/CoCoA-5/images/go-last.png" \
110
"$SRC/src/CoCoA-5/images/go-next.png" \
111
"$SRC/src/CoCoA-5/images/go-top.png" \
112
"$SRC/src/CoCoA-5/images/go-up.png" \
113
"$SRC/src/CoCoA-5/images/help-browser.png" \
114
"$SRC/src/CoCoA-5/images/preferences-desktop-font.png" \
115
"$SRC/src/CoCoA-5/images/preferences-desktop-keyboard-shortcuts.png" \
116
"$SRC/src/CoCoA-5/images/preferences-system.png" \
117
"$SRC/src/CoCoA-5/images/preferences-system-windows.png" \
118
"$SRC/src/CoCoA-5/images/process-stop.png" \
119
"$SRC/src/CoCoA-5/images/system-log-out.png" \
120
"$SRC/src/CoCoA-5/images/utilities-system-monitor.png" \
121
"$SRC/src/CoCoA-5/images/utilities-terminal.png" \
122
"$DST/src/CoCoA-5/images"
123

    
124
mkdir -p "$DST/src/CoCoA-5/QCodeEdit/document"
125
cp -p \
126
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentbuffer.cpp" \
127
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentbuffer.h" \
128
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentcommand.cpp" \
129
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentcommand.h" \
130
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocument.cpp" \
131
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentcursor.cpp" \
132
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentcursor.h" \
133
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentcursor_p.h" \
134
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocument.h" \
135
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentline.cpp" \
136
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentline.h" \
137
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentline_p.h" \
138
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocument_p.h" \
139
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.cpp" \
140
"$SRC/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.h" \
141
"$DST/src/CoCoA-5/QCodeEdit/document"
142

    
143
mkdir -p "$DST/src/CoCoA-5/QCodeEdit/images"
144
cp -p \
145
"$SRC/src/CoCoA-5/QCodeEdit/images/bold.png" \
146
"$SRC/src/CoCoA-5/QCodeEdit/images/closeall.png" \
147
"$SRC/src/CoCoA-5/QCodeEdit/images/comment.png" \
148
"$SRC/src/CoCoA-5/QCodeEdit/images/copy.png" \
149
"$SRC/src/CoCoA-5/QCodeEdit/images/cut.png" \
150
"$SRC/src/CoCoA-5/QCodeEdit/images/down.png" \
151
"$SRC/src/CoCoA-5/QCodeEdit/images/editor.png" \
152
"$SRC/src/CoCoA-5/QCodeEdit/images/Edyuk.qrc" \
153
"$SRC/src/CoCoA-5/QCodeEdit/images/exit.png" \
154
"$SRC/src/CoCoA-5/QCodeEdit/images/fillcolor.png" \
155
"$SRC/src/CoCoA-5/QCodeEdit/images/find.png" \
156
"$SRC/src/CoCoA-5/QCodeEdit/images/formats.png" \
157
"$SRC/src/CoCoA-5/QCodeEdit/images/goto.png" \
158
"$SRC/src/CoCoA-5/QCodeEdit/images/indent.png" \
159
"$SRC/src/CoCoA-5/QCodeEdit/images/italic.png" \
160
"$SRC/src/CoCoA-5/QCodeEdit/images/new.png" \
161
"$SRC/src/CoCoA-5/QCodeEdit/images/open.png" \
162
"$SRC/src/CoCoA-5/QCodeEdit/images/package_settings.png" \
163
"$SRC/src/CoCoA-5/QCodeEdit/images/paste.png" \
164
"$SRC/src/CoCoA-5/QCodeEdit/images/print.png" \
165
"$SRC/src/CoCoA-5/QCodeEdit/images/redo.png" \
166
"$SRC/src/CoCoA-5/QCodeEdit/images/reload.png" \
167
"$SRC/src/CoCoA-5/QCodeEdit/images/replace.png" \
168
"$SRC/src/CoCoA-5/QCodeEdit/images/saveas.png" \
169
"$SRC/src/CoCoA-5/QCodeEdit/images/save.png" \
170
"$SRC/src/CoCoA-5/QCodeEdit/images/settings.png" \
171
"$SRC/src/CoCoA-5/QCodeEdit/images/strikeout.png" \
172
"$SRC/src/CoCoA-5/QCodeEdit/images/strokecolor.png" \
173
"$SRC/src/CoCoA-5/QCodeEdit/images/textcolor.png" \
174
"$SRC/src/CoCoA-5/QCodeEdit/images/uncomment.png" \
175
"$SRC/src/CoCoA-5/QCodeEdit/images/underline.png" \
176
"$SRC/src/CoCoA-5/QCodeEdit/images/undo.png" \
177
"$SRC/src/CoCoA-5/QCodeEdit/images/unindent.png" \
178
"$SRC/src/CoCoA-5/QCodeEdit/images/up.png" \
179
"$DST/src/CoCoA-5/QCodeEdit/images"
180

    
181
mkdir -p "$DST/src/CoCoA-5/QCodeEdit/qnfa"
182
cp -p \
183
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/light_vector.h" \
184
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/qnfa.cpp" \
185
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/qnfadefinition.cpp" \
186
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/qnfadefinition.h" \
187
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/qnfa.h" \
188
"$SRC/src/CoCoA-5/QCodeEdit/qnfa/xml2qnfa.cpp" \
189
"$DST/src/CoCoA-5/QCodeEdit/qnfa"
190

    
191
mkdir -p "$DST/src/CoCoA-5/QCodeEdit/snippets"
192
cp -p \
193
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetbinding.cpp" \
194
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetbinding.h" \
195
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippet.cpp" \
196
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetedit.cpp" \
197
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetedit.h" \
198
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippet.h" \
199
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.cpp" \
200
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.h" \
201
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippetpatternloader.h" \
202
"$SRC/src/CoCoA-5/QCodeEdit/snippets/qsnippet_p.h" \
203
"$SRC/src/CoCoA-5/QCodeEdit/snippets/snippetedit.ui" \
204
"$DST/src/CoCoA-5/QCodeEdit/snippets"
205

    
206
mkdir -p "$DST/src/CoCoA-5/QCodeEdit/widgets"
207
cp -p \
208
"$SRC/src/CoCoA-5/QCodeEdit/widgets/editconfig.ui" \
209
"$SRC/src/CoCoA-5/QCodeEdit/widgets/formatconfig.ui" \
210
"$SRC/src/CoCoA-5/QCodeEdit/widgets/gotolinedialog.ui" \
211
"$SRC/src/CoCoA-5/QCodeEdit/widgets/gotoline.ui" \
212
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qcalltip.cpp" \
213
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qcalltip.h" \
214
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qeditconfig.cpp" \
215
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qeditconfig.h" \
216
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qfoldpanel.cpp" \
217
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qfoldpanel.h" \
218
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qformatconfig.cpp" \
219
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qformatconfig.h" \
220
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qgotolinedialog.cpp" \
221
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qgotolinedialog.h" \
222
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qgotolinepanel.cpp" \
223
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qgotolinepanel.h" \
224
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinechangepanel.cpp" \
225
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinechangepanel.h" \
226
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinemarkpanel.cpp" \
227
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinemarkpanel.h" \
228
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinenumberpanel.cpp" \
229
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qlinenumberpanel.h" \
230
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qpanel.cpp" \
231
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qpanel.h" \
232
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qsearchreplacepanel.cpp" \
233
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qsearchreplacepanel.h" \
234
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qsimplecolorpicker.cpp" \
235
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qsimplecolorpicker.h" \
236
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qstatuspanel.cpp" \
237
"$SRC/src/CoCoA-5/QCodeEdit/widgets/qstatuspanel.h" \
238
"$SRC/src/CoCoA-5/QCodeEdit/widgets/searchreplace.ui" \
239
"$DST/src/CoCoA-5/QCodeEdit/widgets"
240

    
241
mkdir -p "$DST/src/CoCoA-5/qxs"
242
cp -p \
243
"$SRC/src/CoCoA-5/qxs/cocoa5.qnfa" \
244
"$DST/src/CoCoA-5/qxs"
245
printf '%s\n' "done"
246

    
247
# Apply Qt5 patches to the copied files:
248
printf '%s' "Applying Qt5 patches to copied files... "
249
patch -d "$COCOALIB_VER2_DIR" -p1 -s << 'EOFQT5PATCH'
250
diff -Naur CoCoALib-0.99800/src/CoCoA-5/C5.pro.in CoCoALib-0.99800_gui/src/CoCoA-5/C5.pro.in
251
--- CoCoALib-0.99800/src/CoCoA-5/C5.pro.in	2019-12-18 09:25:25.000000000 +0100
252
+++ CoCoALib-0.99800_gui/src/CoCoA-5/C5.pro.in	2022-03-03 20:32:17.711894478 +0100
253
@@ -1,10 +1,10 @@
254
 
255
 #QMAKE_CXXFLAGS += -ansi -Wall -Wextra -pedantic -O0 -g3
256
 #QMAKE_CXXFLAGS += -ansi -Wall -Wextra -pedantic # for bug in gcc-4.5.2
257
-QMAKE_CXXFLAGS += -std=c++11 -ansi -Wall -Wextra -pedantic -O2
258
+QMAKE_CXXFLAGS += -std=c++14 -Wall -pedantic -O2
259
 QMAKE_MAKEFILE = C5Makefile
260
 DESTDIR = .
261
-CONFIG += c++11 debug qt thread
262
+CONFIG += c++14 debug qt thread
263
 TEMPLATE = app
264
 TARGET = C5
265
 DEPENDPATH += .
266
@@ -16,7 +16,7 @@
267
 MOC_DIR = 
268
 UI_DIR =
269
 OBJECTS_DIR = Debug
270
-QT += xml
271
+QT += xml webkitwidgets printsupport
272
 HEADERS += AST.H \
273
            C5.H \
274
 	   CoCoALibSupplement.H \
275
@@ -34,6 +34,7 @@
276
 SOURCES += AST.C \
277
            BuiltInFunctions.C \
278
            BuiltInFunctions-CoCoALib.C \
279
+           BuiltInFunctionsVarArgs-CoCoALib.C \
280
            BuiltInOneLiners-CoCoALib.C \
281
            BuiltInFunctions-Frobby.C \
282
            BuiltInFunctions-GFan.C \
283
@@ -49,6 +50,7 @@
284
            Banner.C \
285
 	   OnlineHelp.C \
286
            VersionInfo.C \
287
-           Parser.C 
288
+           Parser.C \
289
+           globals.C 
290
 RESOURCES += C5.qrc
291
 
292
diff -Naur CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/document/qdocument.cpp CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/document/qdocument.cpp
293
--- CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/document/qdocument.cpp	2010-08-23 21:57:39.000000000 +0200
294
+++ CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/document/qdocument.cpp	2022-02-25 15:35:53.956652017 +0100
295
@@ -6157,7 +6157,8 @@
296
 			
297
 		it = areas.insert(m.line, n);
298
 		
299
-		if ( it != areas.end() && (it - 1) != areas.end() )
300
+		// if ( it != areas.end() && (it - 1) != areas.end() )
301
+		if ( it != areas.end() && it != areas.begin() )
302
 		{
303
 			tmp = it - 1;
304
 			int off = tmp.key() + *tmp - l;
305
diff -Naur CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.cpp CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.cpp
306
--- CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.cpp	2010-08-23 21:57:39.000000000 +0200
307
+++ CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/document/qdocumentsearch.cpp	2022-02-25 15:35:53.956652017 +0100
308
@@ -566,7 +566,7 @@
309
 				{
310
 					QString replacement = m_replace;
311
 					
312
-					for ( int i = m_regexp.numCaptures(); i >= 0; --i )
313
+					for ( int i = m_regexp.captureCount(); i >= 0; --i )
314
 						replacement.replace(QString("\\") + QString::number(i),
315
 											m_regexp.cap(i));
316
 					
317
diff -Naur CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.h CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.h
318
--- CoCoALib-0.99800/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.h	2010-08-23 21:57:39.000000000 +0200
319
+++ CoCoALib-0.99800_gui/src/CoCoA-5/QCodeEdit/snippets/qsnippetmanager.h	2022-02-25 15:35:53.960652065 +0100
320
@@ -23,6 +23,7 @@
321
 	\brief Definition of the QSnippetManager class
322
 */
323
 
324
+#include <QObject>
325
 #include <QStringList>
326
 
327
 class QSnippet;
328
EOFQT5PATCH
329
printf '%s\n' "done"
330

    
331
# Apply patches to the build scripts:
332
printf '%s' "Applying patches to build scripts... "
333
patch -d "$COCOALIB_VER2_DIR" -p1 -s << 'EOFBUILDPATCH'
334
diff -Naur CoCoALib-0.99800_gui/configuration/boost-check-arch.sh CoCoALib-0.99800_patched/configuration/boost-check-arch.sh
335
--- CoCoALib-0.99800_gui/configuration/boost-check-arch.sh	2022-03-25 16:29:32.000000000 +0000
336
+++ CoCoALib-0.99800_patched/configuration/boost-check-arch.sh	2022-10-24 06:06:19.074135623 +0000
337
@@ -9,9 +9,9 @@
338
 SCRIPT_NAME=[[`basename "$0"`]]
339
 SCRIPT_DIR=`dirname "$0"`
340
 
341
-if [ $# -ne 1 ]
342
+if [ $# -ne 3 ]
343
 then
344
-  echo "ERROR: expecting 1 arg (LIBS for linker)   $SCRIPT_NAME"  > /dev/stderr
345
+  echo "ERROR: expecting 3 args (INC_DIR, LIB_DIR, and LIBS for linker)   $SCRIPT_NAME"  > /dev/stderr
346
   exit 1
347
 fi
348
 
349
@@ -21,7 +21,9 @@
350
   exit 1
351
 fi
352
 
353
-BOOST_LDLIBS="$1"
354
+BOOST_INC_DIR="$1"
355
+BOOST_LIB_DIR="$2"
356
+BOOST_LDLIBS="$3"
357
 
358
 # We create a temp dir and work in there.
359
 umask 22
360
@@ -42,8 +44,8 @@
361
 }
362
 EOF
363
 
364
-echo "$CXX $CXXFLAGS  -I\"$COCOA_EXTLIB_DIR/include\" test-boost-arch.C -o test-boost-arch -L\"$COCOA_EXTLIB_DIR/lib\" $BOOST_LDLIBS" > LogFile
365
-$CXX $CXXFLAGS  -I"$COCOA_EXTLIB_DIR/include" test-boost-arch.C -o test-boost-arch -L"$COCOA_EXTLIB_DIR/lib" $BOOST_LDLIBS  >> LogFile  2>&1
366
+echo "$CXX $CXXFLAGS  -I\"$COCOA_EXTLIB_DIR/include\" -I\"$BOOST_INC_DIR\" test-boost-arch.C -o test-boost-arch -L\"$COCOA_EXTLIB_DIR/lib\" -L\"$BOOST_LIB_DIR\" $BOOST_LDLIBS" > LogFile
367
+$CXX $CXXFLAGS  -I"$COCOA_EXTLIB_DIR/include" -I"$BOOST_INC_DIR" test-boost-arch.C -o test-boost-arch -L"$COCOA_EXTLIB_DIR/lib" -L"$BOOST_LIB_DIR" $BOOST_LDLIBS  >> LogFile  2>&1
368
 if [ $? -ne 0 ]
369
 then
370
   echo "ERROR: compilation failed --> see LogFile   $SCRIPT_NAME"   > /dev/stderr
371
diff -Naur CoCoALib-0.99800_gui/configuration/fixed_part2 CoCoALib-0.99800_patched/configuration/fixed_part2
372
--- CoCoALib-0.99800_gui/configuration/fixed_part2	2022-03-25 16:29:32.000000000 +0000
373
+++ CoCoALib-0.99800_patched/configuration/fixed_part2	2022-10-24 06:06:19.074135623 +0000
374
@@ -7,7 +7,8 @@
375
 
376
 COCOA_HDR=$(COCOA_ROOT)/include/CoCoA/library.H
377
 
378
-INCLUDE_PATHS=-I$(COCOA_ROOT)/include  -$(ISYSTEM) $(EXTLIBS)/include
379
+INCLUDE_PATHS=-I$(COCOA_ROOT)/include  -$(ISYSTEM) $(EXTLIBS)/include \
380
+$(ISYSTEM_BOOST_INCLUDE) $(ISYSTEM_READLINE_INCLUDE)
381
 COMPILE=$(CXX)  $(CXXFLAGS)  $(INCLUDE_PATHS)
382
 COCOA_LIB=$(COCOA_ROOT)/lib/libcocoa.a
383
 
384
diff -Naur CoCoALib-0.99800_gui/configuration/fpic-ldflag.sh CoCoALib-0.99800_patched/configuration/fpic-ldflag.sh
385
--- CoCoALib-0.99800_gui/configuration/fpic-ldflag.sh	2022-03-25 16:29:32.000000000 +0000
386
+++ CoCoALib-0.99800_patched/configuration/fpic-ldflag.sh	1970-01-01 00:00:00.000000000 +0000
387
@@ -1,54 +0,0 @@
388
-#!/bin/bash
389
-
390
-SCRIPT_NAME=[[`basename "$0"`]]
391
-SCRIPT_DIR=`dirname "$0"`
392
-
393
-# Auxiliary script for CoCoALib configuration process.
394
-# Expects env variable CXX to be set (to compiler's name).
395
-
396
-# Script to see whether compiler is clang, and then link with special flags.
397
-# If no warning is produced, the script prints -fPIC; otherwise it prints nothing.
398
-
399
-if [ $# -ne 0 ]
400
-then
401
-  echo "ERROR: expected no args   $SCRIPT_NAME"  > /dev/stderr
402
-  exit 1
403
-fi
404
-
405
-# Check environment variable CXX
406
-if [ -z "$CXX" ]
407
-then
408
-  echo "ERROR: environment variable CXX not set.   $SCRIPT_NAME"  > /dev/stderr
409
-  exit 1
410
-fi
411
-
412
-
413
-# Create tmp directory, put test prog in it, compile and run.
414
-umask 22
415
-source "$SCRIPT_DIR/shell-fns.sh"
416
-TMP_DIR=`mktempdir fpic-ldflag`
417
-
418
-pushd "$TMP_DIR"  > /dev/null
419
-
420
-# test if it is clang:  .... a bit harsh, maybe...
421
-/bin/cat > test-fpic-ldflag.C <<EOF
422
-int main()
423
-{
424
-#ifdef __clang__
425
-  exit(1);
426
-#endif
427
-}
428
-EOF
429
-
430
-FPIC_FLAG=-fPIC
431
-
432
-"$CXX" -o test-fpic-ldflag  test-fpic-ldflag.C  > LogFile  2>& 1  &&  ./test-fpic-ldflag  >> LogFile  2>&1
433
-if [ $? -ne 0 ]
434
-then
435
-  FPIC_LDFLAG="-Wl,-no_pie";
436
-fi
437
-
438
-# Clean up TMP_DIR
439
-popd  > /dev/null
440
-/bin/rm -rf "$TMP_DIR"
441
-echo $FPIC_LDFLAG
442
diff -Naur CoCoALib-0.99800_gui/configuration/qt5-check.sh CoCoALib-0.99800_patched/configuration/qt5-check.sh
443
--- CoCoALib-0.99800_gui/configuration/qt5-check.sh	1970-01-01 00:00:00.000000000 +0000
444
+++ CoCoALib-0.99800_patched/configuration/qt5-check.sh	2022-10-24 06:06:19.074135623 +0000
445
@@ -0,0 +1,108 @@
446
+#!/bin/bash
447
+
448
+# This script checks sufficiency of installed Qt5 system for the CoCoA5 GUI.
449
+# Exit code is 0 if sufficient, o/w non-zero.
450
+
451
+# This script expects no arguments.
452
+
453
+SCRIPT_NAME="[[$(basename "$0")]]"
454
+SCRIPT_DIR="$(dirname "$0")"
455
+
456
+if [ $# -ne 0 ]; then
457
+    echo "ERROR: expected no args   $SCRIPT_NAME" > /dev/stderr
458
+    exit 1
459
+fi
460
+
461
+# Create tmp directory, put test prog in it, compile and run.
462
+umask 22
463
+. "$SCRIPT_DIR/shell-fns.sh"
464
+TMP_DIR="$(mktempdir qt5-check)"
465
+
466
+pushd "$TMP_DIR" > /dev/null || exit 255
467
+
468
+# Create project file for qmake
469
+/bin/cat > qt5-check.pro << 'EOF'
470
+QMAKE_MAKEFILE = qt5-check-makefile
471
+
472
+TEMPLATE = app
473
+TARGET = qt5-check
474
+QT += xml webkitwidgets printsupport # crucial line with dependencies
475
+SOURCES += qt5-check.cpp
476
+EOF
477
+
478
+# Create C++ file
479
+/bin/cat > qt5-check.cpp << 'EOF'
480
+#include <QtWidgets/QApplication> // a header file necessary for QCodeEdit
481
+#include <iostream>
482
+
483
+int main() {
484
+    std::cout << "Qt5 version " << qVersion() << " found" << std::endl;
485
+    return 0;
486
+}
487
+EOF
488
+
489
+# Set qmake flag for macOS (see src/CoCoA-5/make-c5makefile.sh
490
+#                           and src/CoCoA-5/make-qcodeeditmakefile.sh)
491
+if [ "$(uname)" = "Darwin" ]; then
492
+    DARWIN_OPTS="-spec macx-g++"
493
+fi
494
+
495
+# Check for qmake
496
+if ! QMAKE=$(   ( command -v qmake-qt5 2>  LogFile ) \
497
+             || ( command -v qmake     2>> LogFile ) ); then
498
+    # Deliberately leave $TMP_DIR to assist debugging.
499
+    echo "ERROR: qmake (and qmake-qt5) not found   $SCRIPT_NAME" > /dev/stderr
500
+    exit 3
501
+fi
502
+
503
+# Basic check of $QMAKE
504
+echo "$QMAKE -v" > LogFile
505
+if ! "$QMAKE" -v >> LogFile 2>&1; then
506
+    # Deliberately leave $TMP_DIR to assist debugging.
507
+    echo "ERROR: $QMAKE not working properly   $SCRIPT_NAME" > /dev/stderr
508
+    exit 4
509
+fi
510
+
511
+# Use $QMAKE to create makefile
512
+echo "$QMAKE $DARWIN_OPTS qt5-check.pro" > LogFile
513
+if ! "$QMAKE" $DARWIN_OPTS qt5-check.pro >> LogFile 2>&1; then
514
+    # Deliberately leave $TMP_DIR to assist debugging.
515
+    echo "ERROR: $QMAKE exited abnormally --> see LogFile.   $SCRIPT_NAME" \
516
+    > /dev/stderr
517
+    exit 5
518
+fi
519
+
520
+# If MAKE is unset, try to set it reasonably
521
+if [ -z "$MAKE" ]; then
522
+    echo "Warning: MAKE not set, trying to find it   $SCRIPT_NAME" > LogFile
523
+    if ! MAKE="$(command -v make 2>> LogFile)"; then
524
+        # Deliberately leave $TMP_DIR to assist debugging.
525
+        echo "ERROR: make not found   $SCRIPT_NAME" > /dev/stderr
526
+        exit 6
527
+    fi
528
+fi
529
+
530
+# Use $MAKE to compile cpp file
531
+echo "Using MAKE = $MAKE   $SCRIPT_NAME" > LogFile
532
+echo "$MAKE -f qt5-check-makefile" >> LogFile
533
+if ! "$MAKE" -f qt5-check-makefile >> LogFile 2>&1; then
534
+    # Deliberately leave $TMP_DIR to assist debugging.
535
+    echo "ERROR: $MAKE exited abnormally --> see LogFile.   $SCRIPT_NAME" \
536
+    > /dev/stderr
537
+    exit 7
538
+fi
539
+
540
+# Run Qt5 program
541
+echo "./qt5-check" > LogFile
542
+if ! ./qt5-check >> LogFile 2>&1; then
543
+    # Deliberately leave $TMP_DIR to assist debugging.
544
+    echo "ERROR: qt5-check exited abnormally --> see LogFile.   $SCRIPT_NAME" \
545
+     > /dev/stderr
546
+    exit 8
547
+fi
548
+
549
+# Clean up $TMP_DIR
550
+popd > /dev/null || exit 255
551
+/bin/rm -rf "$TMP_DIR"
552
+
553
+echo "$QMAKE"
554
diff -Naur CoCoALib-0.99800_gui/configuration/readline-find-hdr.sh CoCoALib-0.99800_patched/configuration/readline-find-hdr.sh
555
--- CoCoALib-0.99800_gui/configuration/readline-find-hdr.sh	2022-03-25 16:29:32.000000000 +0000
556
+++ CoCoALib-0.99800_patched/configuration/readline-find-hdr.sh	2022-10-24 06:06:19.074135623 +0000
557
@@ -54,9 +54,16 @@
558
 READLINE_LIB_DIR_DIR=`dirname "$READLINE_LIB_DIR"`
559
 READLINE_LIB_DIR_DIR_DIR=`dirname "$READLINE_LIB_DIR_DIR"`
560
 READLINE_HDR_DIR1="$READLINE_LIB_DIR_DIR/include/readline"
561
-READLINE_HDR_DIR2="$READLINE_LIB_DIR_DIR_DIR/include/readline"
562
+### On some systems there is an "intermediate" directory:
563
+INTERMEDIATE_DIR="$(basename "$READLINE_LIB")"
564
+INTERMEDIATE_DIR="${INTERMEDIATE_DIR%.*}"
565
+INTERMEDIATE_DIR="${INTERMEDIATE_DIR#lib}"
566
+READLINE_HDR_DIR2="$READLINE_LIB_DIR_DIR/include/$INTERMEDIATE_DIR/readline"
567
+###
568
+READLINE_HDR_DIR3="$READLINE_LIB_DIR_DIR_DIR/include/readline"
569
 READLINE_HDR1="$READLINE_HDR_DIR1/readline.h"
570
 READLINE_HDR2="$READLINE_HDR_DIR2/readline.h"
571
+READLINE_HDR3="$READLINE_HDR_DIR3/readline.h"
572
 
573
 if [ -f "$READLINE_HDR1" -a -r "$READLINE_HDR1" ]
574
 then
575
@@ -72,8 +79,16 @@
576
   exit 0
577
 fi
578
 
579
+if [ -f "$READLINE_HDR3" -a -r "$READLINE_HDR3" ]
580
+then
581
+  # We've found a plausible readline.h.
582
+  echo "$READLINE_HDR3"
583
+  exit 0
584
+fi
585
+
586
 echo "ERROR: Trouble finding READLINE header file:    $SCRIPT_NAME"  > /dev/stderr
587
 echo "ERROR: + tried  $READLINE_HDR1   $SCRIPT_NAME"                 > /dev/stderr
588
 echo "ERROR: + tried  $READLINE_HDR2   $SCRIPT_NAME"                 > /dev/stderr
589
+echo "ERROR: + tried  $READLINE_HDR3   $SCRIPT_NAME"                 > /dev/stderr
590
 
591
 exit 2
592
diff -Naur CoCoALib-0.99800_gui/configure CoCoALib-0.99800_patched/configure
593
--- CoCoALib-0.99800_gui/configure	2022-03-25 16:29:32.346970365 +0000
594
+++ CoCoALib-0.99800_patched/configure	2022-10-24 06:06:19.074135623 +0000
595
@@ -84,7 +84,7 @@
596
 
597
 COCOA_DEBUG="no"
598
 
599
-BUILD_QT_GUI="no"
600
+BUILD_QT_GUI="yes"
601
 
602
 # Below, is there a neater way to do tilde expansion for paths to libraries???
603
 for option in "$@"
604
@@ -114,8 +114,8 @@
605
     ( --with-libgmp=* )
606
        GMP_LIB=`echo "$option" | cut -f 2- -d=` ;;
607
 
608
-    ( --Qt-gui )
609
-      BUILD_QT_GUI=yes ;;
610
+    ( --no-qt-gui )
611
+      BUILD_QT_GUI=no ;;
612
 
613
     (--no-boost )
614
 	AVOID_BOOST=yes ;;
615
@@ -257,8 +257,8 @@
616
        echo -e "  --no-readline\t\tdo not look for libreadline.a"
617
        echo -e "  --with-libreadline=ARG\tspecify location of the file libreadline.a"
618
        echo -e "\t\t\t[default is to search for libreadline.a]"
619
-       echo -e "  --Qt-gui\t\tbuild also the Qt GUI for CoCoA-5"
620
-       echo -e "\t\t\t>>> REQUIRES qmake & Qt webkit libraries <<<"
621
+       echo -e "  --no-qt-gui\t\tdisable building the Qt5 GUI for CoCoA-5"
622
+       echo -e "\t\t\t[default is to determine automatically]"
623
        exit;;
624
 
625
     ( * )
626
@@ -363,7 +363,7 @@
627
 if [ "$CXX_TYPE" = "gnu" -a -z "$CXXFLAGS" ]
628
 then
629
     FPIC=`$SCRIPT_DIR/fpic-flag.sh`
630
-    LDFPIC=`$SCRIPT_DIR/fpic-ldflag.sh`
631
+    LDFPIC='-fPIC'
632
 fi
633
 
634
 CXXFLAGS="$CXXFLAGS  $CXX14_FLAG  -Wall  -pedantic  $FPIC"
635
@@ -616,6 +616,7 @@
636
       HAVE_READLINE=yes
637
       READLINE_LIB="$READLINE_LIB  $LIBTERMCAP"
638
     fi
639
+    READLINE_INC_DIR="$(dirname "$(dirname "$READLINE_HDR")")"
640
   fi
641
 fi
642
 
643
@@ -991,11 +992,11 @@
644
     eval "$BOOST_MESG"  # sets BOOST_LIB_DIR and BOOST_LDLIBS
645
     BOOST_LIB_NOT_FOUND=
646
     # Check that the BOOST libs are compatible with CXX and CXXFLAGS
647
-    BOOST_MESG=`$SCRIPT_DIR/boost-check-arch.sh  "$BOOST_LDLIBS" 2>&1`
648
+    BOOST_MESG=`$SCRIPT_DIR/boost-check-arch.sh "$BOOST_INC_DIR" "$BOOST_LIB_DIR" "$BOOST_LDLIBS" 2>&1`
649
     if [ $? -ne 0 ]
650
     then
651
       BOOST_LDLIBS_STATIC="-Wl,-Bstatic $BOOST_LDLIBS -Wl,-Bdynamic"
652
-      BOOST_MESG2=`$SCRIPT_DIR/boost-check-arch.sh  "$BOOST_LDLIBS_STATIC" 2>&1`
653
+      BOOST_MESG2=`$SCRIPT_DIR/boost-check-arch.sh "$BOOST_INC_DIR" "$BOOST_LIB_DIR" "$BOOST_LDLIBS_STATIC" 2>&1`
654
       if [ $? -eq 0 ]
655
       then
656
 	BOOST_LDLIBS=$BOOST_LDLIBS_STATIC
657
@@ -1038,43 +1039,29 @@
658
 
659
 
660
 ##################################################################
661
-# If user requested building the Qt GUI...
662
-# (1) check whether "qmake" is available -- needed for building the GUI
663
-# (2) assume that if "qmake" is available then all of QT is too.
664
-# (3) also check that "qmake" actually runs (Ubuntu 14.04 can have a broken symlink)
665
-# (4) also check that BOOST is available (o/w cannot build CoCoA-5)
666
+# Determine if Qt5 GUI is to be built
667
 
668
-if [ "$BUILD_QT_GUI" = "yes" ]
669
+if [ "$HAVE_BOOST" = 'no' ]
670
 then
671
-#HAVE_QMAKE=no
672
-    QMAKE=`which qmake 2>/dev/null`
673
-    if [ $? -ne 0 ]
674
-    then
675
-	QMAKE_ERR="qmake (Qt4) not found";
676
-    else
677
-	JUNK=`[ -x "$QMAKE" ] && qmake -help 2>&1 >/dev/null`
678
-	if [ $? -ne 0 ]
679
-	then
680
-	    QMAKE_ERR="qmake not working properly"
681
-	fi
682
-    fi
683
-    if [ -n "$QMAKE_ERR" ]
684
-    then
685
-	echo "$0: ERROR:  $QMAKE_ERR"   > /dev/stderr
686
-	exit 1;
687
-    fi
688
+  echo "Cannot build CoCoA-5 or its GUI without BOOST"
689
+  BUILD_QT_GUI='no'
690
+fi
691
 
692
-    if [ "$HAVE_BOOST" = "no" ]
693
-    then
694
-	echo "$0: ERROR:  cannot build CoCoA-5 or its GUI without BOOST"  > /dev/stderr
695
-	exit 1;
696
-    fi
697
+if [ "$BUILD_QT_GUI" = 'no' ]
698
+then
699
+  echo "Not building Qt5 GUI"
700
+  echo
701
+else
702
+  if ! QMAKE=$("$SCRIPT_DIR/qt5-check.sh" 2> "ERR_MESGS")
703
+  then
704
+    echo "Qt5 system insufficient, not building Qt5 GUI"
705
+    echo
706
+  else
707
+    echo "Building Qt5 GUI"
708
+    echo
709
+    BUILD_QT_GUI='yes'
710
+  fi
711
 fi
712
-#if [ "$HAVE_BOOST" = "yes" -a "$HAVE_QMAKE" = "no" ]
713
-#then
714
-#  echo "Note: we will build CoCoA5 ***without*** GUI because \"qmake\" (from Qt4) is absent"
715
-#  echo
716
-#fi
717
 
718
 
719
 ##################################################################
720
@@ -1317,6 +1304,15 @@
721
 # BOOST
722
 echo "# BOOST library:"                                       >> "$CONFIG_TMP"
723
 echo "HAVE_BOOST=$HAVE_BOOST"                                 >> "$CONFIG_TMP"
724
+if ! [ -z "$BOOST_INC_DIR" ]
725
+then
726
+#  echo "ISYSTEM_BOOST_INCLUDE=-\$(ISYSTEM) $BOOST_INC_DIR"    >> "$CONFIG_TMP"
727
+  echo "ISYSTEM_BOOST_INCLUDE=-I $BOOST_INC_DIR"              >> "$CONFIG_TMP"
728
+fi
729
+if ! [ -z "$BOOST_LIB_DIR" ]
730
+then
731
+  echo "L_BOOST_LIB_DIR=-L$BOOST_LIB_DIR"                     >> "$CONFIG_TMP"
732
+fi
733
 echo "BOOST_LDLIBS=$BOOST_LDLIBS"                             >> "$CONFIG_TMP"
734
 echo                                                          >> "$CONFIG_TMP"
735
 
736
@@ -1327,6 +1323,10 @@
737
 echo "HAVE_READLINE = $HAVE_READLINE   $READLINE_LIB"
738
 if [ $HAVE_READLINE = "yes" ]
739
 then
740
+  if ! [ -z "$READLINE_INC_DIR" ]
741
+  then
742
+    echo "ISYSTEM_READLINE_INCLUDE=-\$(ISYSTEM) $READLINE_INC_DIR" >> "$CONFIG_TMP"
743
+  fi
744
   echo "READLINE_LDLIBS=$READLINE_LIB"                        >> "$CONFIG_TMP"
745
 fi
746
 echo                                                          >> "$CONFIG_TMP"
747
@@ -1343,6 +1343,7 @@
748
 
749
 echo "# Flag saying whether to build the Qt GUI"              >> "$CONFIG_TMP"
750
 echo "BUILD_QT_GUI=$BUILD_QT_GUI"                             >> "$CONFIG_TMP"
751
+echo "QMAKE=$QMAKE"                                           >> "$CONFIG_TMP"
752
 echo                                                          >> "$CONFIG_TMP"
753
 
754
 
755
@@ -1431,20 +1432,6 @@
756
   echo
757
   sleep 3
758
 fi
759
-if [ "$BUILD_QT_GUI" = "yes" ]
760
-then
761
-    echo
762
-    echo "QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT"
763
-    echo "QT                                                                            QT"
764
-    echo "QT  To build the QT-gui, ensure that you have qmake and Qt webkit installed   QT"
765
-    echo "QT  It probably suffices to install: 'qt5-qmake' and 'libqt5webkit5-dev'      QT"
766
-    echo "QT                                                                            QT"
767
-    echo "QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT-QT"
768
-    echo
769
-    echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1; echo -e "\a"  # 3 alert beeps!!!
770
-    sleep 5
771
-    # Ulrich also needed: libqt5scxml5-dev
772
-fi
773
 echo "======================================================="
774
 echo "CoCoALib configuration process complete."
775
 echo "Configuration info saved in the following files:"
776
diff -Naur CoCoALib-0.99800_gui/doc/CoCoALib-tasks/Makefile CoCoALib-0.99800_patched/doc/CoCoALib-tasks/Makefile
777
--- CoCoALib-0.99800_gui/doc/CoCoALib-tasks/Makefile	2022-03-25 16:29:32.000000000 +0000
778
+++ CoCoALib-0.99800_patched/doc/CoCoALib-tasks/Makefile	2022-10-24 06:06:19.074135623 +0000
779
@@ -1,7 +1,7 @@
780
 # Makefile for CoCoALib/doc/CoCoALib-tasks/ directory.
781
 
782
-# COCOA_ROOT=../..
783
-# include $(COCOA_ROOT)/configuration/autoconf.mk
784
+COCOA_ROOT=../..
785
+include $(COCOA_ROOT)/configuration/autoconf.mk # sets CXX
786
 CWD=doc/CoCoALib-tasks
787
 
788
 EXEC = HTMLTasks
789
@@ -22,7 +22,7 @@
790
 
791
 $(EXEC): $(C_SRCS)
792
 	@echo "Generating executable" $(EXEC) "..."
793
-	@g++ -g -Wextra  HTMLTasks.C  -o $(EXEC)
794
+	@$(CXX) -g -Wextra  HTMLTasks.C  -o $(EXEC)
795
 	/bin/rm -rf  $(EXEC).dSYM
796
 
797
 .PHONY: clean clean-local
798
diff -Naur CoCoALib-0.99800_gui/doc/Makefile CoCoALib-0.99800_patched/doc/Makefile
799
--- CoCoALib-0.99800_gui/doc/Makefile	2022-03-25 16:29:32.000000000 +0000
800
+++ CoCoALib-0.99800_patched/doc/Makefile	2022-10-24 06:06:19.074135623 +0000
801
@@ -12,9 +12,9 @@
802
 DOC_SRCS = $(wildcard $(SRC_DIR)/*.txt)
803
 DOC_HTML = $(patsubst $(SRC_DIR)/%.txt,$(HTML_DIR)/%.html,$(DOC_SRCS))
804
 TASKS_OUT = CoCoALib-tasks.html  CoCoALib-CompletedTasks.html
805
-##TXT2TAGS = txt2tags   # if installed version is new enough
806
+TXT2TAGS = txt2tags   # if installed version is new enough
807
 ##TXT2TAGS = /usr/local/Cellar/txt2tags/3.7_3/bin/txt2tags
808
-TXT2TAGS = $(AUX_DIR)/txt2tags
809
+##TXT2TAGS = $(AUX_DIR)/txt2tags
810
 
811
 .SUFFIXES:
812
 
813
@@ -42,7 +42,7 @@
814
 CoCoALib.pdf:  $(COCOA_ROOT)/configuration/version  $(DOC_SRCS)  $(AUX_DIR)/DocTeX.t2t  $(AUX_DIR)/cocoalib-doc.sty
815
 	@if [ "$(TXT2TAGS)" = "txt2tags" ]; \
816
 	 then \
817
-	   which txt2tags >/dev/null 2>&1 ; \
818
+	   command -v txt2tags > /dev/null 2>&1; \
819
 	   if [ $$? -ne 0 ]; \
820
 	   then \
821
 	     echo; \
822
@@ -51,14 +51,6 @@
823
 	     exit; \
824
 	   fi; \
825
 	 fi; \
826
-	 [ -x "$(TXT2TAGS)" ] && [ -r "$(TXT2TAGS)" ]; \
827
-         if [ $$? -ne 0 ]; \
828
-	 then \
829
-	   echo; \
830
-	   echo "***WARNING***  $(TXT2TAGS) missing ==> not creating/updating HTML documentation"; \
831
-	   echo; \
832
-	   exit; \
833
-	 fi; \
834
 	 $(MAKE)  $(TEX_DIR)/CoCoALib.tex  $(TEX_DIR)/cocoalib-doc.sty; \
835
 	 echo "Doing LaTeX-->PDF"; \
836
 	 cd $(TEX_DIR); \
837
@@ -86,7 +78,7 @@
838
 	 then \
839
 	   if [ "$(TXT2TAGS)" = "txt2tags" ]; \
840
 	   then \
841
-	     which txt2tags >/dev/null 2>&1; \
842
+	     command -v txt2tags > /dev/null 2>&1; \
843
 	     if [ $$? -ne 0 ]; \
844
 	     then \
845
 	       echo; \
846
@@ -95,14 +87,6 @@
847
 	       exit; \
848
 	     fi; \
849
 	   fi; \
850
-	   [ -x "$(TXT2TAGS)" ] && [ -r "$(TXT2TAGS)" ]; \
851
-           if [ $$? -ne 0 ]; \
852
-	   then \
853
-	     echo; \
854
-	     echo "***WARNING***  $(TXT2TAGS) missing or not executable ==> not creating/updating HTML documentation"; \
855
-	     echo; \
856
-	     exit; \
857
-	   fi; \
858
 	   $(MAKE) -s $(DOC_HTML); \
859
 	 fi
860
 
861
diff -Naur CoCoALib-0.99800_gui/src/CoCoA-5/Makefile CoCoALib-0.99800_patched/src/CoCoA-5/Makefile
862
--- CoCoALib-0.99800_gui/src/CoCoA-5/Makefile	2022-03-25 16:30:55.000000000 +0000
863
+++ CoCoALib-0.99800_patched/src/CoCoA-5/Makefile	2022-10-24 06:06:19.074135623 +0000
864
@@ -62,7 +62,7 @@
865
 
866
 CoCoAInterpreter: VersionInfo.o  CompilationDate.o  $(COCOA_LIB)
867
 	@echo "CoCoAInterpreter: linking everything together"
868
-	$(COMPILE5) $(OBJS) CompilationDate.o -o CoCoAInterpreter $(LDLIBS)  $(COCOA5_LDLIBS)  -lpthread
869
+	$(COMPILE5) $(OBJS) CompilationDate.o -o CoCoAInterpreter $(LDLIBS)  $(COCOA5_LDLIBS)  $(L_BOOST_LIB_DIR)  -lpthread
870
 	@#Next lines remove the *.dSYM directory which the Apple compiler creates
871
 	@#but we remove it only if the compilation flag "-g" is absent.
872
 	@AppleDir=CoCoAInterpreter.dSYM ; \
873
@@ -112,8 +112,8 @@
874
 	@echo "-----------------------------------"
875
 	@echo ">>>>  Making the CoCoA Qt GUI  <<<<"
876
 	@echo "-----------------------------------"
877
-	@echo "[[Qt-GUI: 1/3]]  Building QCodeEdit";  cd QCodeEdit;  $(MAKE)  -s
878
-	@echo "[[Qt-GUI: 2/3]]  Buiding GUI"; $(MAKE) -s -f C5Makefile
879
+	@echo "[[Qt-GUI: 1/3]]  Building QCodeEdit";  cd QCodeEdit;  CXX=$(CXX) $(MAKE) -s
880
+	@echo "[[Qt-GUI: 2/3]]  Buiding GUI"; CXX=$(CXX) $(MAKE) -s -f C5Makefile
881
 	@echo "[[Qt-GUI: 3/3]]  Finishing GUI"; ./make-gui-finish.sh
882
 	@echo
883
 	@echo "---------------------------------------------------------"
884
@@ -122,11 +122,11 @@
885
 
886
 QCodeEdit/Makefile: $(COCOA_LIB)  QCodeEdit/QCodeEdit.pro.in  make-qcodeeditmakefile.sh
887
 	if [ -f QCodeEdit/Makefile ]; then cd QCodeEdit; $(MAKE) -s clean; fi
888
-	./make-qcodeeditmakefile.sh
889
+	QMAKE=$(QMAKE) ./make-qcodeeditmakefile.sh
890
 
891
 C5Makefile: $(COCOA_LIB)  C5.pro.in  make-c5makefile.sh
892
 	if [ -f C5Makefile ]; then $(MAKE) -s -f C5Makefile distclean; fi
893
-	./make-c5makefile.sh  $(CXXFLAGS_DEFINES)  $(COCOA5_VERSION_DEFINES)  $(LDLIBS)  $(COCOA5_LDLIBS)
894
+	QMAKE=$(QMAKE) ./make-c5makefile.sh $(CXXFLAGS_DEFINES) $(COCOA5_VERSION_DEFINES) $(LDLIBS) $(COCOA5_LDLIBS)
895
 
896
 .PHONY: check
897
 check: cocoa5
898
@@ -193,7 +193,7 @@
899
 
900
 .PHONY: doc
901
 doc:
902
-	@(cd $(COCOA5_DOC_DIR); make)
903
+	@(cd $(COCOA5_DOC_DIR); $(MAKE))
904
 
905
 # .PHONY: htmldoc
906
 # htmldoc:
907
diff -Naur CoCoALib-0.99800_gui/src/CoCoA-5/make-c5makefile.sh CoCoALib-0.99800_patched/src/CoCoA-5/make-c5makefile.sh
908
--- CoCoALib-0.99800_gui/src/CoCoA-5/make-c5makefile.sh	2016-03-09 10:18:29.000000000 +0000
909
+++ CoCoALib-0.99800_patched/src/CoCoA-5/make-c5makefile.sh	2022-10-24 06:06:19.074135623 +0000
910
@@ -2,7 +2,7 @@
911
 
912
 # This script builds the CoCoA-5 GUI; it assumes that CoCoALib
913
 # has already been built, and that the Qt libraries have been installed
914
-# (and that the qmake command is available).
915
+# (and that the $QMAKE command is available).
916
 
917
 # if [ $# -ne 5 ]
918
 # then
919
@@ -10,12 +10,17 @@
920
 #   exit 1
921
 # fi
922
 
923
+##################################################################
924
+# Check $QMAKE
925
 
926
-which qmake >/dev/null
927
-if [ $? -ne 0 ]
928
-then
929
-  echo "ERROR: $0 failed because it cannot find qmake" >/dev/stderr
930
-  exit 1
931
+if [ -z "$QMAKE" ]; then
932
+  echo "ERROR: QMAKE not set" > /dev/stderr
933
+  exit 2
934
+fi
935
+
936
+if [ ! -r "$QMAKE" -o ! -x "$QMAKE" ]; then
937
+  echo "ERROR: $QMAKE not executable" > /dev/stderr
938
+  exit 3
939
 fi
940
 
941
 ##################################################################
942
@@ -104,9 +109,9 @@
943
 then
944
   DARWIN_OPTS="-spec macx-g++"
945
 fi
946
-qmake $DARWIN_OPTS C5.pro -o C5Makefile
947
+"$QMAKE" $DARWIN_OPTS C5.pro -o C5Makefile
948
 if [ "$?" -ne 0 ]
949
 then
950
-  echo "ERROR: $0 failed because qmake failed for C5.pro"  >/dev/stderr
951
+  echo "ERROR: $0 failed because $QMAKE failed for C5.pro" > /dev/stderr
952
   exit 6
953
 fi
954
diff -Naur CoCoALib-0.99800_gui/src/CoCoA-5/make-qcodeeditmakefile.sh CoCoALib-0.99800_patched/src/CoCoA-5/make-qcodeeditmakefile.sh
955
--- CoCoALib-0.99800_gui/src/CoCoA-5/make-qcodeeditmakefile.sh	2014-03-07 14:18:27.000000000 +0000
956
+++ CoCoALib-0.99800_patched/src/CoCoA-5/make-qcodeeditmakefile.sh	2022-10-24 06:06:19.074135623 +0000
957
@@ -2,7 +2,7 @@
958
 
959
 # This script builds the CoCoA-5 GUI; it assumes that CoCoALib
960
 # has already been built, and that the Qt libraries have been installed
961
-# (and that the qmake command is available).
962
+# (and that the $QMAKE command is available).
963
 
964
 if [ $# -ne 0 ]
965
 then
966
@@ -11,13 +11,16 @@
967
 fi
968
 
969
 ##################################################################
970
-# Check for qmake program
971
+# Check $QMAKE
972
 
973
-which qmake >/dev/null
974
-if [ $? -ne 0 ]
975
-then
976
-  echo "ERROR: $0 failed because it cannot find qmake" >/dev/stderr
977
-  exit 1
978
+if [ -z "$QMAKE" ]; then
979
+  echo "ERROR: QMAKE not set" > /dev/stderr
980
+  exit 2
981
+fi
982
+
983
+if [ ! -r "$QMAKE" -o ! -x "$QMAKE" ]; then
984
+  echo "ERROR: $QMAKE not executable" > /dev/stderr
985
+  exit 3
986
 fi
987
 
988
 ##################################################################
989
@@ -27,7 +30,7 @@
990
 if [ \! -d "$QCE" ]
991
 then
992
   echo "ERROR: $0 cannot find subdirectory $QCE/"
993
-  exit 2
994
+  exit 4
995
 fi
996
 
997
 
998
@@ -83,9 +86,9 @@
999
   DARWIN="-spec macx-g++"
1000
 fi
1001
 cd $QCE
1002
-qmake $DARWIN QCodeEdit.pro
1003
+"$QMAKE" $DARWIN QCodeEdit.pro
1004
 if [ "$?" -ne 0 ]
1005
 then
1006
-  echo "ERROR: $0 failed because qmake failed for QCodeEdit"  >/dev/stderr
1007
-  exit 4
1008
+  echo "ERROR: $0 failed because $QMAKE failed for QCodeEdit" > /dev/stderr
1009
+  exit 5
1010
 fi
1011
diff -Naur CoCoALib-0.99800_gui/src/CoCoA-5/tests/Makefile CoCoALib-0.99800_patched/src/CoCoA-5/tests/Makefile
1012
--- CoCoALib-0.99800_gui/src/CoCoA-5/tests/Makefile	2022-03-25 16:31:02.000000000 +0000
1013
+++ CoCoALib-0.99800_patched/src/CoCoA-5/tests/Makefile	2022-10-24 06:06:19.074135623 +0000
1014
@@ -59,7 +59,7 @@
1015
 # directory.  Most of the work is done by the RunTests.sh script.
1016
 .PHONY: check
1017
 check: ../CoCoAInterpreter
1018
-	@./RunTests.sh $(TESTS) 2> /dev/null  # discard err mesgs from the shell script
1019
+	@./RunTests.sh $(TESTS)
1020
 
1021
 .PHONY: clean clean-local
1022
 clean: clean-local
1023
diff -Naur CoCoALib-0.99800_gui/src/CoCoA-5/tests/RunTests.sh CoCoALib-0.99800_patched/src/CoCoA-5/tests/RunTests.sh
1024
--- CoCoALib-0.99800_gui/src/CoCoA-5/tests/RunTests.sh	2022-03-25 16:31:02.000000000 +0000
1025
+++ CoCoALib-0.99800_patched/src/CoCoA-5/tests/RunTests.sh	2022-10-24 06:06:19.074135623 +0000
1026
@@ -30,9 +30,17 @@
1027
 fi
1028
 
1029
 source ../../../configuration/shell-fns.sh
1030
-source ../../../configuration/autoconf.mk
1031
+#source ../../../configuration/autoconf.mk
1032
 
1033
-NUM_TESTS=$#-CoCoA-5
1034
+unset progs
1035
+for arg in "$@"; do
1036
+  prog=$(basename "$arg" .cocoa5)
1037
+  HAVE_EXTLIB=HAVE_"${prog:6:100}"
1038
+  if [ "ExtLib" != "${prog:0:6}" ] || [ "${!HAVE_EXTLIB}" = yes ]; then
1039
+    progs=("${progs[@]}" "$arg")
1040
+  fi
1041
+done
1042
+NUM_TESTS=${#progs[@]}-CoCoA-5
1043
 
1044
 # Before running the tests check that empty input does not trigger an error (e.g. package error)
1045
 ../CoCoAInterpreter --no-readline --no-preamble --packageDir ../packages /dev/null > NULL.found 2> NULL.cerr
1046
@@ -54,24 +62,19 @@
1047
 /bin/rm  NULL.found  NULL.cerr
1048
 
1049
 echo
1050
-echounderline "Running the CoCoA-5 tests ($# tests altogether)"
1051
+echounderline "Running the CoCoA-5 tests (${#progs[@]} tests altogether)"
1052
 
1053
 # Keep track of which tests failed, to print a summary at the end.
1054
 failures=""
1055
 
1056
-# This loop iterates through the names supplied as arguments to the script.
1057
+# This loop iterates through the names of tests to run.
1058
 COUNTER=0
1059
-while [ $# -ne 0 ]
1060
-do
1061
+for p in "${progs[@]}"; do
1062
   COUNTER=`expr 1 + $COUNTER`
1063
-  prog=`basename "$1" .cocoa5`
1064
-  if [ $? -ne 0 -o ! -f "$1" ] ; then echo "!!!!! Bad test source file \`$1' !!!!!"; exit 1; fi
1065
-  shift
1066
+  prog=`basename "$p" .cocoa5`
1067
+  if [ $? -ne 0 -o ! -f "$p" ] ; then echo "!!!!! Bad test source file \`$p' !!!!!"; exit 1; fi
1068
   /bin/rm -f $prog.found $prog.cerr
1069
-  HAVE_EXTLIB=HAVE_${prog:6:100};
1070
-  if [ "ExtLib" != "${prog:0:6}" ] || [ ${!HAVE_EXTLIB} = yes ]
1071
-  then
1072
-    ../CoCoAInterpreter --no-readline --no-preamble --packageDir ../packages $prog.cocoa5 > $prog.found 2> $prog.cerr
1073
+  ../CoCoAInterpreter --no-readline --no-preamble --packageDir ../packages $prog.cocoa5 > $prog.found 2> $prog.cerr
1074
   if [ $? -ne 0 ]
1075
   then
1076
     echo "[$COUNTER/$NUM_TESTS] *****  $prog FAILED  ***** (non-zero exit status)"
1077
@@ -103,7 +106,6 @@
1078
         echo "[$COUNTER/$NUM_TESTS] $prog.cocoa5 ..... OK"
1079
       fi
1080
     fi
1081
-    fi
1082
   fi
1083
 done
1084
 if [ -z "$failures" ]
1085
EOFBUILDPATCH
1086
printf '%s\n' "done"
1087

    
1088
# Delete configuration/fpic-ldflag.sh (empty and unused after the patch):
1089
rm -f "$COCOALIB_VER2_DIR/configuration/fpic-ldflag.sh"
1090
# Set execute permissions on newly created file:
1091
chmod 755 "$COCOALIB_VER2_DIR/configuration/qt5-check.sh"
1092

    
1093
# Clean up:
1094
printf '%s' "Cleaning up... "
1095
rm -r "$COCOALIB_VER1_DIR"
1096
mv "$COCOALIB_VER2_DIR" "$COCOALIB_PATCHED_DIR"
1097
printf '%s\n' "done"
1098

    
1099
printf '\n%s\n' "Qt5 GUI and build scripts patching finished"