fix: 恢复并更新构建脚本(使用.spec); .spec添加图标; 移除冗余.gitignore
This commit is contained in:
65
build/build_appimage.sh
Executable file
65
build/build_appimage.sh
Executable file
@ -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" <<EOF
|
||||
[Desktop Entry]
|
||||
Name=${APP_NAME}
|
||||
Exec=${APP_NAME}
|
||||
Icon=${APP_NAME}
|
||||
Type=Application
|
||||
Categories=Utility;
|
||||
Terminal=true
|
||||
EOF
|
||||
|
||||
cp "$APP_DIR/${APP_NAME}.desktop" "$APP_DIR/usr/share/applications/"
|
||||
|
||||
cat > "$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 ====="
|
||||
37
build/build_linux.sh
Executable file
37
build/build_linux.sh
Executable file
@ -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!"
|
||||
38
build/build_macos.sh
Executable file
38
build/build_macos.sh
Executable file
@ -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!"
|
||||
35
build/build_windows.bat
Normal file
35
build/build_windows.bat
Normal file
@ -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
|
||||
@ -83,6 +83,7 @@ exe = EXE(
|
||||
a.datas,
|
||||
[],
|
||||
name='TrulyMEM',
|
||||
icon='pic/TrulyMEM.ico',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
|
||||
Reference in New Issue
Block a user