1
1
#! /bin/bash
2
+
3
+ # -x causes commands to be logged before invocation
4
+ # -e causes the execution to terminate as soon as any command fails
2
5
set -x -e
3
6
DEBUG=$1 # Value is '' or 'debug'
4
7
RUNNER_OS=$2 # ${{ runner.os }} is Linux, Windiws, maxOS
44
47
# Get libadalang binaries
45
48
mkdir -p $prefix
46
49
FILE=libadalang-$RUNNER_OS -$BRANCH ${DEBUG: +-dbg} -static.tar.gz
47
- aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/$FILE . --sse=AES256
48
- tar xzf $FILE -C $prefix
49
- rm -f -v $FILE
50
+ # If the script is run locally for debugging, it is not always possible
51
+ # to download libadalang from AWS S3. Instead, allow for the file to
52
+ # be obtained otherwise and placed in the current directory for the script
53
+ # to use. Thus, if the file is already there, we don't download it again
54
+ # and we don't delete it after use.
55
+ if [ ! -f " $FILE " ]; then
56
+ aws s3 cp s3://adacore-gha-tray-eu-west-1/libadalang/$FILE . --sse=AES256
57
+ tar xzf $FILE -C $prefix
58
+ rm -f -v $FILE
59
+ else
60
+ # Untar the existing file and don't delete it
61
+ tar xzf $FILE -C $prefix
62
+ fi
50
63
51
- which python
52
- pip install --user e3-testsuite
53
- python -c " import sys;print('e3' in sys.modules)"
64
+ which python3
65
+ which pip3
66
+ pip3 install --user e3-testsuite
67
+ python3 -c " import sys;print('e3' in sys.modules)"
54
68
55
69
if [ " $DEBUG " = " debug" ]; then
56
70
export BUILD_MODE=dev
57
71
else
58
72
export BUILD_MODE=prod
59
73
fi
60
74
75
+ # Log info about the compiler and library paths
76
+ gnatls -v
77
+
61
78
make -C subprojects/templates-parser setup prefix=$prefix \
62
79
ENABLE_SHARED=no \
63
80
${DEBUG: +BUILD=debug} build-static install-static
@@ -74,21 +91,27 @@ function fix_rpath ()
74
91
}
75
92
76
93
if [ $RUNNER_OS = macOS ]; then
77
- cp -v /usr/local/opt/gmp/lib/libgmp.10.dylib integration/vscode/ada/darwin/
94
+ cp -v -f /usr/local/opt/gmp/lib/libgmp.10.dylib integration/vscode/ada/darwin/
78
95
fix_rpath integration/vscode/ada/darwin/ada_language_server
79
96
fi
80
97
81
98
if [ " $DEBUG " != " debug" ]; then
82
- if [ $RUNNER_OS = macOS ]; then
83
- # Install binutils to have objcopy on Mac OS X
84
- brew install binutils
85
- export PATH=" /usr/local/opt/binutils/bin:$PATH "
86
- fi
87
99
ALS=` ls integration/vscode/ada/* /ada_language_server* `
88
- objcopy --only-keep-debug ${ALS} ${ALS} .debug
89
- objcopy --strip-all ${ALS}
90
100
cd ` dirname $ALS `
91
101
ALS=` basename ${ALS} `
92
- objcopy --add-gnu-debuglink=${ALS} .debug ${ALS}
102
+ if [ $RUNNER_OS = macOS ]; then
103
+ # On macOS using objcopy from binutils to strip debug symbols to a
104
+ # separate file doesn't work. Namely, the last step `objcopy
105
+ # --add-gnu-debuglink` yields an executable that crashes at startup.
106
+ #
107
+ # Instead we use dsymutil and strip which are commands provided by the
108
+ # system (or by XCode).
109
+ dsymutil " $ALS "
110
+ strip " $ALS "
111
+ else
112
+ objcopy --only-keep-debug ${ALS} ${ALS} .debug
113
+ objcopy --strip-all ${ALS}
114
+ objcopy --add-gnu-debuglink=${ALS} .debug ${ALS}
115
+ fi
93
116
cd -
94
117
fi
0 commit comments