diff --git a/build-macos-app.sh b/build-macos-app.sh index ca14d63..c6b73cb 100755 --- a/build-macos-app.sh +++ b/build-macos-app.sh @@ -20,7 +20,8 @@ BRIDGE_EXECUTABLE_NAME="LehrerApp.McpBridge" # Name der Bridge-Binary (= Assembl BUNDLE_ID="de.deinname.lehrerapp" # CFBundleIdentifier VERSION="1.0.0" # CFBundleShortVersionString MIN_MACOS="12.0" # LSMinimumSystemVersion -ICON_PNG="icon.png" # Quell-Icon (min. 512x512 oder 1024x1024) +ICON_COMPOSER="NewMac.icon" # App-Symbol aus Icon Composer (braucht Xcode mit actool) +ICON_PNG="icon.png" # Ersatz-Icon, falls actool fehlt (min. 512x512 oder 1024x1024) RUNTIME_IDS=("osx-arm64" "osx-x64") # Architekturen, für die gebaut wird UNIVERSAL_BUILD=true # true = zusätzlich Universal Binary via lipo CODESIGN_ADHOC=true # true = Ad-hoc-Signierung am Ende @@ -92,8 +93,53 @@ place_binary "${BUILD_DIR}/publish" "${EXECUTABLE_NAME}" echo " -> Bridge" place_binary "${BUILD_DIR}/publish-bridge" "${BRIDGE_EXECUTABLE_NAME}" -echo "=== 4/7: Icon konvertieren (.icns) ===" -if [ -f "${ICON_PNG}" ]; then +echo "=== 4/7: App-Symbol erzeugen ===" +ICON_KEY="" +ICON_NAME="$(basename "${ICON_COMPOSER}" .icon)" + +# Übersetzt das Icon-Composer-Dokument mit actool nach Resources: Assets.car (macOS 26+, inkl. +# Dunkel-/Getönt-Varianten) plus ${ICON_NAME}.icns als Darstellung für ältere Systeme. +# actool gibt es nur im vollen Xcode - zeigt xcode-select auf die Command Line Tools, wird +# Xcode.app direkt angesprochen. +compile_composer_icon() { + [ -d "${ICON_COMPOSER}" ] || { echo " -> Kein '${ICON_COMPOSER}' gefunden."; return 1; } + + local dev_dir="${DEVELOPER_DIR:-}" + if ! DEVELOPER_DIR="${dev_dir}" xcrun --find actool > /dev/null 2>&1; then + dev_dir="/Applications/Xcode.app/Contents/Developer" + local find_error + if ! find_error="$(DEVELOPER_DIR="${dev_dir}" xcrun --find actool 2>&1 > /dev/null)"; then + echo " -> actool nicht nutzbar (volles Xcode nötig, Lizenz mit 'sudo xcodebuild -license' bestätigt?):" + echo " ${find_error}" + return 1 + fi + fi + + if ! DEVELOPER_DIR="${dev_dir}" xcrun actool "${ICON_COMPOSER}" \ + --compile "${RESOURCES_DIR}" \ + --app-icon "${ICON_NAME}" \ + --platform macosx \ + --minimum-deployment-target "${MIN_MACOS}" \ + --output-partial-info-plist "${BUILD_DIR}/icon-partial.plist" \ + --output-format human-readable-text; then + echo " -> actool konnte '${ICON_COMPOSER}' nicht übersetzen." + return 1 + fi + + if [ ! -f "${RESOURCES_DIR}/Assets.car" ]; then + echo " -> actool hat keine Assets.car erzeugt." + return 1 + fi +} + +if compile_composer_icon; then + ICON_KEY="CFBundleIconName${ICON_NAME}" + if [ -f "${RESOURCES_DIR}/${ICON_NAME}.icns" ]; then + ICON_KEY="${ICON_KEY}CFBundleIconFile${ICON_NAME}" + fi + echo " -> App-Symbol aus '${ICON_COMPOSER}' erzeugt." +elif [ -f "${ICON_PNG}" ]; then + echo " -> WARNUNG: Ersatzweise wird '${ICON_PNG}' als Icon verwendet." ICONSET_DIR="${BUILD_DIR}/icon.iconset" mkdir -p "${ICONSET_DIR}" @@ -111,8 +157,7 @@ if [ -f "${ICON_PNG}" ]; then iconutil -c icns "${ICONSET_DIR}" -o "${RESOURCES_DIR}/icon.icns" ICON_KEY="CFBundleIconFileicon.icns" else - echo " -> Kein '${ICON_PNG}' gefunden, App-Bundle wird ohne Icon erstellt." - ICON_KEY="" + echo " -> WARNUNG: Kein '${ICON_PNG}' gefunden, App-Bundle wird ohne Icon erstellt." fi echo "=== 5/7: Info.plist schreiben ===" diff --git a/icon.png b/icon.png index b4be217..39dd317 100644 Binary files a/icon.png and b/icon.png differ