This commit is contained in:
parent
b05f1d1ac9
commit
4654894246
@ -1,30 +0,0 @@
|
||||
name: dropshell-build
|
||||
run-name: Build test and publish dropshell-build
|
||||
|
||||
on: [push]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.jde.nz
|
||||
username: DoesntMatter
|
||||
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||
- name: Build
|
||||
run: |
|
||||
./dropshell-build/build.sh
|
||||
- name: Test
|
||||
run: |
|
||||
./dropshell-build/test.sh
|
||||
- name: Publish
|
||||
run: |
|
||||
SOS_WRITE_TOKEN=${{ secrets.SOS_WRITE_TOKEN }} ./dropshell-build/publish.sh
|
@ -1,20 +0,0 @@
|
||||
FROM debian:latest
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
git \
|
||||
nlohmann-json3-dev wget curl cmake ninja-build mold build-essential nodejs npm jq ccache \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#RUN curl -fsSL https://get.docker.com | sh
|
||||
|
||||
COPY --chmod=0755 ./src/* /usr/local/bin/
|
||||
|
||||
RUN /usr/local/bin/install_dropshell_build_requirements
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["dropshell-build","/app"]
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
docker build -t gitea.jde.nz/public/dropshell-build:test -f "${SCRIPT_DIR}/Dockerfile" "${SCRIPT_DIR}"
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# upload the dropshell-build script
|
||||
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-build" "${SCRIPT_DIR}/src/dropshell-build"
|
||||
|
||||
# upload the install requirements script
|
||||
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-build-install-requirements" "${SCRIPT_DIR}/src/install_dropshell_build_requirements"
|
||||
|
||||
|
||||
# tag and push the dropshell-build image
|
||||
docker tag gitea.jde.nz/public/dropshell-build:test gitea.jde.nz/public/dropshell-build:latest
|
||||
|
||||
docker push gitea.jde.nz/public/dropshell-build:latest
|
@ -1,271 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
ARCHS=(
|
||||
"x86_64"
|
||||
"aarch64"
|
||||
)
|
||||
|
||||
HOSTARCH=$(uname -m)
|
||||
|
||||
SOURCE_DIR=""
|
||||
BUILD_DIR=""
|
||||
OUTPUT_DIR=""
|
||||
EXECUTABLE_NAME=""
|
||||
|
||||
# set flags from command line
|
||||
RELEASE=0
|
||||
MULTIBUILD=0
|
||||
|
||||
|
||||
function help() {
|
||||
echo "Usage: $0 [options]"
|
||||
echo "Options:"
|
||||
echo " version Show version information and exit"
|
||||
echo " "
|
||||
echo " <directory> Build the project in <directory>"
|
||||
echo " -r, --release Build release version"
|
||||
echo " -m, --multi Build for multiple architectures"
|
||||
}
|
||||
|
||||
function version() {
|
||||
echo "2025.0531.0942"
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
# BUILD
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
CMAKE_FILE="CMakeLists.txt"
|
||||
|
||||
function get_executable_name() {
|
||||
EXECUTABLE_NAME=""
|
||||
local var_value=""
|
||||
|
||||
echo "Getting executable name from ${SOURCE_DIR}/${CMAKE_FILE}"
|
||||
|
||||
while IFS= read -r line; do
|
||||
# Look for set(PROJECT_EXE_NAME ipdemo)
|
||||
if [[ "$line" =~ set\(PROJECT_EXE_NAME[[:space:]]+([a-zA-Z0-9_-]+)\) ]]; then
|
||||
var_value=$(echo "$line" | sed -E 's/.*set\(PROJECT_EXE_NAME[[:space:]]+([a-zA-Z0-9_-]+)\).*/\1/')
|
||||
fi
|
||||
# Look for add_executable(${PROJECT_EXE_NAME}
|
||||
if [[ "$line" =~ add_executable\([[:space:]]*\$\{PROJECT_EXE_NAME\}[[:space:]] ]]; then
|
||||
echo "Found executable name: $var_value"
|
||||
EXECUTABLE_NAME="$var_value"
|
||||
fi
|
||||
done < "${SOURCE_DIR}/${CMAKE_FILE}"
|
||||
|
||||
if [[ -z "$EXECUTABLE_NAME" ]]; then
|
||||
echo "Executable name not found."
|
||||
exit 1
|
||||
else
|
||||
echo "Executable name: $EXECUTABLE_NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
function build_arch() {
|
||||
local ARCH="$1"
|
||||
local PREVDIR="$PWD"
|
||||
local JOBS;
|
||||
JOBS=$(nproc) # Set JOBS to the number of available CPU cores
|
||||
cd "${SOURCE_DIR}" || exit 1
|
||||
|
||||
local ARCH_BUILD_DIR=${BUILD_DIR}/${ARCH}
|
||||
mkdir -p "${ARCH_BUILD_DIR}"
|
||||
|
||||
echo "Building for ${ARCH} in ${ARCH_BUILD_DIR}, from ${SOURCE_DIR}"
|
||||
|
||||
if [ ! -f "${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-g++" ]; then
|
||||
echo "Musl cross toolchain not found for ${ARCH}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMAKE_BUILD_TYPE="Release"
|
||||
if [ "$RELEASE" -eq 0 ]; then
|
||||
CMAKE_BUILD_TYPE="Debug"
|
||||
fi
|
||||
|
||||
export CC="${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-gcc"
|
||||
export CXX="${HOME}/.musl-cross/${ARCH}-linux-musl-cross/bin/${ARCH}-linux-musl-g++"
|
||||
export SYSROOT="${HOME}/.musl-cross/${ARCH}-linux-musl-cross/${ARCH}-linux-musl/sysroot"
|
||||
export OPENSSL_ROOT_DIR="${SYSROOT}/usr"
|
||||
export CFLAGS="--sysroot=$SYSROOT"
|
||||
export CXXFLAGS="--sysroot=$SYSROOT"
|
||||
export LDFLAGS="--sysroot=$SYSROOT"
|
||||
export MAKEFLAGS="-j${JOBS}"
|
||||
|
||||
cmake -B "${ARCH_BUILD_DIR}" -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_LINKER=mold \
|
||||
-DCMAKE_C_COMPILER_TARGET="${ARCH}-linux-musl" \
|
||||
-DCMAKE_CXX_COMPILER_TARGET="${ARCH}-linux-musl" \
|
||||
-DCMAKE_C_FLAGS="${CFLAGS}" \
|
||||
-DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
|
||||
-DCMAKE_FIND_ROOT_PATH="${SYSROOT}" \
|
||||
-DCMAKE_SYSROOT="${SYSROOT}"
|
||||
cd "${ARCH_BUILD_DIR}" || exit 1
|
||||
ninja -k0 -j"${JOBS}"
|
||||
|
||||
if [ "$RELEASE" -eq 1 ]; then
|
||||
upx "${ARCH_BUILD_DIR}/${EXECUTABLE_NAME}"
|
||||
fi
|
||||
|
||||
if [ ! -d "${OUTPUT_DIR}" ]; then
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
fi
|
||||
cp "${ARCH_BUILD_DIR}/${EXECUTABLE_NAME}" "${OUTPUT_DIR}/${EXECUTABLE_NAME}.${ARCH}"
|
||||
|
||||
cd "${PREVDIR}" || exit 1
|
||||
}
|
||||
|
||||
function build() {
|
||||
echo "Building project in directory $1"
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "Directory $1 does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# remove trailing slash from SOURCE_DIR
|
||||
SOURCE_DIR="$1"
|
||||
SOURCE_DIR=$(echo "$SOURCE_DIR" | sed 's:/*$::')
|
||||
|
||||
# make SOURCE_DIR absolute
|
||||
SOURCE_DIR=$(realpath "$SOURCE_DIR")
|
||||
|
||||
BUILD_DIR="${SOURCE_DIR}/build"
|
||||
OUTPUT_DIR="${SOURCE_DIR}/output"
|
||||
|
||||
if [ ! -f "${SOURCE_DIR}/${CMAKE_FILE}" ]; then
|
||||
echo "${CMAKE_FILE} not found in ${SOURCE_DIR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_executable_name
|
||||
|
||||
# if have the -m option, then build for multiple architectures
|
||||
if [ $MULTIBUILD -eq 1 ]; then
|
||||
for arch in "${ARCHS[@]}"; do
|
||||
build_arch "$arch"
|
||||
done
|
||||
else
|
||||
build_arch "$HOSTARCH"
|
||||
fi
|
||||
}
|
||||
|
||||
function buildspawn() {
|
||||
local BUILD_DIR="${1:-}"
|
||||
[ -n "${BUILD_DIR:-}" ] || die "No Build Directory given!"
|
||||
[ -d "$BUILD_DIR" ] || die "Build Directory doesn't exist: $BUILD_DIR"
|
||||
|
||||
# make canonical
|
||||
BUILD_DIR=$(realpath "$BUILD_DIR")
|
||||
FLAGS=""
|
||||
[ $MULTIBUILD -eq 0 ] || FLAGS="$FLAGS -m"
|
||||
[ $RELEASE -eq 0 ] || FLAGS="$FLAGS -r"
|
||||
|
||||
BUILD_VERSION_FILE="$HOME/.config/dropshell-build/version"
|
||||
if [ ! -f "$BUILD_VERSION_FILE" ]; then
|
||||
# check if docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "Neither dropshell-build nor docker appears to be available. Please install one of them."
|
||||
exit 1
|
||||
fi
|
||||
echo "Using Docker Buildchain."
|
||||
TAG="latest"
|
||||
if [ -n "${DROPSHELL_BUILD_TAG-}" ]; then
|
||||
TAG="$DROPSHELL_BUILD_TAG"
|
||||
fi
|
||||
echo "Using Docker Buildchain with tag: $TAG"
|
||||
|
||||
|
||||
# Check if we're running in Gitea Actions
|
||||
if [ -n "${JOB_CONTAINER_NAME:-}" ] && [ -n "${GITHUB_WORKSPACE:-}" ]; then
|
||||
echo "--------------------------------"
|
||||
echo "Running in Gitea Actions - using --volumes-from"
|
||||
echo "--------------------------------"
|
||||
|
||||
echo "ls -la using --volumes-from"
|
||||
echo "GITHUB_WORKSPACE: ${GITHUB_WORKSPACE}"
|
||||
echo "BUILD_DIR: ${BUILD_DIR}"
|
||||
echo "PWD: ${PWD}"
|
||||
echo "JOB_CONTAINER_NAME: ${JOB_CONTAINER_NAME}"
|
||||
|
||||
docker run --rm \
|
||||
--volumes-from="${JOB_CONTAINER_NAME}" \
|
||||
"gitea.jde.nz/public/dropshell-build:${TAG}" \
|
||||
bash -c "rm -rf /app && \
|
||||
ln -s ${BUILD_DIR} /app && \
|
||||
dropshell-build $FLAGS /app"
|
||||
else
|
||||
echo "Running locally"
|
||||
docker run --rm \
|
||||
-u "$(id -u)":"$(id -g)" \
|
||||
-v "$BUILD_DIR":/app \
|
||||
"gitea.jde.nz/public/dropshell-build:${TAG}" \
|
||||
bash -c "dropshell-build $FLAGS /app"
|
||||
fi
|
||||
else
|
||||
echo "Using local native buildchain"
|
||||
# shellcheck disable=SC2086
|
||||
build $FLAGS $BUILD_DIR
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
# MAIN
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function main() {
|
||||
while getopts "rm" opt; do
|
||||
case $opt in
|
||||
r)
|
||||
RELEASE=1
|
||||
;;
|
||||
m)
|
||||
MULTIBUILD=1
|
||||
;;
|
||||
*)
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Shift the processed options out of the argument list
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# check we have at least one argument
|
||||
if [ $# -eq 0 ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# get command argument, now that the flags are set
|
||||
CMD="$1"
|
||||
|
||||
if [ -z "$CMD" ]; then
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
case "$CMD" in
|
||||
version)
|
||||
version
|
||||
;;
|
||||
*)
|
||||
buildspawn "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,348 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
# If the user is not root, use sudo
|
||||
SUDOCMD=""
|
||||
[ "$EUID" -eq 0 ] || SUDOCMD="sudo"
|
||||
|
||||
# If the user is not root, use the home directory of the user who ran the script
|
||||
USER_HOME="$HOME"
|
||||
if [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != "root" ]; then
|
||||
USER_HOME=$(eval echo "~${SUDO_USER}")
|
||||
fi
|
||||
|
||||
# test sudo is working or we're root (return non-zero if not root!)
|
||||
if ! ${SUDOCMD:-} true; then
|
||||
echo "Error: This script must be run as root or with sudo privileges." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_die() {
|
||||
echo -e "Error: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print status messages
|
||||
print_status() {
|
||||
echo -e "${GREEN}[*] $1${NC}"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[!] $1${NC}"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}[!] $1${NC}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
# Headers on Host (Native)
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Function to check if a package is installed
|
||||
is_package_installed() {
|
||||
if [ "$OS" = "Alpine Linux" ]; then
|
||||
apk info | grep -q "^$1$"
|
||||
else
|
||||
dpkg -l "$1"
|
||||
fi
|
||||
}
|
||||
function install_packages() {
|
||||
local PACKAGES
|
||||
local HAVE_UPDATED=0
|
||||
|
||||
# Detect distribution
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
VER=$VERSION_ID
|
||||
else
|
||||
print_error "Could not detect distribution"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_status "Detected OS: $OS $VER"
|
||||
|
||||
# Define packages based on distribution
|
||||
case $OS in
|
||||
"Ubuntu"|"Debian GNU/Linux")
|
||||
# Common packages for both Ubuntu and Debian
|
||||
# cmake make g++ build-essential upx musl-tools wget tar ccache ninja-build mold
|
||||
PACKAGES="build-essential cmake git wget tar curl ninja-build mold nodejs npm perl jq ccache"
|
||||
INSTALLCMD="apt-get install -y"
|
||||
UPDATECMD="apt-get update"
|
||||
;;
|
||||
"Alpine Linux")
|
||||
PACKAGES="build-base cmake git wget tar curl ninja mold nodejs npm linux-headers perl jq ccache"
|
||||
INSTALLCMD="apk add --no-cache"
|
||||
UPDATECMD="apk update"
|
||||
;;
|
||||
*)
|
||||
print_error "Unsupported distribution: $OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install missing packages
|
||||
print_status "Checking and installing required packages..."
|
||||
for pkg in $PACKAGES; do
|
||||
if ! is_package_installed "$pkg"; then
|
||||
print_status "Installing $pkg..."
|
||||
|
||||
# Update package lists
|
||||
if [ "$HAVE_UPDATED" -eq 0 ]; then
|
||||
print_status "Updating package lists..."
|
||||
${SUDOCMD:-} bash -c "${UPDATECMD}"
|
||||
HAVE_UPDATED=1
|
||||
fi
|
||||
|
||||
if ! bash -c "${SUDOCMD:-} ${INSTALLCMD} $pkg"; then
|
||||
print_error "Failed to install $pkg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_status "$pkg is already installed"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
function install_headers() {
|
||||
# put libassert headers on the host.
|
||||
echo "Checking for libassert headers"
|
||||
if [ ! -f "/usr/local/lib/libassert.a" ]; then
|
||||
echo "libassert not found, installing..."
|
||||
git clone https://github.com/jeremy-rifkin/libassert.git
|
||||
#git checkout v2.1.5
|
||||
mkdir libassert/build
|
||||
cd "libassert/build" || exit 1
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make -j
|
||||
${SUDOCMD:-} make install
|
||||
cd ../..
|
||||
rm -rf libassert
|
||||
else
|
||||
echo "libassert headers already installed"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
# OpenSSL for musl cross toolchains
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function install_openssl_musl() {
|
||||
OPENSSL_VERSION=3.5.0
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
BUILD_DIR="${SCRIPT_DIR}/build"
|
||||
MUSL_CROSS_DIR="$HOME/.musl-cross"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
# Helper: compare versions (returns 0 if $1 >= $2)
|
||||
version_ge() {
|
||||
[ "$1" = "$2" ] && return 0
|
||||
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
|
||||
}
|
||||
|
||||
# Find all installed musl cross toolchains
|
||||
TOOLCHAINS=()
|
||||
for tc in "$MUSL_CROSS_DIR"/*-linux-musl-cross; do
|
||||
[ -d "$tc" ] || continue
|
||||
arch=$(basename "$tc" | sed 's/-linux-musl-cross//')
|
||||
TOOLCHAINS+=("$arch")
|
||||
done
|
||||
|
||||
if [ ${#TOOLCHAINS[@]} -eq 0 ]; then
|
||||
echo "No musl cross toolchains found in $MUSL_CROSS_DIR. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Found musl cross toolchains: ${TOOLCHAINS[*]}"
|
||||
|
||||
for ARCH in "${TOOLCHAINS[@]}"; do
|
||||
echo "==============================="
|
||||
echo "Checking OpenSSL for $ARCH..."
|
||||
echo "==============================="
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
MUSL_PREFIX="$MUSL_CROSS_DIR/x86_64-linux-musl-cross"
|
||||
OPENSSL_TARGET=linux-x86_64
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
MUSL_PREFIX="$MUSL_CROSS_DIR/aarch64-linux-musl-cross"
|
||||
OPENSSL_TARGET=linux-aarch64
|
||||
else
|
||||
# Try to guess OpenSSL target for other musl toolchains
|
||||
OPENSSL_TARGET="linux-$ARCH"
|
||||
MUSL_PREFIX="$MUSL_CROSS_DIR/${ARCH}-linux-musl-cross"
|
||||
fi
|
||||
SYSROOT="$MUSL_PREFIX/${ARCH}-linux-musl/sysroot"
|
||||
CC="$MUSL_PREFIX/bin/${ARCH}-linux-musl-gcc"
|
||||
AR="$MUSL_PREFIX/bin/${ARCH}-linux-musl-ar"
|
||||
RANLIB="$MUSL_PREFIX/bin/${ARCH}-linux-musl-ranlib"
|
||||
|
||||
DEST_PATH="$SYSROOT/usr/lib/libssl.a"
|
||||
if [ -f "$DEST_PATH" ]; then
|
||||
echo "OpenSSL $ARCH is already installed"
|
||||
continue
|
||||
fi
|
||||
|
||||
SKIP_BUILD=0
|
||||
if [ -f "$SYSROOT/usr/lib/libssl.a" ]; then
|
||||
# Try to extract version from opensslv.h
|
||||
OPENSSLV_H="$SYSROOT/usr/include/openssl/opensslv.h"
|
||||
if [ -f "$OPENSSLV_H" ]; then
|
||||
INSTALLED_VERSION=$(grep '# *define *OPENSSL_VERSION_TEXT' "$OPENSSLV_H" | sed -E 's/.*OpenSSL ([0-9.]+)[^ ]*.*/\1/')
|
||||
if [ -n "$INSTALLED_VERSION" ]; then
|
||||
echo "Found installed OpenSSL version: $INSTALLED_VERSION"
|
||||
if version_ge "$INSTALLED_VERSION" "$OPENSSL_VERSION"; then
|
||||
echo "OpenSSL $INSTALLED_VERSION is up-to-date (>= $OPENSSL_VERSION), skipping build for $ARCH."
|
||||
SKIP_BUILD=1
|
||||
else
|
||||
echo "OpenSSL $INSTALLED_VERSION is older than $OPENSSL_VERSION, will rebuild."
|
||||
fi
|
||||
else
|
||||
echo "Could not determine installed OpenSSL version, will rebuild."
|
||||
fi
|
||||
else
|
||||
echo "No opensslv.h found, will rebuild."
|
||||
fi
|
||||
else
|
||||
echo "No libssl.a found, will rebuild."
|
||||
fi
|
||||
|
||||
if [ "$SKIP_BUILD" -eq 1 ]; then
|
||||
echo "Skipping build for $ARCH."
|
||||
continue
|
||||
fi
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
if [ ! -d "openssl-${OPENSSL_VERSION}" ]; then
|
||||
if [ ! -f "openssl-${OPENSSL_VERSION}.tar.gz" ]; then
|
||||
wget "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
|
||||
fi
|
||||
tar xf "openssl-${OPENSSL_VERSION}.tar.gz"
|
||||
fi
|
||||
cd "openssl-${OPENSSL_VERSION}"
|
||||
|
||||
echo "----------------------------------------------"
|
||||
echo "Configuring for $ARCH with sysroot $SYSROOT..."
|
||||
CC="$CC" AR="$AR" RANLIB="$RANLIB" ./Configure "$OPENSSL_TARGET" no-shared --prefix="$SYSROOT/usr"
|
||||
echo "Building..."
|
||||
make -j"$(nproc)"
|
||||
echo "Installing to $SYSROOT/usr ..."
|
||||
make install_sw
|
||||
cd "$BUILD_DIR"
|
||||
echo "Done for $ARCH."
|
||||
echo
|
||||
# Remove build dir for next arch to avoid cross contamination
|
||||
rm -rf "openssl-${OPENSSL_VERSION}"
|
||||
tar xf "openssl-${OPENSSL_VERSION}.tar.gz"
|
||||
done
|
||||
|
||||
echo "OpenSSL built and installed for all detected musl toolchains."
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
# MUSL CROSS COMPILERS
|
||||
# ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function check_path() {
|
||||
local BASHRC="${USER_HOME}/.bashrc"
|
||||
local TOOLCHAIN="$1"
|
||||
local MUSL_PATH="$INSTALL_DIR/$TOOLCHAIN/bin"
|
||||
if ! echo "$PATH" | grep -q "$MUSL_PATH"; then
|
||||
echo "Adding $MUSL_PATH to PATH in $BASHRC"
|
||||
PATH_LINE="export PATH=\"$MUSL_PATH:\$PATH\""
|
||||
if ! grep -Fxq "$PATH_LINE" "$BASHRC"; then
|
||||
echo "" >> "$BASHRC"
|
||||
echo "# Add musl cross compilers to PATH for dropshell" >> "$BASHRC"
|
||||
echo "$PATH_LINE" >> "$BASHRC"
|
||||
|
||||
echo "Added musl cross compilers to $BASHRC"
|
||||
echo "You should run 'source ~/.bashrc' to update your PATH"
|
||||
else
|
||||
echo "You should run 'source ~/.bashrc' to update your PATH"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_musl_cross() {
|
||||
local TOOLCHAIN="$1"
|
||||
local MUSL_CC_URL="https://getbin.xyz"
|
||||
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
|
||||
echo "Downloading $TOOLCHAIN musl cross toolchain..."
|
||||
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz:latest"
|
||||
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
|
||||
else
|
||||
echo "$TOOLCHAIN musl cross toolchain already installed"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_musl() {
|
||||
echo "Installing musl toolchain"
|
||||
|
||||
# Set install directory
|
||||
INSTALL_DIR="$USER_HOME/.musl-cross"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMPDIR"' EXIT
|
||||
|
||||
TOOLCHAIN_LIST=(
|
||||
"aarch64-linux-musl-cross"
|
||||
"x86_64-linux-musl-cross"
|
||||
)
|
||||
|
||||
for TOOLCHAIN in "${TOOLCHAIN_LIST[@]}"; do
|
||||
install_musl_cross "$TOOLCHAIN"
|
||||
check_path "$TOOLCHAIN"
|
||||
done
|
||||
|
||||
# Clean up
|
||||
rm -rf "$TMPDIR"
|
||||
}
|
||||
|
||||
function output_version() {
|
||||
local VERSIONDATE
|
||||
local CONFIG_DIR="$USER_HOME/.config/dropshell-build/"
|
||||
mkdir -p "$CONFIG_DIR"
|
||||
VERSIONDATE="$(date +%Y.%m%d.%H%M)"
|
||||
echo "$VERSIONDATE" > "$CONFIG_DIR/version" || echo "Error: Failed to write version file to $CONFIG_DIR/version"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
# Main
|
||||
#----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function main() {
|
||||
|
||||
install_packages
|
||||
|
||||
install_headers
|
||||
|
||||
install_musl
|
||||
|
||||
install_openssl_musl
|
||||
|
||||
output_version
|
||||
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
main "$@"
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
echo "Testing dropshell-build"
|
||||
|
||||
DROPSHELL_BUILD_TAG="test" "${SCRIPT_DIR}/src/dropshell-build" "${SCRIPT_DIR}/test"
|
||||
|
||||
"${SCRIPT_DIR}/test/output/ipdemo.x86_64"
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
3
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
3
|
||||
3
|
||||
0
|
||||
6
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
6
|
||||
0
|
||||
3
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
3
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
2
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
2
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
4
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
4
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
0
|
||||
2
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
Binary file not shown.
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
472
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
Binary file not shown.
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
8
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
4
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
4
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
Binary file not shown.
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
2
|
||||
20
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
4
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
16
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by ccache.
|
||||
# For information about cache directory tags, see:
|
||||
# http://www.brynosaurus.com/cachedir/
|
@ -1,82 +0,0 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
236
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
Binary file not shown.
@ -1,103 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(PROJECT_EXE_NAME ipdemo)
|
||||
project(${PROJECT_EXE_NAME} VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
# Force static linking globally
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
set(ZLIB_USE_STATIC_LIBS "ON")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_C_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Set default build type to Release if not specified
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
|
||||
endif()
|
||||
|
||||
# Configure build-specific compiler flags
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
|
||||
|
||||
# Configure version information
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
string(TIMESTAMP CURRENT_MONTH "%m")
|
||||
string(TIMESTAMP CURRENT_DAY "%d")
|
||||
string(TIMESTAMP CURRENT_HOUR "%H")
|
||||
string(TIMESTAMP CURRENT_MINUTE "%M")
|
||||
set(PROJECT_VERSION "${CURRENT_YEAR}.${CURRENT_MONTH}${CURRENT_DAY}.${CURRENT_HOUR}${CURRENT_MINUTE}")
|
||||
string(TIMESTAMP RELEASE_DATE "%Y-%m-%d")
|
||||
|
||||
# Configure version.hpp file
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/version.hpp.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/autogen/version.hpp"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Set CMAKE_MODULE_PATH to include our custom find modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
# Auto-detect source files
|
||||
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||
file(GLOB_RECURSE HEADERS "src/*.hpp")
|
||||
|
||||
# Add custom target to run cmake_prebuild.sh at the start of the build process
|
||||
add_custom_target(run_prebuild_script ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Running cmake_prebuild.sh..."
|
||||
COMMAND ${CMAKE_COMMAND} -E env bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake_prebuild.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# Add executable
|
||||
add_executable(${PROJECT_EXE_NAME} ${SOURCES})
|
||||
add_dependencies(${PROJECT_EXE_NAME} run_prebuild_script)
|
||||
|
||||
# Set include directories
|
||||
# build dir goes first so that we can use the generated version.hpp
|
||||
target_include_directories(${PROJECT_EXE_NAME} PRIVATE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src/autogen>
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure libassert
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
libassert
|
||||
GIT_REPOSITORY https://github.com/jeremy-rifkin/libassert.git
|
||||
GIT_TAG v2.1.5
|
||||
)
|
||||
FetchContent_MakeAvailable(libassert)
|
||||
|
||||
# Add cpptrace
|
||||
FetchContent_Declare(
|
||||
cpptrace
|
||||
GIT_REPOSITORY https://github.com/jeremy-rifkin/cpptrace.git
|
||||
GIT_TAG v0.8.3
|
||||
)
|
||||
FetchContent_MakeAvailable(cpptrace)
|
||||
|
||||
# Add nlohmann/json
|
||||
FetchContent_Declare(
|
||||
nlohmann_json
|
||||
GIT_REPOSITORY https://github.com/nlohmann/json.git
|
||||
GIT_TAG v3.11.3
|
||||
)
|
||||
FetchContent_MakeAvailable(nlohmann_json)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(${PROJECT_EXE_NAME} PRIVATE
|
||||
libassert::assert
|
||||
cpptrace::cpptrace
|
||||
nlohmann_json::nlohmann_json
|
||||
)
|
||||
|
||||
# Set static linking flags
|
||||
set_target_properties(${PROJECT_EXE_NAME} PROPERTIES
|
||||
LINK_FLAGS "-static"
|
||||
)
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "cmake_prebuild.sh complete."
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
|
||||
version.hpp is automatically generated by the build system, from version.hpp.in.
|
||||
|
||||
DO NOT EDIT VERSION.HPP!
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
// Version information
|
||||
const std::string VERSION = "@PROJECT_VERSION@";
|
||||
const std::string RELEASE_DATE = "@RELEASE_DATE@";
|
||||
const std::string AUTHOR = "j842";
|
||||
const std::string LICENSE = "MIT";
|
||||
|
||||
} // namespace dropshell
|
File diff suppressed because it is too large
Load Diff
@ -1,26 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <libassert/assert.hpp>
|
||||
|
||||
#include "httplib.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
int main() {
|
||||
std::cout << "Retrieving IP address..." << std::endl;
|
||||
|
||||
httplib::Client cli("http://ipinfo.io");
|
||||
auto res = cli.Get("/ip");
|
||||
|
||||
ASSERT(res->status == 200, "Failed to get IP");
|
||||
|
||||
nlohmann::json j;
|
||||
j["ip"] = res->body;
|
||||
j["status"] = res->status;
|
||||
|
||||
std::cout << j.dump(4) << std::endl;
|
||||
|
||||
std::cout << "Done" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
|
||||
version.hpp is automatically generated by the build system, from version.hpp.in.
|
||||
|
||||
DO NOT EDIT VERSION.HPP!
|
||||
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
// Version information
|
||||
const std::string VERSION = "@PROJECT_VERSION@";
|
||||
const std::string RELEASE_DATE = "@RELEASE_DATE@";
|
||||
const std::string AUTHOR = "j842";
|
||||
const std::string LICENSE = "MIT";
|
||||
|
||||
} // namespace dropshell
|
Loading…
x
Reference in New Issue
Block a user