feat(lite): add ObsidianDragonLite build mode and gate full-node features
Add --lite build flow and ObsidianDragonLite target naming, hide full-node pages/features in lite mode, enforce pool-only mining in lite, and include chat port feasibility audit documentation.
This commit is contained in:
100
build.sh
100
build.sh
@@ -41,6 +41,7 @@ DO_DEV=false
|
||||
DO_LINUX=false
|
||||
DO_WIN=false
|
||||
DO_MAC=false
|
||||
DO_LITE=false
|
||||
CLEAN=false
|
||||
BUILD_TYPE="Release"
|
||||
|
||||
@@ -54,6 +55,7 @@ Targets (at least one required, or none for dev build):
|
||||
--linux-release Linux release (zip + AppImage) -> release/linux/
|
||||
--win-release Windows cross-compile (mingw-w64) -> release/windows/
|
||||
--mac-release macOS .app bundle + DMG -> release/mac/
|
||||
--lite Build ObsidianDragonLite variant (no embedded daemon/full-node features)
|
||||
|
||||
Build trees are stored under build/{linux,windows,mac}/
|
||||
|
||||
@@ -85,6 +87,7 @@ while [[ $# -gt 0 ]]; do
|
||||
--linux-release) DO_LINUX=true; shift ;;
|
||||
--win-release) DO_WIN=true; shift ;;
|
||||
--mac-release) DO_MAC=true; shift ;;
|
||||
--lite) DO_LITE=true; shift ;;
|
||||
-c|--clean) CLEAN=true; shift ;;
|
||||
-d|--debug) BUILD_TYPE="Debug"; shift ;;
|
||||
-j) JOBS="$2"; shift 2 ;;
|
||||
@@ -98,6 +101,14 @@ if ! $DO_LINUX && ! $DO_WIN && ! $DO_MAC; then
|
||||
DO_DEV=true
|
||||
fi
|
||||
|
||||
APP_BASENAME="ObsidianDragon"
|
||||
CMAKE_LITE_ARGS=()
|
||||
if $DO_LITE; then
|
||||
APP_BASENAME="ObsidianDragonLite"
|
||||
CMAKE_LITE_ARGS+=("-DDRAGONX_BUILD_LITE=ON")
|
||||
info "Lite mode enabled: building ${APP_BASENAME}"
|
||||
fi
|
||||
|
||||
# ── Helper: find resource files ──────────────────────────────────────────────
|
||||
find_sapling_params() {
|
||||
local dirs=(
|
||||
@@ -215,13 +226,14 @@ build_dev() {
|
||||
cmake "$SCRIPT_DIR" \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=ON
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=ON \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
|
||||
info "Building with $JOBS jobs ..."
|
||||
cmake --build . -j "$JOBS"
|
||||
|
||||
[[ -f "bin/ObsidianDragon" ]] || { err "Build failed"; exit 1; }
|
||||
info "Dev binary: $bd/bin/ObsidianDragon ($(du -h bin/ObsidianDragon | cut -f1))"
|
||||
[[ -f "bin/${APP_BASENAME}" ]] || { err "Build failed"; exit 1; }
|
||||
info "Dev binary: $bd/bin/${APP_BASENAME} ($(du -h "bin/${APP_BASENAME}" | cut -f1))"
|
||||
}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
@@ -242,16 +254,17 @@ build_release_linux() {
|
||||
cmake "$SCRIPT_DIR" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=ON
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=ON \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
|
||||
info "Building with $JOBS jobs ..."
|
||||
cmake --build . -j "$JOBS"
|
||||
|
||||
[[ -f "bin/ObsidianDragon" ]] || { err "Linux build failed"; exit 1; }
|
||||
[[ -f "bin/${APP_BASENAME}" ]] || { err "Linux build failed"; exit 1; }
|
||||
|
||||
info "Stripping ..."
|
||||
strip bin/ObsidianDragon
|
||||
info "Binary: $(du -h bin/ObsidianDragon | cut -f1)"
|
||||
strip "bin/${APP_BASENAME}"
|
||||
info "Binary: $(du -h "bin/${APP_BASENAME}" | cut -f1)"
|
||||
|
||||
# ── Bundle daemon ────────────────────────────────────────────────────────
|
||||
bundle_linux_daemon "bin" || warn "Daemon not bundled — wallet-only build"
|
||||
@@ -268,11 +281,11 @@ build_release_linux() {
|
||||
rm -rf "$out"
|
||||
mkdir -p "$out"
|
||||
|
||||
local DIST="ObsidianDragon-${VERSION}-Linux-x64"
|
||||
local DIST="${APP_BASENAME}-${VERSION}-Linux-x64"
|
||||
local dist_dir="$out/$DIST"
|
||||
mkdir -p "$dist_dir"
|
||||
|
||||
cp bin/ObsidianDragon "$dist_dir/"
|
||||
cp "bin/${APP_BASENAME}" "$dist_dir/"
|
||||
[[ -f bin/dragonxd ]] && cp bin/dragonxd "$dist_dir/"
|
||||
[[ -f bin/dragonx-cli ]] && cp bin/dragonx-cli "$dist_dir/"
|
||||
[[ -f bin/asmap.dat ]] && cp bin/asmap.dat "$dist_dir/"
|
||||
@@ -299,7 +312,7 @@ build_release_linux() {
|
||||
"$APPDIR/usr/share/icons/hicolor/256x256/apps" \
|
||||
"$APPDIR/usr/share/ObsidianDragon/res"
|
||||
|
||||
cp bin/ObsidianDragon "$APPDIR/usr/bin/"
|
||||
cp "bin/${APP_BASENAME}" "$APPDIR/usr/bin/"
|
||||
cp -r bin/res/* "$APPDIR/usr/share/ObsidianDragon/res/" 2>/dev/null || true
|
||||
|
||||
[[ -f bin/dragonxd ]] && cp bin/dragonxd "$APPDIR/usr/bin/"
|
||||
@@ -314,12 +327,12 @@ build_release_linux() {
|
||||
[[ -f "$XMRIG_LINUX_AI" ]] && { cp "$XMRIG_LINUX_AI" "$APPDIR/usr/bin/"; chmod +x "$APPDIR/usr/bin/xmrig"; }
|
||||
|
||||
# Desktop entry
|
||||
cat > "$APPDIR/usr/share/applications/ObsidianDragon.desktop" <<'DESK'
|
||||
cat > "$APPDIR/usr/share/applications/ObsidianDragon.desktop" <<DESK
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=DragonX Wallet
|
||||
Comment=DragonX Cryptocurrency Wallet
|
||||
Exec=ObsidianDragon
|
||||
Exec=${APP_BASENAME}
|
||||
Icon=ObsidianDragon
|
||||
Categories=Finance;Network;
|
||||
Terminal=false
|
||||
@@ -350,14 +363,14 @@ SVG
|
||||
cp "$APPDIR/ObsidianDragon.svg" "$APPDIR/ObsidianDragon.png" 2>/dev/null || true
|
||||
|
||||
# AppRun
|
||||
cat > "$APPDIR/AppRun" <<'APPRUN'
|
||||
cat > "$APPDIR/AppRun" <<APPRUN
|
||||
#!/bin/bash
|
||||
SELF=$(readlink -f "$0")
|
||||
HERE=${SELF%/*}
|
||||
export DRAGONX_RES_PATH="${HERE}/usr/share/ObsidianDragon/res"
|
||||
export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}"
|
||||
cd "${HERE}/usr/share/ObsidianDragon"
|
||||
exec "${HERE}/usr/bin/ObsidianDragon" "$@"
|
||||
SELF=\$(readlink -f "\$0")
|
||||
HERE=\${SELF%/*}
|
||||
export DRAGONX_RES_PATH="\${HERE}/usr/share/ObsidianDragon/res"
|
||||
export LD_LIBRARY_PATH="\${HERE}/usr/lib:\${LD_LIBRARY_PATH}"
|
||||
cd "\${HERE}/usr/share/ObsidianDragon"
|
||||
exec "\${HERE}/usr/bin/${APP_BASENAME}" "\$@"
|
||||
APPRUN
|
||||
chmod +x "$APPDIR/AppRun"
|
||||
|
||||
@@ -386,9 +399,9 @@ APPRUN
|
||||
local ARCH
|
||||
ARCH=$(uname -m)
|
||||
cd "$bd"
|
||||
ARCH="$ARCH" "$APPIMAGETOOL" "$APPDIR" "ObsidianDragon-${VERSION}-${ARCH}.AppImage" 2>/dev/null && {
|
||||
cp "ObsidianDragon-${VERSION}-${ARCH}.AppImage" "$out/ObsidianDragon-${VERSION}.AppImage"
|
||||
info "AppImage: $out/ObsidianDragon-${VERSION}.AppImage ($(du -h "$out/ObsidianDragon-${VERSION}.AppImage" | cut -f1))"
|
||||
ARCH="$ARCH" "$APPIMAGETOOL" "$APPDIR" "${APP_BASENAME}-${VERSION}-${ARCH}.AppImage" 2>/dev/null && {
|
||||
cp "${APP_BASENAME}-${VERSION}-${ARCH}.AppImage" "$out/${APP_BASENAME}-${VERSION}.AppImage"
|
||||
info "AppImage: $out/${APP_BASENAME}-${VERSION}.AppImage ($(du -h "$out/${APP_BASENAME}-${VERSION}.AppImage" | cut -f1))"
|
||||
} || warn "AppImage creation failed — binaries zip still in release/linux/"
|
||||
|
||||
info "Linux release artifacts: $out/"
|
||||
@@ -599,22 +612,23 @@ HDR
|
||||
cmake "$SCRIPT_DIR" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$bd/mingw-toolchain.cmake" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=OFF
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=OFF \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
|
||||
info "Building with $JOBS jobs ..."
|
||||
cmake --build . -j "$JOBS"
|
||||
|
||||
[[ -f "bin/ObsidianDragon.exe" ]] || { err "Windows build failed"; exit 1; }
|
||||
info "Binary: $(du -h bin/ObsidianDragon.exe | cut -f1)"
|
||||
[[ -f "bin/${APP_BASENAME}.exe" ]] || { err "Windows build failed"; exit 1; }
|
||||
info "Binary: $(du -h "bin/${APP_BASENAME}.exe" | cut -f1)"
|
||||
|
||||
# ── Package: release/windows/ ────────────────────────────────────────────
|
||||
rm -rf "$out"
|
||||
mkdir -p "$out"
|
||||
|
||||
local DIST="ObsidianDragon-${VERSION}-Windows-x64"
|
||||
local DIST="${APP_BASENAME}-${VERSION}-Windows-x64"
|
||||
local dist_dir="$out/$DIST"
|
||||
mkdir -p "$dist_dir"
|
||||
cp bin/ObsidianDragon.exe "$dist_dir/"
|
||||
cp "bin/${APP_BASENAME}.exe" "$dist_dir/"
|
||||
|
||||
local DD="$SCRIPT_DIR/prebuilt-binaries/dragonxd-win"
|
||||
for f in dragonxd.exe dragonx-cli.exe dragonx-tx.exe; do
|
||||
@@ -635,8 +649,8 @@ HDR
|
||||
cp -r bin/res "$dist_dir/" 2>/dev/null || true
|
||||
|
||||
# ── Single-file exe (all resources embedded) ────────────────────────────
|
||||
cp bin/ObsidianDragon.exe "$out/ObsidianDragon-${VERSION}.exe"
|
||||
info "Single-file exe: $out/ObsidianDragon-${VERSION}.exe ($(du -h "$out/ObsidianDragon-${VERSION}.exe" | cut -f1))"
|
||||
cp "bin/${APP_BASENAME}.exe" "$out/${APP_BASENAME}-${VERSION}.exe"
|
||||
info "Single-file exe: $out/${APP_BASENAME}-${VERSION}.exe ($(du -h "$out/${APP_BASENAME}-${VERSION}.exe" | cut -f1))"
|
||||
|
||||
# ── Zip ──────────────────────────────────────────────────────────────────
|
||||
if command -v zip &>/dev/null; then
|
||||
@@ -818,7 +832,8 @@ TOOLCHAIN
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=OFF \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
${COMPILER_RT:+-DOSXCROSS_COMPILER_RT="$COMPILER_RT"}
|
||||
${COMPILER_RT:+-DOSXCROSS_COMPILER_RT="$COMPILER_RT"} \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
else
|
||||
# Build libsodium as universal if needed
|
||||
local need_sodium=false
|
||||
@@ -844,39 +859,40 @@ TOOLCHAIN
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" \
|
||||
-DDRAGONX_USE_SYSTEM_SDL3=OFF \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
"${CMAKE_LITE_ARGS[@]}"
|
||||
fi
|
||||
|
||||
info "Building with $JOBS jobs ..."
|
||||
cmake --build . -j "$JOBS"
|
||||
|
||||
[[ -f "bin/ObsidianDragon" ]] || { err "macOS build failed"; exit 1; }
|
||||
[[ -f "bin/${APP_BASENAME}" ]] || { err "macOS build failed"; exit 1; }
|
||||
|
||||
# Strip — use osxcross strip for cross-builds
|
||||
if $IS_CROSS; then
|
||||
local STRIP_CMD="${OSXCROSS}/target/bin/${OSXCROSS_TRIPLE}-strip"
|
||||
if [[ -x "$STRIP_CMD" ]]; then
|
||||
info "Stripping (osxcross) ..."
|
||||
"$STRIP_CMD" bin/ObsidianDragon
|
||||
"$STRIP_CMD" "bin/${APP_BASENAME}"
|
||||
else
|
||||
warn "osxcross strip not found at $STRIP_CMD — skipping"
|
||||
fi
|
||||
else
|
||||
info "Stripping ..."
|
||||
strip bin/ObsidianDragon
|
||||
strip "bin/${APP_BASENAME}"
|
||||
# Verify universal binary
|
||||
if command -v lipo &>/dev/null; then
|
||||
info "Architecture info:"
|
||||
lipo -info bin/ObsidianDragon
|
||||
lipo -info "bin/${APP_BASENAME}"
|
||||
fi
|
||||
fi
|
||||
info "Binary: $(du -h bin/ObsidianDragon | cut -f1)"
|
||||
info "Binary: $(du -h "bin/${APP_BASENAME}" | cut -f1)"
|
||||
|
||||
# ── Create .app bundle ───────────────────────────────────────────────────
|
||||
rm -rf "$out"
|
||||
mkdir -p "$out"
|
||||
|
||||
local APP="$out/ObsidianDragon.app"
|
||||
local APP="$out/${APP_BASENAME}.app"
|
||||
local CONTENTS="$APP/Contents"
|
||||
local MACOS="$CONTENTS/MacOS"
|
||||
local RESOURCES="$CONTENTS/Resources"
|
||||
@@ -885,8 +901,8 @@ TOOLCHAIN
|
||||
mkdir -p "$MACOS" "$RESOURCES/res" "$FRAMEWORKS"
|
||||
|
||||
# Main binary
|
||||
cp bin/ObsidianDragon "$MACOS/"
|
||||
chmod +x "$MACOS/ObsidianDragon"
|
||||
cp "bin/${APP_BASENAME}" "$MACOS/"
|
||||
chmod +x "$MACOS/${APP_BASENAME}"
|
||||
|
||||
# Resources
|
||||
cp -r bin/res/* "$RESOURCES/res/" 2>/dev/null || true
|
||||
@@ -1053,9 +1069,9 @@ PLIST
|
||||
info ".app bundle created: $APP"
|
||||
|
||||
# ── Zip the .app bundle ──────────────────────────────────────────────────
|
||||
local APP_ZIP="ObsidianDragon-${VERSION}-macOS-${MAC_ARCH}.app.zip"
|
||||
local APP_ZIP="${APP_BASENAME}-${VERSION}-macOS-${MAC_ARCH}.app.zip"
|
||||
if command -v zip &>/dev/null; then
|
||||
(cd "$out" && zip -r "$APP_ZIP" "ObsidianDragon.app")
|
||||
(cd "$out" && zip -r "$APP_ZIP" "${APP_BASENAME}.app")
|
||||
info "App zip: $out/$APP_ZIP ($(du -h "$out/$APP_ZIP" | cut -f1))"
|
||||
fi
|
||||
|
||||
@@ -1071,7 +1087,7 @@ PLIST
|
||||
--window-pos 200 120 \
|
||||
--window-size 600 400 \
|
||||
--icon-size 100 \
|
||||
--icon "ObsidianDragon.app" 150 190 \
|
||||
--icon "${APP_BASENAME}.app" 150 190 \
|
||||
--app-drop-link 450 190 \
|
||||
--no-internet-enable \
|
||||
"$out/$DMG_NAME" \
|
||||
|
||||
Reference in New Issue
Block a user