archives/prepare.sh
TheBrokenRail 04eb9f8a18
Some checks failed
CI / Build (push) Failing after 20s
Setup CI
2025-03-20 15:21:58 -04:00

73 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -e
# Check
if [ "$(uname -m)" != 'x86_64' ]; then
echo 'Unsupported Build System!' > /dev/stderr
exit 1
fi
# Install Dependencies
apt-get update
apt-get install -y \
build-essential \
g++-aarch64-linux-gnu \
flex \
texinfo \
help2man \
gawk \
libtool-bin \
bison
# Versions
CT_NAME='crosstool-ng'
CT_VERSION='1.27.0'
CT="${CT_NAME}-${CT_VERSION}"
# Source Files
SRC="$(pwd)/src"
# Create Workspace
dir() {
rm -rf "$1"
mkdir "$1"
cd "$1"
}
dir workspace
WORKSPACE="$(pwd)"
# Build crosstools-ng
dir "${CT_NAME}"
wget "https://github.com/${CT_NAME}/${CT_NAME}/releases/download/${CT}/${CT}.tar.xz"
tar -xJf "${CT}.tar.xz" --strip-components=1
./configure \
--enable-local \
--enable-silent-rules \
--quiet
make -j$(nproc)
# Add Patch
cd packages/binutils
patch() {
for version in */; do
cp "${SRC}/$1" "${version}"
done
}
patch 9999-change-page-size.patch
# Configure Toolchain
cd "${WORKSPACE}"
export PATH="$(pwd)/${CT_NAME}:${PATH}"
dir build
prepare() {
dir "$1"
cp "${SRC}/defconfig" .
printf "$2" >> defconfig
ct-ng defconfig
ct-ng show-config
chmod -R o+rw .
cd ../
}
prepare x86_64 ''
prepare aarch64 'CT_CANADIAN=y\nCT_HOST="aarch64-linux-gnu"\n'