16
16
# *******************************************************************************
17
17
18
18
HELP="
19
+ Build GTK4 or GTK3 bindings and (optionally) copy them to binary repository.
19
20
Paramaters (specified in this order):
20
21
clean - delete *.o and *.so files from current folder. If this is the only paramater, do nothing else.
21
22
But if other paramaters are given and this is the first one, then continue with other actions.
22
23
24
+ One of the following 3:
25
+ -gtk3 : Build bindings with GTK3.
26
+ -gtk4 : Build bindings with GTK4.
27
+ -gtk-all : Build bindings with GTK3 as well as GTK4. Note, this flag triggers cleanups before each build
28
+ because a cleanup is required when building different GTK versions for linking to be done correctly.
29
+ During active development, if you only want to compile updated files, use -gtk3/-gtk4 flags instead,
30
+ however do not forget to do a cleanup in between gtk3/gtk4.
31
+
23
32
install - copy *.so libraries to binary repository.
24
33
25
34
--print-outputdir-and-exit - This simply echos the OUTPUT folder where .so libs are copied to,
26
35
then exits the script. Used by external
27
36
28
37
-- Examples:
29
38
Most commonly used:
30
- ./build.sh install
31
- This will clean everything in your repository, build and then copy .so files to binary repository.
39
+ ./build.sh -gtk-all install
40
+ This will clean everything in your repository, build GTK3 and GTK4, then copy .so files to binary repository.
32
41
33
42
Also:
34
43
./build.sh - only build .so files, do not copy them across. Build according to what GTK_VERSION is set to.
35
44
./build.sh clean - clean working directory of *.o and *.so files.
36
- ./build.sh install - build.so files and copy to binary repository
45
+ ./build.sh -gtk4 install - build.so files and copy to binary repository
37
46
38
47
Also note:
39
48
Sometimes you might have to cleanup the binary repository manually as old *.so files are not automatically removed
@@ -283,7 +292,7 @@ if [ "x${1}" = "xclean" ]; then
283
292
shift
284
293
285
294
# if there are no more other parameters, exit.
286
- # don't exit if there are more paramaters. Useful for one-liners like: ./build.sh clean install
295
+ # don't exit if there are more paramaters. Useful for one-liners like: ./build.sh clean -gtk-all install
287
296
if [ " $1 " = " " ]; then
288
297
exit $?
289
298
fi
293
302
# Announce our target
294
303
func_echo_plus " Building SWT/GTK+ for Architectures: $SWT_OS $SWT_ARCH "
295
304
305
+ func_build_gtk4 () {
306
+ export GTK_VERSION=4.0
307
+
308
+ # Dictate Webkit2 Extension only if pkg-config flags exist
309
+ pkg-config --exists webkit2gtk-web-extension-4.0
310
+ if [ $? == 0 ]; then
311
+ export BUILD_WEBKIT2EXTENSION=" yes" ;
312
+ else
313
+ func_echo_error " Warning: Cannot compile Webkit2 Extension because 'pkg-config --exists webkit2gtk-web-extension-4-0' check failed. Please install webkitgtk4-devel.ARCH on your system."
314
+ fi
315
+
316
+ func_echo_plus " Building GTK4 bindings:"
317
+ ${MAKE_TYPE} -f $MAKEFILE all $MAKE_CAIRO $MAKE_AWT " ${@ } "
318
+ RETURN_VALUE=$? # make can return 1 or 2 if it fails. Thus need to cache it in case it's used programmatically somewhere.
319
+ if [ " $RETURN_VALUE " -eq 0 ]; then
320
+ func_echo_plus " GTK4 Build succeeded"
321
+ else
322
+ func_echo_error " GTK4 Build failed, aborting further actions.."
323
+ exit $RETURN_VALUE
324
+ fi
325
+ }
326
+
296
327
func_build_gtk3 () {
297
328
export GTK_VERSION=3.0
298
329
@@ -315,5 +346,22 @@ func_build_gtk3 () {
315
346
fi
316
347
}
317
348
318
- func_build_gtk3 " $@ "
319
-
349
+ if [ " $1 " = " -gtk-all" ]; then
350
+ shift
351
+ func_echo_plus " Note: When building multiple GTK versions, a cleanup is required (and automatically performed) between them."
352
+ func_clean_up
353
+ func_build_gtk4 " $@ "
354
+ func_clean_up
355
+ func_build_gtk3 " $@ "
356
+ elif [ " $1 " = " -gtk4" ]; then
357
+ shift
358
+ func_build_gtk4 " $@ "
359
+ elif [ " $1 " = " -gtk3" ]; then
360
+ shift
361
+ func_build_gtk3 " $@ "
362
+ elif [ " ${GTK_VERSION} " = " 4.0" ]; then
363
+ func_build_gtk4 " $@ "
364
+ elif [ " ${GTK_VERSION} " = " 3.0" -o " ${GTK_VERSION} " = " " ]; then
365
+ export GTK_VERSION=" 3.0"
366
+ func_build_gtk3 " $@ "
367
+ fi
0 commit comments