Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
柴进
/
GoogleNanoBananaApp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0972ef42
authored
2026-02-27 17:59:32 +0800
by
柴进
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加mac intel芯片的打包逻辑
1 parent
4dae7c18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
build_mac_universal.sh
build_mac_universal.sh
0 → 100644
View file @
0972ef4
#!/bin/bash
# macOS Build Script - Universal (Intel + Apple Silicon)
# 自动检测架构,自动安装依赖
set
-e
# 遇错即停
echo
"================================"
echo
"Building Gemini Image Generator"
echo
"================================"
# 检测架构
ARCH
=
$(
uname -m
)
echo
"Detected architecture:
$ARCH
"
# 设置 Homebrew 路径
if
[
"
$ARCH
"
=
"arm64"
]
;
then
BREW_PREFIX
=
"/opt/homebrew"
else
BREW_PREFIX
=
"/usr/local"
fi
# 检查 Homebrew 是否安装
if
!
command
-v brew &> /dev/null;
then
echo
"Homebrew not found. Installing..."
/bin/bash -c
"
$(
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
)
"
# 添加到当前 shell 的 PATH
eval
"
$(
$BREW_PREFIX
/bin/brew shellenv
)
"
fi
# 确保 brew 在 PATH 中
if
!
command
-v brew &> /dev/null;
then
eval
"
$(
$BREW_PREFIX
/bin/brew shellenv
)
"
fi
# 检查 Python 3.11 是否安装
PYTHON_CMD
=
"
$BREW_PREFIX
/bin/python3.11"
if
[
! -f
"
$PYTHON_CMD
"
]
;
then
echo
"Python 3.11 not found. Installing via Homebrew..."
brew install python@3.11
fi
# 验证 Python 可用
if
[
! -f
"
$PYTHON_CMD
"
]
;
then
echo
"Error: Failed to install Python 3.11"
exit
1
fi
echo
"Using Python:
$PYTHON_CMD
"
$PYTHON_CMD
--version
# 检查虚拟环境是否有效(macOS 用 bin/activate,Windows 用 Scripts/activate)
if
[
! -f
".venv/bin/activate"
]
;
then
echo
"Valid virtual environment not found, creating..."
rm -rf .venv
"
$PYTHON_CMD
"
-m venv .venv
fi
# 激活虚拟环境
echo
"Activating virtual environment..."
source
.venv/bin/activate
# 安装依赖
echo
"Installing dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
# 清理旧构建
echo
"Cleaning previous builds..."
rm -rf build dist
*
.spec
# 构建
echo
"Building executable..."
pyinstaller --name
=
"ZB100ImageGenerator"
\
--onedir
\
--windowed
\
--add-data
"config.json:."
\
--icon
=
zb100_mac.icns
\
image_generator.py
# 验证构建结果
if
[
-d
"dist/ZB100ImageGenerator.app"
]
;
then
echo
"================================"
echo
"Build successful!"
echo
"Architecture:
$ARCH
"
echo
"Application: dist/ZB100ImageGenerator.app"
echo
"================================"
# 显示 app 信息
ls -lh dist/ZB100ImageGenerator.app/Contents/MacOS/
else
echo
"================================"
echo
"Build failed!"
echo
"================================"
exit
1
fi
Please
register
or
sign in
to post a comment