Docker-Ify

This commit is contained in:
TheBrokenRail 2025-03-20 03:27:44 -04:00
parent ea522c03bf
commit 0cbcc6ba5e
7 changed files with 69 additions and 21 deletions

1
.dockerignore Symbolic link
View File

@ -0,0 +1 @@
.gitignore

1
.gitignore vendored
View File

@ -1 +1,2 @@
/workspace
/out

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM buildpack-deps:bullseye
# Install Dependencies
RUN \
apt-get update && \
apt-get install -y \
build-essential \
g++-aarch64-linux-gnu \
flex \
texinfo \
help2man \
gawk \
libtool-bin \
bison && \
rm -rf /var/lib/apt/lists/*
# Copy Files
COPY . /data
# Prepare
RUN /data/scripts/prepare.sh
CMD ["/data/scripts/build.sh"]

View File

@ -1,12 +0,0 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
# Build
cd workspace/build
for type in */; do
cd "${type}"
../../crosstool-ng/bin/ct-ng build
cd ../
done

20
run.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
# Build Image
TAG='arm-toolchain-build'
docker buildx build --tag "${TAG}" .
# Run
rm -rf out
mkdir out
docker run \
--rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd)/out:/data/out" \
"${TAG}"
# Clean Up
docker image rm "${TAG}"

18
scripts/build.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
set -e
cd "$(dirname "$0")/../"
# Store Output
OUT="$(pwd)/out"
mkdir -p "${OUT}"
# Build
cd workspace/build
for type in *; do
cd "${type}"
../../crosstool-ng/ct-ng build
# Compress
tar -cJf "${out}/arm-toolchain-${type}.tar.xz" out
cd ../
done

View File

@ -1,7 +1,7 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
cd "$(dirname "$0")/../"
# Check
if [ "$(uname -m)" != 'x86_64' ]; then
@ -10,8 +10,8 @@ if [ "$(uname -m)" != 'x86_64' ]; then
fi
# Versions
CT_NAME="crosstool-ng"
CT_VERSION="1.27.0"
CT_NAME='crosstool-ng'
CT_VERSION='1.27.0'
CT="${CT_NAME}-${CT_VERSION}"
# Source Files
@ -28,19 +28,16 @@ WORKSPACE="$(pwd)"
# Build crosstools-ng
dir "${CT_NAME}"
PREFIX="$(pwd)"
dir src
wget "https://github.com/${CT_NAME}/${CT_NAME}/releases/download/${CT}/${CT}.tar.xz"
tar -xJf "${CT}.tar.xz" --strip-components=1
./configure \
"--prefix=${PREFIX}" \
--enable-local \
--enable-silent-rules \
--quiet
make -j$(nproc)
make install > /dev/null
# Add Patch
cd "${PREFIX}/share/crosstool-ng/packages/binutils"
cd packages/binutils
patch() {
for version in */; do
cp "${SRC}/$1" "${version}"
@ -49,8 +46,8 @@ patch() {
patch 9999-change-page-size.patch
# Configure Toolchain
export PATH="${PREFIX}/bin:${PATH}"
cd "${WORKSPACE}"
export PATH="$(pwd)/${CT_NAME}:${PATH}"
dir build
prepare() {
dir "$1"
@ -58,6 +55,7 @@ prepare() {
printf "$2" >> defconfig
ct-ng defconfig
ct-ng show-config
chmod -R o+rw .
cd ../
}
prepare x86_64 ''