macos dialog fix; macos merge logs
This commit is contained in:
parent
533420b516
commit
55affaf78f
9
macos.py
9
macos.py
|
|
@ -372,17 +372,14 @@ def _osascript_input(prompt: str, default: str,
|
||||||
title_esc = title.replace('\\', '\\\\').replace('"', '\\"')
|
title_esc = title.replace('\\', '\\\\').replace('"', '\\"')
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
['osascript', '-e',
|
['osascript', '-e',
|
||||||
f'display dialog "{prompt_esc}" '
|
f'text returned of (display dialog "{prompt_esc}" '
|
||||||
f'default answer "{default_esc}" '
|
f'default answer "{default_esc}" '
|
||||||
f'with title "{title_esc}" '
|
f'with title "{title_esc}" '
|
||||||
f'buttons {{"Отмена", "OK"}} default button "OK"'],
|
f'buttons {{"Отмена", "OK"}} default button "OK")'],
|
||||||
capture_output=True, text=True)
|
capture_output=True, text=True)
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
return None
|
return None
|
||||||
for part in r.stdout.strip().split(', '):
|
return r.stdout.rstrip("\r\n")
|
||||||
if part.startswith('text returned:'):
|
|
||||||
return part[len('text returned:'):]
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def _on_edit_config(_=None):
|
def _on_edit_config(_=None):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Merge arm64 and x86_64 .app bundles into a universal2 .app and create DMG
|
# Merge arm64 and x86_64 .app bundles into a universal2 .app and create DMG
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
|
trap 'echo "merge_universal2.sh failed at line $LINENO" >&2' ERR
|
||||||
|
|
||||||
ARM_APP="$1"
|
ARM_APP="$1"
|
||||||
INTEL_APP="$2"
|
INTEL_APP="$2"
|
||||||
|
|
@ -17,6 +19,42 @@ DIST_DIR="$PROJECT_DIR/dist"
|
||||||
APP_NAME="$(basename "$OUT_APP" .app)"
|
APP_NAME="$(basename "$OUT_APP" .app)"
|
||||||
DMG_NAME="TgWsProxy"
|
DMG_NAME="TgWsProxy"
|
||||||
|
|
||||||
|
echo "Starting universal2 merge"
|
||||||
|
echo "ARM_APP=$ARM_APP"
|
||||||
|
echo "INTEL_APP=$INTEL_APP"
|
||||||
|
echo "OUT_APP=$OUT_APP"
|
||||||
|
echo "DIST_DIR=$DIST_DIR"
|
||||||
|
|
||||||
|
if [ ! -d "$ARM_APP" ]; then
|
||||||
|
echo "ARM app bundle not found: $ARM_APP" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$INTEL_APP" ]; then
|
||||||
|
echo "Intel app bundle not found: $INTEL_APP" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
has_arch() {
|
||||||
|
local arches="$1"
|
||||||
|
local target="$2"
|
||||||
|
for arch in $arches; do
|
||||||
|
if [ "$arch" = "$target" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
is_subset() {
|
||||||
|
local subset="$1"
|
||||||
|
local superset="$2"
|
||||||
|
for arch in $subset; do
|
||||||
|
has_arch "$superset" "$arch" || return 1
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# --- Merge ---
|
# --- Merge ---
|
||||||
|
|
||||||
echo "Merging '$ARM_APP' + '$INTEL_APP' -> '$OUT_APP'"
|
echo "Merging '$ARM_APP' + '$INTEL_APP' -> '$OUT_APP'"
|
||||||
|
|
@ -33,11 +71,25 @@ find "$OUT_APP" -type f | while read -r file; do
|
||||||
if file "$file" | grep -qE "Mach-O (64-bit )?executable|Mach-O (64-bit )?dynamically linked|Mach-O (64-bit )?bundle"; then
|
if file "$file" | grep -qE "Mach-O (64-bit )?executable|Mach-O (64-bit )?dynamically linked|Mach-O (64-bit )?bundle"; then
|
||||||
arm_arch=$(lipo -archs "$file" 2>/dev/null || echo "")
|
arm_arch=$(lipo -archs "$file" 2>/dev/null || echo "")
|
||||||
intel_arch=$(lipo -archs "$intel_file" 2>/dev/null || echo "")
|
intel_arch=$(lipo -archs "$intel_file" 2>/dev/null || echo "")
|
||||||
if [ "$arm_arch" = "$intel_arch" ]; then
|
echo "Processing Mach-O: $rel"
|
||||||
# same arch (e.g. local test with two arm64 copies) — skip
|
echo " arm_arch=$arm_arch"
|
||||||
|
echo " intel_arch=$intel_arch"
|
||||||
|
if [ -z "$arm_arch" ] || [ -z "$intel_arch" ]; then
|
||||||
|
echo " action=skip (unable to determine architecture)"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
if is_subset "$intel_arch" "$arm_arch"; then
|
||||||
|
echo " action=skip (arm binary already contains intel slices)"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if is_subset "$arm_arch" "$intel_arch"; then
|
||||||
|
echo " action=copy-intel (intel binary is a superset)"
|
||||||
|
cp "$intel_file" "$file"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo " action=lipo-create"
|
||||||
lipo -create "$file" "$intel_file" -output "$file"
|
lipo -create "$file" "$intel_file" -output "$file"
|
||||||
|
echo " merged_arch=$(lipo -archs "$file" 2>/dev/null || echo "")"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue