dropshell release 2025.0526.2221
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled

This commit is contained in:
Your Name 2025-05-26 22:21:39 +12:00
parent 4035538ba5
commit 3dc82c682c
6 changed files with 73 additions and 49 deletions

View File

@ -8,9 +8,9 @@ set -e
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
BIN=dropshell.amd64
BIN=dropshell.x86_64
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
BIN=dropshell.arm64
BIN=dropshell.aarch64
else
echo "Unsupported architecture: $ARCH" >&2
exit 1

View File

@ -17,6 +17,14 @@ RUN apk add --no-cache \
ninja \
linux-headers
# Install cross-compilation tools for ARM64
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
apk add --no-cache \
crossbuild-essential-arm64 \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu; \
fi
# Set working directory
WORKDIR /build
@ -26,13 +34,29 @@ COPY . .
# Configure and build
RUN mkdir -p build_static
# Set up cross-compilation environment for ARM64
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
export CC=aarch64-linux-gnu-gcc \
export CXX=aarch64-linux-gnu-g++ \
export CMAKE_TOOLCHAIN_FILE=/build/toolchain.cmake; \
fi
# Create toolchain file for ARM64
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
echo "set(CMAKE_SYSTEM_NAME Linux)" > toolchain.cmake && \
echo "set(CMAKE_SYSTEM_PROCESSOR aarch64)" >> toolchain.cmake && \
echo "set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)" >> toolchain.cmake && \
echo "set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)" >> toolchain.cmake && \
echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> toolchain.cmake && \
echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> toolchain.cmake && \
echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> toolchain.cmake; \
fi
RUN cmake -G Ninja -B build_static -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_EXE_LINKER_FLAGS="-static" \
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_SYSTEM_PROCESSOR=${TARGETPLATFORM#linux/}
${CMAKE_TOOLCHAIN_FILE:+-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE}
RUN cmake --build build_static

View File

@ -1,35 +0,0 @@
#!/bin/bash
# Create output directory
mkdir -p output
# Create and use a new builder instance
docker buildx create --name multiarch-builder --use || true
# Build for amd64
docker buildx build --platform linux/amd64 \
--build-arg TARGETPLATFORM=linux/amd64 \
--build-arg BUILDPLATFORM=linux/amd64 \
--tag dropshell-static-builder \
--output type=local,dest=./output/amd64 \
--target dropshell \
.
# Build for arm64
docker buildx build --platform linux/arm64 \
--build-arg TARGETPLATFORM=linux/arm64 \
--build-arg BUILDPLATFORM=linux/amd64 \
--tag dropshell-static-builder \
--output type=local,dest=./output/arm64 \
--target dropshell \
.
# Move the binaries to the output directory with architecture-specific names
cp output/amd64/dropshell output/dropshell.amd64
cp output/arm64/dropshell output/dropshell.arm64
# Clean up intermediate directories
rm -rf output/amd64 output/arm64
echo "Static binaries have been created:"
ls -la output

View File

@ -41,7 +41,7 @@ print_status "Detected OS: $OS $VER"
case $OS in
"Ubuntu"|"Debian GNU/Linux")
# Common packages for both Ubuntu and Debian
PACKAGES="cmake make g++ devscripts debhelper"
PACKAGES="cmake make g++ devscripts debhelper build-essential upx"
;;
*)
print_error "Unsupported distribution: $OS"

33
source/multibuild.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Create output directory
mkdir -p output
function build_arch() {
local arch=$1
if [ ! -f "${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-c++" ]; then
echo "Musl cross compiler for ${arch} not found. Please run install_build_prerequisites.sh first."
exit 1
fi
CMAKE_BUILD_TYPE=Release
CC="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-gcc"
CXX="${HOME}/.musl-cross/${arch}-linux-musl-cross/bin/${arch}-linux-musl-g++"
BUILDDIR=build/${arch}
mkdir -p ${BUILDDIR}
cmake -B ${BUILDDIR} -G Ninja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX}
cmake --build ${BUILDDIR}
upx ${BUILDDIR}/dropshell
cp ${BUILDDIR}/dropshell output/dropshell.${arch}
}
build_arch x86_64
build_arch aarch64
echo "Static binaries have been created:"
ls -la output

View File

@ -8,10 +8,12 @@ echo "Script directory: $SCRIPT_DIR"
# Check for GITEA_TOKEN_DEPLOY or GITEA_TOKEN
if [ -n "$GITEA_TOKEN_DEPLOY" ]; then
TOKEN="$GITEA_TOKEN_DEPLOY"
echo "Using GITEA_TOKEN_DEPLOY"
elif [ -n "$GITEA_TOKEN" ]; then
TOKEN="$GITEA_TOKEN"
echo "Using GITEA_TOKEN"
else
echo "GITEA_TOKEN_DEPLOY or GITEA_TOKEN environment variable not set!" >&2
echo "Neither GITEA_TOKEN_DEPLOY nor GITEA_TOKEN environment variable set!" >&2
exit 1
fi
@ -22,20 +24,20 @@ OLD_PWD=$PWD
cd $SCRIPT_DIR
if [ ! -f "output/dropshell.amd64" ]; then
echo "output/dropshell.amd64 not found!" >&2
if [ ! -f "output/dropshell.x86_64" ]; then
echo "output/dropshell.x86_64 not found!" >&2
echo "Please run multibuild.sh first." >&2
exit 1
fi
if [ ! -f "output/dropshell.arm64" ]; then
echo "output/dropshell.arm64 not found!" >&2
if [ ! -f "output/dropshell.aarch64" ]; then
echo "output/dropshell.aarch64 not found!" >&2
echo "Please run multibuild.sh first." >&2
exit 1
fi
TAG=$("$SCRIPT_DIR/output/dropshell.amd64" --version)
[ -z "$TAG" ] && echo "Failed to get version from dropshell.amd64" >&2 && exit 1
TAG=$("$SCRIPT_DIR/output/dropshell.x86_64" --version)
[ -z "$TAG" ] && echo "Failed to get version from dropshell.x86_64" >&2 && exit 1
echo "Publishing dropshell version $TAG"
@ -81,7 +83,7 @@ if [ -z "$RELEASE_ID" ]; then
fi
# Upload binaries and install.sh
for FILE in dropshell.amd64 dropshell.arm64 install.sh server_autosetup.sh; do
for FILE in dropshell.x86_64 dropshell.aarch64 install.sh server_autosetup.sh; do
if [ -f "output/$FILE" ]; then
filetoupload="output/$FILE"
elif [ -f "../$FILE" ]; then