From cbc7b13dbcba6e0aef31c33d6225fdb6dea0bdee Mon Sep 17 00:00:00 2001 From: root Date: Wed, 29 Apr 2026 10:47:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=81=A2=E5=A4=8D=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=9E=84=E5=BB=BA=E8=84=9A=E6=9C=AC(=E4=BD=BF?= =?UTF-8?q?=E7=94=A8.spec);=20.spec=E6=B7=BB=E5=8A=A0=E5=9B=BE=E6=A0=87;?= =?UTF-8?q?=20=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/build_appimage.sh | 65 +++++++++++++++++++++++++++++++++++++++++ build/build_linux.sh | 37 +++++++++++++++++++++++ build/build_macos.sh | 38 ++++++++++++++++++++++++ build/build_windows.bat | 35 ++++++++++++++++++++++ build/trulymem.spec | 1 + 5 files changed, 176 insertions(+) create mode 100755 build/build_appimage.sh create mode 100755 build/build_linux.sh create mode 100755 build/build_macos.sh create mode 100644 build/build_windows.bat diff --git a/build/build_appimage.sh b/build/build_appimage.sh new file mode 100755 index 0000000..7414fd8 --- /dev/null +++ b/build/build_appimage.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -e + +echo "===== Building TrulyMEM AppImage =====" + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +cd "$PROJECT_ROOT" +echo "Project root: $PROJECT_ROOT" + +APP_NAME="TrulyMEM" +APP_DIR="$PROJECT_ROOT/build/appimage-build" + +echo "Cleaning..." +rm -rf "$APP_DIR" dist/ build/trulymem/ 2>/dev/null || true + +# Step 1: Build with PyInstaller (uses icon from .spec) +echo "Step 1: PyInstaller build..." +python3 -m PyInstaller --clean build/trulymem.spec --noconfirm + +# Step 2: Prepare AppDir structure +echo "Step 2: Preparing AppDir..." +mkdir -p "$APP_DIR/usr/bin" +mkdir -p "$APP_DIR/usr/share/applications" +mkdir -p "$APP_DIR/usr/share/icons/hicolor/256x256/apps" + +cp "dist/$APP_NAME" "$APP_DIR/usr/bin/" +if [ -f "pic/image.png" ]; then + cp "pic/image.png" "$APP_DIR/usr/share/icons/hicolor/256x256/apps/${APP_NAME}.png" + cp "pic/image.png" "$APP_DIR/${APP_NAME}.png" +else + echo -n "" > "$APP_DIR/${APP_NAME}.png" +fi + +cat > "$APP_DIR/${APP_NAME}.desktop" < "$APP_DIR/AppRun" <<'APPRUN' +#!/bin/bash +HERE="$(dirname "$(readlink -f "$0")")" +exec "$HERE/usr/bin/TrulyMEM" "$@" +APPRUN +chmod +x "$APP_DIR/AppRun" + +# Step 3: Build AppImage (requires appimagetool) +echo "Step 3: Building AppImage..." +if command -v appimagetool &> /dev/null; then + appimagetool "$APP_DIR" "dist/${APP_NAME}.AppImage" + echo "AppImage: dist/${APP_NAME}.AppImage" + ls -la "dist/${APP_NAME}.AppImage" +else + echo "appimagetool not found. AppDir ready at: $APP_DIR" + echo "Install appimagetool and run: appimagetool '$APP_DIR' 'dist/${APP_NAME}.AppImage'" +fi + +echo "===== AppImage Build Complete =====" \ No newline at end of file diff --git a/build/build_linux.sh b/build/build_linux.sh new file mode 100755 index 0000000..86e035a --- /dev/null +++ b/build/build_linux.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -e + +echo "===== Building TrulyMEM for Linux =====" + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +cd "$PROJECT_ROOT" +echo "Project root: $PROJECT_ROOT" + +if ! command -v python3 &> /dev/null; then + echo "Error: python3 not found"; exit 1 +fi + +VENV_DIR="$PROJECT_ROOT/.venv_build" +echo "Creating virtual environment: $VENV_DIR" +python3 -m venv "$VENV_DIR" +source "$VENV_DIR/bin/activate" +pip install --upgrade pip +pip install -r requirements.txt + +echo "Cleaning previous builds..." +rm -rf dist/ build/trulymem/ 2>/dev/null || true + +echo "================================" +echo "Building TrulyMEM (TUI + Web embedded)" +echo "================================" +python -m PyInstaller --clean build/trulymem.spec --noconfirm + +echo "================================" +echo "===== Build Complete =====" +echo "Binary: dist/TrulyMEM" +ls -la dist/ + +deactivate +rm -rf "$VENV_DIR" +echo "Build finished successfully!" \ No newline at end of file diff --git a/build/build_macos.sh b/build/build_macos.sh new file mode 100755 index 0000000..a1640fd --- /dev/null +++ b/build/build_macos.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +echo "===== Building TrulyMEM for macOS =====" + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +cd "$PROJECT_ROOT" +echo "Project root: $PROJECT_ROOT" + +if ! command -v python3 &> /dev/null; then + echo "Error: python3 not found"; exit 1 +fi + +VENV_DIR="$PROJECT_ROOT/.venv_build" +echo "Creating virtual environment: $VENV_DIR" +python3 -m venv "$VENV_DIR" +source "$VENV_DIR/bin/activate" +pip install --upgrade pip +pip install -r requirements.txt + +echo "Cleaning previous builds..." +rm -rf dist/ build/trulymem/ 2>/dev/null || true + +echo "================================" +echo "Building TrulyMEM (TUI + Web embedded)" +echo "================================" +python -m PyInstaller --clean build/trulymem.spec --noconfirm + +echo "================================" +echo "===== Build Complete =====" +echo "Binary: dist/TrulyMEM" +echo " -> run: open dist/TrulyMEM" +ls -la dist/ + +deactivate +rm -rf "$VENV_DIR" +echo "Build finished successfully!" \ No newline at end of file diff --git a/build/build_windows.bat b/build/build_windows.bat new file mode 100644 index 0000000..fa7b470 --- /dev/null +++ b/build/build_windows.bat @@ -0,0 +1,35 @@ +@echo off +setlocal enabledelayedexpansion + +echo ===== Building TrulyMEM for Windows ===== + +set "SCRIPT_DIR=%~dp0" +set "PROJECT_ROOT=%SCRIPT_DIR%.." +cd /d "%PROJECT_ROOT%" +echo Project root: %PROJECT_ROOT% + +echo Creating virtual environment: .venv_build +python -m venv .venv_build +call .venv_build\Scripts\activate.bat +pip install --upgrade pip +pip install -r requirements.txt + +echo Cleaning previous builds... +if exist dist rmdir /s /q dist +if exist build\trulymem rmdir /s /q build\trulymem + +echo ================================ +echo Building TrulyMEM (TUI + Web embedded) +echo ================================ +python -m PyInstaller --clean build\trulymem.spec --noconfirm + +echo ================================ +echo ===== Build Complete ===== +echo Binary: dist\TrulyMEM.exe +dir dist + +call .venv_build\Scripts\deactivate.bat +if exist .venv_build rmdir /s /q .venv_build + +echo Build finished successfully! +endlocal \ No newline at end of file diff --git a/build/trulymem.spec b/build/trulymem.spec index 72bc37d..0b7b050 100644 --- a/build/trulymem.spec +++ b/build/trulymem.spec @@ -83,6 +83,7 @@ exe = EXE( a.datas, [], name='TrulyMEM', + icon='pic/TrulyMEM.ico', debug=False, bootloader_ignore_signals=False, strip=False,