commit a8c22f80f88032dbb8f47e3398972f1f19ecb076
parent 830a545901f5fdddbfa43fa2e7b7df79263a6499
Author: triesap <tyson@radroots.org>
Date: Wed, 29 Apr 2026 22:03:50 +0000
macos: fix app icon and gpui sdk build
Diffstat:
4 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/platforms/macos/App/Resources/AppIconSource.png b/platforms/macos/App/Resources/AppIconSource.png
Binary files differ.
diff --git a/platforms/macos/App/Resources/logo.png b/platforms/macos/App/Resources/logo.png
Binary files differ.
diff --git a/platforms/macos/Scripts/build_host.sh b/platforms/macos/Scripts/build_host.sh
@@ -16,6 +16,41 @@ require_command() {
exit 1
}
+append_env_value() {
+ local var_name="$1"
+ local value="$2"
+ local current="${!var_name:-}"
+
+ if [[ -n "${current}" ]]; then
+ export "${var_name}=${value} ${current}"
+ else
+ export "${var_name}=${value}"
+ fi
+}
+
+prepare_macos_build_env() {
+ local sdk_path
+ local bindgen_args
+
+ sdk_path="$(xcrun --sdk macosx --show-sdk-path)"
+ if [[ -z "${sdk_path}" || ! -d "${sdk_path}" ]]; then
+ echo "unable to resolve macos sdk path via xcrun" >&2
+ exit 1
+ fi
+
+ if [[ ! -f "${sdk_path}/usr/include/dispatch/dispatch.h" ]]; then
+ echo "missing macos dispatch header: ${sdk_path}/usr/include/dispatch/dispatch.h" >&2
+ exit 1
+ fi
+
+ export SDKROOT="${sdk_path}"
+ bindgen_args="--sysroot=${SDKROOT} -I${SDKROOT}/usr/include"
+
+ append_env_value BINDGEN_EXTRA_CLANG_ARGS "${bindgen_args}"
+ append_env_value BINDGEN_EXTRA_CLANG_ARGS_aarch64_apple_darwin "${bindgen_args}"
+ append_env_value BINDGEN_EXTRA_CLANG_ARGS_x86_64_apple_darwin "${bindgen_args}"
+}
+
workspace_version() {
python3 - <<'PY' "${repo_root}/Cargo.toml"
import re
@@ -61,8 +96,10 @@ require_command cargo
require_command git
require_command python3
require_command /usr/libexec/PlistBuddy
+require_command xcrun
configure_build_lane
+prepare_macos_build_env
bundle_root="${platform_root}/.derived-data/Build/Products/${bundle_configuration}/${bundle_name}"
contents_root="${bundle_root}/Contents"
diff --git a/platforms/macos/Scripts/build_icon.sh b/platforms/macos/Scripts/build_icon.sh
@@ -3,7 +3,8 @@ set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
platform_root="$(cd "${script_dir}/.." && pwd -P)"
-source_artwork="${platform_root}/App/Resources/logo.png"
+source_artwork="${platform_root}/App/Resources/AppIconSource.png"
+color_profile="/System/Library/ColorSync/Profiles/sRGB Profile.icc"
output_path="${1:-}"
require_command() {
@@ -27,17 +28,22 @@ if [[ ! -f "${source_artwork}" ]]; then
exit 1
fi
+if [[ ! -f "${color_profile}" ]]; then
+ echo "missing macos icon color profile: ${color_profile}" >&2
+ exit 1
+fi
+
tmp_dir="$(mktemp -d)"
cleanup() {
rm -rf "${tmp_dir}"
}
trap cleanup EXIT
-normalized_png="${tmp_dir}/logo.normalized.png"
+normalized_png="${tmp_dir}/source.normalized.png"
iconset_dir="${tmp_dir}/AppIcon.iconset"
mkdir -p "${iconset_dir}" "$(dirname "${output_path}")"
-sips -s format png "${source_artwork}" --out "${normalized_png}" >/dev/null
+sips -s format png -m "${color_profile}" "${source_artwork}" --out "${normalized_png}" >/dev/null
source_width="$(
sips -g pixelWidth "${normalized_png}" | awk '/pixelWidth/ {print $2}'
@@ -46,10 +52,14 @@ source_height="$(
sips -g pixelHeight "${normalized_png}" | awk '/pixelHeight/ {print $2}'
)"
-if [[ "${source_width}" -lt 1024 || "${source_height}" -lt 1024 ]]; then
- printf '%s\n' \
- "warning: macos icon source is ${source_width}x${source_height}; 1024x1024 is recommended for crisp AppIcon.icns output" \
- >&2
+if [[ "${source_width}" != "${source_height}" ]]; then
+ echo "macos icon source must be square: ${source_width}x${source_height}" >&2
+ exit 1
+fi
+
+if [[ "${source_width}" -lt 1024 ]]; then
+ echo "macos icon source must be at least 1024x1024: ${source_width}x${source_height}" >&2
+ exit 1
fi
generate_icon() {