emerald-post-gcc-build: Fix static linking

Previously, building with cargo was fixed, but static linking was broken

Signed-off-by: PeroSar <perosar1111@gmail.com>
This commit is contained in:
PeroSar 2022-05-08 18:28:41 +05:30
parent f04103c117
commit b194ea6e98
Signed by: PeroSar
GPG Key ID: 5C2D258445DA8B58
1 changed files with 7 additions and 1 deletions

View File

@ -5,11 +5,17 @@ set -euo pipefail
EMERALD_SCRIPT_DIR=$(dirname "$(realpath "$0")")
GCC_VER=$(grep -P -m1 '^GCC_VER=' emerald-gcc.sh | cut -d= -f2)
source "$EMERALD_SCRIPT_DIR"/common.sh
AR=$PREFIX/$TARGET/bin/ar
cd "$PREFIX"
# Fix rust builds
echo "INPUT(-lgcc_eh)" > lib/gcc/aarch64-linux-android/"$GCC_VER"/libgcc.a
(
cd lib/gcc/aarch64-linux-android/"$GCC_VER"/
LIBGCC_FILENAME=libgcc_$(base64 <<< $RANDOM$RANDOM | sed 's|=||g').a
mv libgcc.a "$LIBGCC_FILENAME"
$AR crsT libgcc.a "$LIBGCC_FILENAME" libgcc_eh.a
)
# Install helper scripts
install -Dm755 -t bin "$EMERALD_SCRIPT_DIR"/bin/*