docs: Update 3 files
This commit is contained in:
@@ -62,7 +62,7 @@ cd source && ./publish.sh
|
|||||||
|
|
||||||
- **Singleton Configuration**: Global configuration accessed through gConfig()
|
- **Singleton Configuration**: Global configuration accessed through gConfig()
|
||||||
- **Command Registry Pattern**: All commands register themselves with the central registry
|
- **Command Registry Pattern**: All commands register themselves with the central registry
|
||||||
- **Static Binary Distribution**: Uses musl-libc for fully static executables that work across Linux distributions
|
- **Static Binary Distribution**: Creates fully static executables that work across Linux distributions
|
||||||
|
|
||||||
### Important Files
|
### Important Files
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ cd source && ./publish.sh
|
|||||||
- Uses CMake with Ninja generator
|
- Uses CMake with Ninja generator
|
||||||
- Fetches dependencies: libassert, cpptrace, nlohmann/json
|
- Fetches dependencies: libassert, cpptrace, nlohmann/json
|
||||||
- Generates version info from timestamps
|
- Generates version info from timestamps
|
||||||
- Creates fully static binaries using musl cross-compilation toolchain
|
- Creates fully static binaries for cross-distribution compatibility
|
||||||
|
|
||||||
## Common Operations
|
## Common Operations
|
||||||
|
|
||||||
|
@@ -9,10 +9,8 @@ RUN apk add --no-cache \
|
|||||||
build-base \
|
build-base \
|
||||||
cmake \
|
cmake \
|
||||||
git \
|
git \
|
||||||
musl-dev \
|
|
||||||
curl \
|
curl \
|
||||||
bash \
|
bash \
|
||||||
musl \
|
|
||||||
g++ \
|
g++ \
|
||||||
ninja \
|
ninja \
|
||||||
linux-headers
|
linux-headers
|
||||||
|
@@ -46,7 +46,7 @@ print_status "Detected OS: $OS $VER"
|
|||||||
case $OS in
|
case $OS in
|
||||||
"Ubuntu"|"Debian GNU/Linux")
|
"Ubuntu"|"Debian GNU/Linux")
|
||||||
# Common packages for both Ubuntu and Debian
|
# Common packages for both Ubuntu and Debian
|
||||||
PACKAGES="bash cmake make g++ devscripts debhelper build-essential upx musl-tools wget tar ccache ninja-build"
|
PACKAGES="bash cmake make g++ devscripts debhelper build-essential upx wget tar ccache ninja-build"
|
||||||
INSTALLCMD="apt-get install -y"
|
INSTALLCMD="apt-get install -y"
|
||||||
UPDATECMD="apt-get update"
|
UPDATECMD="apt-get update"
|
||||||
;;
|
;;
|
||||||
@@ -96,67 +96,9 @@ for pkg in $PACKAGES; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------
|
||||||
# MUSL CROSS COMPILERS
|
# BUILD TOOLS SETUP COMPLETE
|
||||||
# ----------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Set install directory
|
|
||||||
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
|
|
||||||
USER_HOME=$(eval echo "~$SUDO_USER")
|
|
||||||
else
|
|
||||||
USER_HOME="$HOME"
|
|
||||||
fi
|
|
||||||
INSTALL_DIR="$USER_HOME/.musl-cross"
|
|
||||||
mkdir -p "$INSTALL_DIR"
|
|
||||||
|
|
||||||
TMPDIR=$(mktemp -d)
|
|
||||||
trap 'rm -rf "$TMPDIR"' EXIT
|
|
||||||
|
|
||||||
function install_musl_cross() {
|
|
||||||
local TOOLCHAIN="$1"
|
|
||||||
local MUSL_CC_URL="https://musl.cc"
|
|
||||||
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
|
|
||||||
echo "Downloading $TOOLCHAIN musl cross toolchain..."
|
|
||||||
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz"
|
|
||||||
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function check_path() {
|
|
||||||
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TOOLCHAIN_LIST=(
|
|
||||||
"aarch64-linux-musl-cross"
|
|
||||||
"x86_64-linux-musl-cross"
|
|
||||||
"x86_64-linux-musl-native"
|
|
||||||
)
|
|
||||||
|
|
||||||
for TOOLCHAIN in "${TOOLCHAIN_LIST[@]}"; do
|
|
||||||
install_musl_cross "$TOOLCHAIN"
|
|
||||||
check_path "$TOOLCHAIN"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
rm -rf "$TMPDIR"
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------
|
||||||
# COMPLETE
|
# COMPLETE
|
||||||
# ----------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user