Compare commits

...

4 Commits

Author SHA1 Message Date
Guy Shimko
ecd1367c6d build: Add -j to make install to speed compilation 2025-04-02 00:07:26 +03:00
Guy Shimko
e899d51568 fixup! build: install musl toolchains in the dockerfile 2025-04-01 23:59:55 +03:00
Guy Shimko
01e60acff0 build: Use musl-based compiler by default 2025-04-01 22:03:11 +03:00
Guy Shimko
24491576ef build: install musl toolchains in the dockerfile 2025-03-29 12:52:32 +03:00
4 changed files with 53 additions and 14 deletions

View File

@ -30,4 +30,9 @@ RUN apt update && apt install -y \
wget \
xz-utils
# Install musl-based toolchains.
ENV MUSL_INSTALL_DIR="/usr/"
COPY src/compilation/install_musl_toolchains.sh .
RUN ./install_musl_toolchains.sh
WORKDIR /app/gdb

View File

@ -59,7 +59,7 @@ $(PYTHON_TARGETS): build-with-python-%:
_build-%: symlink-git-packages download-packages build-docker-image
mkdir -p build
docker run --user $(shell id -u):$(shell id -g) \
docker run -it --user $(shell id -u):$(shell id -g) \
--rm --volume .:/app/gdb gdb-static env TERM=xterm-256color \
/app/gdb/src/compilation/build.sh $* /app/gdb/build/ /app/gdb/src $(WITH_PYTHON)

View File

@ -28,23 +28,23 @@ function set_compliation_variables() {
>&2 fancy_title "Setting compilation variables for $target_arch"
if [[ "$target_arch" == "arm" ]]; then
CROSS=arm-linux-gnueabi-
export HOST=arm-linux-gnueabi
CROSS=arm-linux-musleabi-
export HOST=arm-linux-musleabi
elif [[ "$target_arch" == "aarch64" ]]; then
CROSS=aarch64-linux-gnu-
export HOST=aarch64-linux-gnu
CROSS=aarch64-linux-musl-
export HOST=aarch64-linux-musl
elif [[ "$target_arch" == "powerpc" ]]; then
CROSS=powerpc-linux-gnu-
export HOST=powerpc-linux-gnu
CROSS=powerpc-linux-musl-
export HOST=powerpc-linux-musl
elif [[ "$target_arch" == "mips" ]]; then
CROSS=mips-linux-gnu-
export HOST=mips-linux-gnu
CROSS=mips-linux-musl-
export HOST=mips-linux-musl
elif [[ "$target_arch" == "mipsel" ]]; then
CROSS=mipsel-linux-gnu-
export HOST=mipsel-linux-gnu
CROSS=mipsel-linux-musl-
export HOST=mipsel-linux-musl
elif [[ "$target_arch" == "x86_64" ]]; then
CROSS=x86_64-linux-gnu-
export HOST=x86_64-linux-gnu
CROSS=x86_64-linux-musl-
export HOST=x86_64-linux-musl
fi
export CC="${CROSS}gcc"
@ -497,7 +497,7 @@ function install_gdb() {
mkdir -p "$artifacts_location"
make -C "$gdb_build_dir" install "DESTDIR=$temp_artifacts_dir" 1>&2
make -j$(nproc) -C "$gdb_build_dir" install "DESTDIR=$temp_artifacts_dir" 1>&2
if [[ $? -ne 0 ]]; then
rm -rf "$temp_artifacts_dir"
return 1

View File

@ -0,0 +1,34 @@
#!/bin/bash
set -e
# Define architectures and their respective musl toolchain URLs.
ARCHS=("x86_64" "arm" "aarch64" "powerpc" "mips" "mipsel")
BASE_URL="https://musl.cc"
if [[ -z "$MUSL_INSTALL_DIR" ]]; then
echo "MUSL_INSTALL_DIR variable has not been set!"
exit 1
fi
# Create install directory.
mkdir -p "$MUSL_INSTALL_DIR"
cd "$MUSL_INSTALL_DIR"
# Download and extract each toolchain.
for ARCH in "${ARCHS[@]}"; do
TOOLCHAIN_TAR="${ARCH}-linux-musl-cross.tgz"
# Arm has a non-generic special toolchain name :(.
if [[ "$ARCH" == "arm" ]]; then
TOOLCHAIN_TAR="arm-linux-musleabi-cross.tgz"
fi
URL="$BASE_URL/$TOOLCHAIN_TAR"
echo "Downloading $URL..."
wget -q --show-progress "$URL"
echo "Extracting $TOOLCHAIN_TAR..."
tar -xzf "$TOOLCHAIN_TAR" --strip-components=1
rm "$TOOLCHAIN_TAR"
done