Closes the remaining artifact rows of the final audit (docs/rewrite/notes/final-Z4.md): - webgen: config.mdx, actions.mdx, commands.mdx (byte-identical to Zig's webgen output once its missing stdout flush is added) - `just install-lib`: libghostty (+ ghostty.h, modulemap) and libghostty-vt with versioned symlinks, headers and libghostty-vt.pc - scripts/xcframework.sh: per-arch builds, lipo and xcodebuild -create-xcframework for GhosttyKit (dry-run verified only) - `just install` builds --profile production so the installed app id is com.mitchellh.ghostty; other profiles install the -debug id/name - `just update-translations`: xgettext/msgmerge pipeline; extracted msgids equal upstream's .pot (found and fixed an untranslated string in the child-exited banner) - `just dist` / `distcheck`: versioned source tarball with VERSION and a prebuilt GTK resource bundle - Windows: icon, version resource and DPI/common-controls manifest embedded via embed-resource, GUI subsystem Test Plan: - just install-lib /tmp/p release all && pkg-config --cflags \ --libs /tmp/p/share/pkgconfig/libghostty-vt.pc - just distcheck
84 lines
2.7 KiB
Bash
Executable File
84 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build GhosttyKit.xcframework (macOS only; mirrors build/GhosttyLib.zig
|
|
# `initMacOSUniversal`/`initStatic`, build/GhosttyXCFramework.zig,
|
|
# build/LipoStep.zig and build/XCFrameworkStep.zig).
|
|
#
|
|
# Usage: scripts/xcframework.sh [universal|native] [PROFILE] [OUT]
|
|
# universal (default) a universal (arm64 + x86_64, via lipo) macOS static
|
|
# library, an iOS device library and an iOS simulator library.
|
|
# native only the static library for the host macOS architecture.
|
|
# PROFILE cargo profile (default production)
|
|
# OUT output path (default macos/GhosttyKit.xcframework, like Zig)
|
|
#
|
|
# Each slice is `libghostty.a` (the Rust staticlib already bundles every
|
|
# dependency, so there is no libtool step) plus the `include/` directory with
|
|
# ghostty.h and module.modulemap. Static libraries have no dSYM.
|
|
#
|
|
# DRY_RUN=1 prints the commands instead of running them (usable on any host).
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
target=${1:-universal}
|
|
profile=${2:-production}
|
|
out=${3:-macos/GhosttyKit.xcframework}
|
|
dir=$profile
|
|
[ "$profile" = dev ] && dir=debug
|
|
tdir=${CARGO_TARGET_DIR:-target}
|
|
|
|
# Config.zig osVersionMin: macOS 13, iOS 17.
|
|
export MACOSX_DEPLOYMENT_TARGET=13.0
|
|
export IPHONEOS_DEPLOYMENT_TARGET=17.0
|
|
|
|
run() {
|
|
if [ "${DRY_RUN:-}" = 1 ]; then
|
|
printf '+'
|
|
printf ' %q' "$@"
|
|
printf '\n'
|
|
else
|
|
"$@"
|
|
fi
|
|
}
|
|
|
|
# Build only the static library for a Rust target triple (the crate also
|
|
# declares a cdylib, which needs no linking for the xcframework).
|
|
build() {
|
|
run cargo rustc --profile "$profile" -p ghostty-lib --lib --crate-type staticlib --target "$1"
|
|
}
|
|
lib() { echo "$tdir/$1/$dir/libghostty.a"; }
|
|
|
|
host_arch=$(uname -m)
|
|
case $host_arch in
|
|
arm64 | aarch64) native=aarch64-apple-darwin ;;
|
|
*) native=x86_64-apple-darwin ;;
|
|
esac
|
|
|
|
args=()
|
|
case $target in
|
|
universal)
|
|
build aarch64-apple-darwin
|
|
build x86_64-apple-darwin
|
|
build aarch64-apple-ios
|
|
build aarch64-apple-ios-sim
|
|
|
|
universal_dir="$tdir/universal-apple-darwin/$dir"
|
|
run mkdir -p "$universal_dir"
|
|
run lipo -create -output "$universal_dir/libghostty.a" \
|
|
"$(lib aarch64-apple-darwin)" "$(lib x86_64-apple-darwin)"
|
|
args+=(-library "$universal_dir/libghostty.a" -headers crates/ghostty-lib/include)
|
|
args+=(-library "$(lib aarch64-apple-ios)" -headers crates/ghostty-lib/include)
|
|
args+=(-library "$(lib aarch64-apple-ios-sim)" -headers crates/ghostty-lib/include)
|
|
;;
|
|
native)
|
|
build "$native"
|
|
args+=(-library "$(lib "$native")" -headers crates/ghostty-lib/include)
|
|
;;
|
|
*)
|
|
echo "usage: $0 [universal|native] [PROFILE] [OUT]" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
# The output path is static, so delete the old framework first.
|
|
run rm -rf "$out"
|
|
run xcodebuild -create-xcframework "${args[@]}" -output "$out"
|