Debian Codegraph @

tools/build-tool/castle-engine_compile.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 set -euo pipefail
3 # See http://redsymbol.net/articles/unofficial-bash-strict-mode/
4
5 # ----------------------------------------------------------------------------
6 # Compile the Castle Game Engine build tool
7 # ("castle-engine" binary, "castle-engine.exe" on Windows).
8 # See https://castle-engine.io/build_tool .
9 #
10 # Call this script from its directory, like this:
11 #
12 # cd castle_game_engine/tools/build-tool/
13 # ./castle-engine_compile.sh
14 #
15 # Or call it from the main castle_game_engine/ directory like this:
16 #
17 # ./tools/build-tool/castle-engine_compile.sh
18 #
19 # You can also do "make tools" or "make examples" in the main
20 # castle_game_engine/ directory. They compile build tool along the way.
21 #
22 # Note: Once you have compiled the build tool and placed it on $PATH,
23 # you can later compile build tool by itself calling in this directory:
24 #
25 # castle-engine compile
26 #
27 # This way build tool will compile itself (bootstrap).
28 # ----------------------------------------------------------------------------
29 #
30
31 # Allow calling this script from it's dir.
32 if [ -f castle_engine.dpr ]; then cd ../../; fi
33
34 mkdir -p tools/build-tool/castle-engine-output/build-tool-compilation
35
36 COMPILE_OPTIONS='-dRELEASE
37 -dCASTLE_STRICT_CLI
38 @castle-fpc.cfg
39 -FEtools/build-tool/
40 -FUtools/build-tool/castle-engine-output/build-tool-compilation
41 -Futools/common-code/
42 -Futools/build-tool/code/
43 -Futools/build-tool/embedded_images/'
44
45 if ! fpc ${COMPILE_OPTIONS} ${CASTLE_FPC_OPTIONS:-} tools/build-tool/castle_engine.dpr | tee tools/build-tool/castle-engine-output/build-tool-compilation/output.txt; then
46 if grep -F 'Fatal: Internal error' tools/build-tool/castle-engine-output/build-tool-compilation/output.txt; then
47 echo '-------------------------------------------------------------'
48 echo 'It seems FPC crashed. If you can reproduce this problem, please report it to http://bugs.freepascal.org/ ! We want to help FPC developers to fix this problem, and the only way to do it is to report it. If you need help creating a good bugreport, speak up on the FPC mailing list or Castle Game Engine forum.'
49 echo
50 echo "As a workaround, right now we'll clean everything and try compiling again."
51 echo '-------------------------------------------------------------'
52 rm -Rf tools/build-tool/castle-engine-output/build-tool-compilation/*
53 fpc ${COMPILE_OPTIONS} ${CASTLE_FPC_OPTIONS:-} tools/build-tool/castle_engine.dpr
54 else
55 exit 1
56 fi
57 fi
58
59 # Make final exe name with -, not _
60 if [ -f tools/build-tool/castle_engine.exe ]; then
61 mv -f tools/build-tool/castle_engine.exe tools/build-tool/castle-engine.exe
62 fi
63 if [ -f tools/build-tool/castle_engine ]; then
64 mv -f tools/build-tool/castle_engine tools/build-tool/castle-engine
65 fi