docs: Add 6, update 4 and remove 2 files
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 59s
Build-Test-Publish / build (linux/arm64) (push) Failing after 2m45s

This commit is contained in:
j842
2025-08-17 21:01:38 +12:00
parent ed9bc9ba21
commit efd11657ac
12 changed files with 323 additions and 179 deletions

17
source/build_local.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
# This script now uses Docker for consistent builds
# For direct builds, use the Docker-based build.sh script in the parent directory
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PARENT_DIR="$(dirname "${SCRIPT_DIR}")"
echo "Using Docker-based build system..."
echo "Building debug version for native architecture..."
# Run the Docker build with debug settings
CMAKE_BUILD_TYPE=Debug INSTALL_LOCAL=true "${PARENT_DIR}/build.sh"
echo "Build process completed!"

View File

@@ -1,53 +0,0 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
OUTPUT_DIR=${SCRIPT_DIR}/output
INSTALL_DIR=${HOME}/.local/bin
mkdir -p "${OUTPUT_DIR}"
# Exit on error
set -euo pipefail
ARCH=$(uname -m)
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
echo "Unsupported architecture: $ARCH"
exit 1
fi
function build_native() {
local BUILDDIR=${SCRIPT_DIR}/build/native
local PREVDIR=$PWD
local JOBS;
JOBS=$(nproc) # Set JOBS to the number of available CPU cores
mkdir -p "${BUILDDIR}"
cd "${SCRIPT_DIR}" || exit 1
CC="${HOME}/.musl-cross/${ARCH}-linux-musl-native/bin/${ARCH}-linux-musl-gcc"
CXX="${HOME}/.musl-cross/${ARCH}-linux-musl-native/bin/${ARCH}-linux-musl-g++"
cmake -B "${BUILDDIR}" -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=mold \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}"
cd "${BUILDDIR}" || exit 1
ninja -j"$JOBS"
#upx ${BUILDDIR}/dropshell
cp "${BUILDDIR}/dropshell" "${OUTPUT_DIR}/dropshell.${ARCH}"
cd "${PREVDIR}" || exit 1
}
build_native
echo "Auto-installing dropshell locally..."
mkdir -p "${INSTALL_DIR}"
cp "${OUTPUT_DIR}/dropshell.${ARCH}" "${INSTALL_DIR}/dropshell"
echo "Build process completed!"

View File

@@ -1,37 +1,18 @@
#!/bin/bash
# This script now uses Docker for consistent builds
# For direct builds, use the Docker-based build.sh script in the parent directory
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PARENT_DIR="$(dirname "${SCRIPT_DIR}")"
# Create output directory
mkdir -p "${SCRIPT_DIR}/output"
PREV_DIR=$(pwd)
cd "${SCRIPT_DIR}"
trap 'cd "${PREV_DIR}"' EXIT
echo "Using Docker-based build system..."
echo "Building release version for production..."
function build_arch() {
local arch=$1
# Run the Docker build with release settings
CMAKE_BUILD_TYPE=Release INSTALL_LOCAL=false "${PARENT_DIR}/build.sh"
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="${SCRIPT_DIR}/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" "${SCRIPT_DIR}/output/dropshell.${arch}"
}
build_arch x86_64
build_arch aarch64
echo "Static binaries have been created:"
ls -la output
echo "Static binary has been created in ${PARENT_DIR}/output/"
ls -la "${PARENT_DIR}/output"

View File

@@ -1,57 +1,10 @@
#!/bin/bash
set -e
# directory of this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Script directory: $SCRIPT_DIR"
# Legacy publish script - redirects to new publish.sh in repository root
set -euo pipefail
# Check for GITEA_TOKEN_DEPLOY or GITEA_TOKEN
TOKEN="${RELEASE_WRITE_TOKEN:-${GITEA_TOKEN_DEPLOY}}"
[ -z "$TOKEN" ] && { echo "Neither RELEASE_WRITE_TOKEN nor GITEA_TOKEN_DEPLOY environment variable set!" >&2; exit 1; }
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PARENT_DIR="$(dirname "${SCRIPT_DIR}")"
OLD_PWD="$PWD"
cd "$SCRIPT_DIR" || exit 1
TEMP_DIR=$(mktemp -d)
trap 'rm -rf "$TEMP_DIR" && cd "$OLD_PWD"' EXIT
ARCH=$(uname -m)
TAG=$("$SCRIPT_DIR/output/dropshell.${ARCH}" --version)
[ -z "$TAG" ] && echo "Failed to get version from dropshell.${ARCH}" >&2 && exit 1
echo "Publishing dropshell version $TAG"
function die() {
echo "$@" >&2
exit 1
}
# Function to find file in specified locations
find_file() {
local filename="$1"
shift # remove filename from args
local locations=("$@") # grab the rest of the args as locations
for loc in "${locations[@]}"; do
if [ -f "$loc/$filename" ]; then
echo "$loc/$filename"
return 0 # Found the file, return success
fi
done
echo "" # Return empty string if not found
return 1
}
curl -L -s -o "${TEMP_DIR}/sos" "https://getbin.xyz/sos" || die "Failed to download sos"
chmod +x "${TEMP_DIR}/sos"
# Upload binaries and install.sh
for FILE in dropshell.x86_64 dropshell.aarch64 dropshell-install.sh dropshell-server-autosetup.sh; do
# Pass the locations directly to the find_file function
filetoupload=$(find_file "$FILE" "output" "../" ".")
[ -z "$filetoupload" ] && die "File $FILE not found in expected locations!"
"${TEMP_DIR}/sos" upload getbin.xyz "$filetoupload" "$FILE:latest" "$FILE:TAG"
done
echo "Published dropshell $TAG to getbin.xyz"
echo "Redirecting to new publish.sh in repository root..."
exec "${PARENT_DIR}/publish.sh" "$@"