@@ -7,8 +7,11 @@ DEBUG=$1 # Value is '' or 'debug'
77RUNNER_OS=$2 # ${{ runner.os }} is Linux, Windiws, maxOS
88TAG=$3 # For master it's 24.0.999, while for tag it's the tag itself
99NO_REBASE=$4 # Specify this to skip the rebase over the edge branch. Used for local debugging.
10+ CROSS=$5 # '' for native, aarch64 for ARM cross
1011
1112prefix=/tmp/ADALIB_DIR
13+ TARGET=${CROSS: +$CROSS -linux} # '' or aarch64-linux
14+ TARGET_OPTION=${TARGET: +--target=$TARGET } # '' or --target=aarch64-linux
1215
1316export CPATH=/usr/local/include
1417export LIBRARY_PATH=/usr/local/lib
@@ -24,6 +27,7 @@ if [ $RUNNER_OS = Windows ]; then
2427fi
2528
2629export GPR_PROJECT_PATH=$prefix /share/gpr:\
30+ $prefix /$TARGET /share/gpr:\
2731$PWD /subprojects/VSS/gnat:\
2832$PWD /subprojects/gnatdoc/gnat:\
2933$PWD /subprojects/lal-refactor/gnat:\
5256
5357# Get libadalang binaries
5458mkdir -p $prefix
55- FILE=libadalang-$RUNNER_OS -$BRANCH ${DEBUG: +-dbg} -static.tar.gz
59+ FILE=libadalang-$RUNNER_OS -$BRANCH ${CROSS : +- $CROSS }${ DEBUG: +-dbg} -static.tar.gz
5660# If the script is run locally for debugging, it is not always possible
5761# to download libadalang from AWS S3. Instead, allow for the file to
5862# be obtained otherwise and placed in the current directory for the script
8286# Log info about the compiler and library paths
8387gnatls -v
8488
89+ # Get architecture and platform information from node.
90+ NODE_PLATFORM=$( node -e " console.log(process.platform)" )
91+
92+ if [ " $CROSS " = " aarch64" ]; then
93+ NODE_ARCH=arm64
94+ else
95+ NODE_ARCH=$( node -e " console.log(process.arch)" )
96+ fi
97+
8598make -C subprojects/templates-parser setup prefix=$prefix \
86- ENABLE_SHARED=no \
99+ ENABLE_SHARED=no ${TARGET : +TARGET= $TARGET } \
87100 ${DEBUG: +BUILD=debug} build-static install-static
88101
89- make LIBRARY_TYPE=static VERSION=$TAG all check
102+ make LIBRARY_TYPE=static VERSION=$TAG all GPRBUILD_EXTRA=$TARGET_OPTION NODE_ARCH=$NODE_ARCH
103+ [ -z " $CROSS " ] && make LIBRARY_TYPE=static check
104+
90105
91106function fix_rpath ()
92107{
@@ -97,9 +112,6 @@ function fix_rpath ()
97112 install_name_tool -add_rpath @executable_path $1
98113}
99114
100- # Get architecture and platform information from node.
101- NODE_ARCH=$( node -e " console.log(process.arch)" )
102- NODE_PLATFORM=$( node -e " console.log(process.platform)" )
103115ALS_EXEC_DIR=integration/vscode/ada/$NODE_ARCH /$NODE_PLATFORM
104116
105117if [ $RUNNER_OS = macOS ]; then
@@ -123,6 +135,10 @@ if [ "$DEBUG" != "debug" ]; then
123135 # system (or by XCode).
124136 dsymutil " $ALS "
125137 strip " $ALS "
138+ elif [ " $CROSS " = " aarch64" ]; then
139+ aarch64-linux-gnu-objcopy --only-keep-debug ${ALS} ${ALS} .debug
140+ aarch64-linux-gnu-objcopy --strip-all ${ALS}
141+ aarch64-linux-gnu-objcopy --add-gnu-debuglink=${ALS} .debug ${ALS}
126142 else
127143 objcopy --only-keep-debug ${ALS} ${ALS} .debug
128144 objcopy --strip-all ${ALS}
0 commit comments