This commit is contained in:
Your Name 2025-04-29 20:50:10 +12:00
parent 422e75c5d4
commit c1f961b96b
4 changed files with 67 additions and 5 deletions

26
packages/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM ubuntu:22.04
# Set up architectures first
RUN dpkg --add-architecture arm64 && \
sed -i 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list
# Install build dependencies for both architectures
RUN apt-get update && \
apt-get install -y \
cmake \
make \
g++ \
musl-tools \
g++-aarch64-linux-gnu \
crossbuild-essential-arm64 \
libtbb-dev \
libxxhash-dev \
libtbb-dev:arm64 \
libxxhash-dev:arm64 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src

View File

@ -1,6 +1,42 @@
# This script uses debian docker containers (not the host!) to do the following: # This script uses a pre-built docker container to build two executables:
# 1. builds two executables from ../CMakeLists.txt (a C++ project) # 1. dropshell-x86_64, using musl and static linking
# a) dropshell-x86_64, using musl and static linking # 2. dropshell-arm64, using musl and static linking
# b) dropshell-arm64, using musl and static linking
# the executables are copied to ./output, with the ownership changed to current user. # The executables are copied to ./output, with the ownership changed to current user.
#!/bin/bash
set -e
# Create output directory if it doesn't exist
mkdir -p output
# Build Docker image if it doesn't exist
if ! docker image inspect dropshell-builder:latest >/dev/null 2>&1; then
echo "Building builder image..."
docker build -t dropshell-builder:latest .
fi
# Build x86_64 executable
docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c '
rm -rf build && \
mkdir -p build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make && \
cp dropshell ../packages/output/dropshell-x86_64
'
# Build arm64 executable
docker run --rm -v "$(pwd)/..:/src" dropshell-builder:latest bash -c '
rm -rf build && \
mkdir -p build && \
cd build && \
cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
-DCMAKE_BUILD_TYPE=Release .. && \
make && \
cp dropshell ../packages/output/dropshell-arm64
'
# Change ownership to current user
chown $(id -u):$(id -g) output/dropshell-*

BIN
packages/output/dropshell-arm64 Executable file

Binary file not shown.

BIN
packages/output/dropshell-x86_64 Executable file

Binary file not shown.