docs: Add 6, update 4 and remove 2 files
This commit is contained in:
@@ -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"
|
||||
|
Reference in New Issue
Block a user