mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
b232114422
Audits every comment in `src/` and `scripts/` against the code it
describes.
**462 files, 57 commits, net −8,194 lines.** Comment text only — the
whole branch is code-identical to `main`.
## Method
One subagent per file, strictly sequential. Scope was `src/` +
`scripts/` (459 files); three more files were added at the end because
they carried dead references of the same kind — two test headers citing
design docs that do not exist, and `publish-npm.yml` citing a retired
workflow. Each agent verified every comment — line, block, JSDoc, file
header, trailing — against the surrounding code and the rest of the
repo, following identifiers, paths, tool ids, config keys, env vars and
issue links to see whether they still exist and still behave as
described. Rules:
- **A false or misleading comment is deleted, not reworded.** If a claim
could not be confirmed by reading the source, it went. That is why the
deletion count is so much larger than the rewrite count.
- Survivors are cut to the shortest form carrying something the code
does not already say. Restatement, preamble, hedging, changelog prose
and ASCII banners are gone; the non-obvious *why* stays.
- Preserved byte-identical: license headers, pragmas and directives
(`@ts-*`, `eslint-disable`, shebangs, `/// <reference>`), JSDoc tag
tokens, everything inside a string or template literal, and the sole
comment inside an otherwise empty block (ESLint `no-empty` counts a
comment-bearing block as non-empty).
## Verification
Every file passed two independent gates before being recorded as done:
1. `comments-only` — the required check.
2. A second comment-stripping comparator with a proper mode stack,
written for this pass because `comments-only`'s flat scanner desyncs on
nested template literals and quote-bearing regex literals and then
reports comment lines as code changes. Two files hit that false FAIL
(`utils/android-profiler/pipeline/index.ts`,
`scripts/extract-tools.mjs`); in both the "changed code" it printed was
literally `//` lines, and the second checker confirmed the code was
byte-identical.
After the last file, all 462 changed files were re-checked against
`main` with the same comparator, rather than trusting any agent's
self-report. **459 code-identical; 2 are non-code (`.svg`, `.md`); 1
intentional.**
The intentional one is `packages/argent/scripts/bundle-tools.cjs`: the
changed template literal *is* the comment header of the file it
generates, `packages/native-devtools-android/src/bundled-meta.ts`.
Fixing only the generated file would have been reverted by the next
build, so the generator changed too — and it has been verified to
reproduce the committed generated file byte-for-byte.
## Representative false claims removed
Not wording nits — statements a reader would have acted on:
- **Reversed directions.** `proxyStart`'s JSDoc had the tunnel backwards
(it is a reverse tunnel: the host binds first and the simulator dials
in). A `paste()` doc had the pasteboard copy direction reversed.
- **Contradicted by the code below it.** A timeout budget multiplied by
three where the probes run concurrently — the same comment said so six
lines later. A "warn once" that warns on every call. A "binary search"
that is a linear scan.
- **Named things that do not exist.** A `vega-fast-cli` binary, a
`finish-recording.ts`, a `publish-next.yml` workflow, two
`profiler-react19-*.md` design docs, a `DebuggerTarget.ts`, a commit
hash git does not know, two tool ids, an `ensureEnv` cycle.
- **Wrong by construction.** "Welford accumulators" across four files
where the code keeps naive `n`/`sum`/`sumSq`; `sum`/`sumSq` documented
over `actualDuration` when reduce sums `selfDuration`; a strict-mode
halving written `n/2` where the code ceils; field docs listing enum
values the producers never emit.
- **Guarantees the code does not make.** A validation matrix claiming to
cover "EVERY tool" that skips flagless ones; a Pareto cutoff that
`slice(0, 20)` makes inert; an idempotence claim where the real rule is
at-or-ahead; a capability note describing a clean 400 the shape-based
device resolver can never produce.
- **Unverifiable assertions** about prebuilt binaries, external CLIs and
the cloud SDK — deleted rather than kept as folklore, since nothing in
the repo can confirm them.
- **Stale numbers**: invented Android tool versions, hard-coded tool
counts and description lengths that had drifted.
## Review
A Fable agent reviewed both halves adversarially for over-deletion,
misread code, `no-empty` hazards and byte-identity violations.
Second-half verdict: **SHIP**, with two one-line restores, both applied
in the final commit — the `npm view ""` rationale behind a blank-token
guard, and the note that `argent-mcp` keeps a copy of
`SECRET_PLACEHOLDER_MARKER` it cannot import.
## Code issues surfaced but deliberately not fixed
This pass changes comments only. Eight genuine findings are logged for a
follow-up:
1. `telemetry/src/consent.ts` — a non-ENOENT read error returns null and
falls through to the default-on path, so file errors *can* silently flip
telemetry on.
2. `chromium-server/navigation.ts` — `navigate()` is reachable from
`POST /api/navigate` with only a `typeof === "string"` check; open-url's
schema is a bare `z.string()`, so the "already validated by zod" premise
never held.
3. `http.ts` — `constantTimeEqual` returns early on a length mismatch,
so the auth token's length is observable.
4. `describe/index.ts:~114` — the ios-remote branch passes `{ isTvOs:
false }` unconditionally, so a remote tvOS simulator takes the iOS
ax-service path, though `isRemoteTvOsSimulator` exists and shake/paste
do use it.
5. `devices/boot-device.ts` — `-crash-report-mode never` is passed
unconditionally *and* appended again by the feature-detecting path, so
every emulator spawn passes it twice.
6. `react-profiler/pipeline/04-rank.ts` — `PARETO_THRESHOLD_PCT` is
dead: `slice(0, 20)` always wins.
7. `reaped-sessions.ts` — a user-facing hint string tells the agent that
`react-profiler-start { force: true }` disposes the debugger and
profiler session; it does not. Left byte-identical because it is a
string literal, not a comment.
8. `utils/simctl-backend.ts` — `localSimctl` is exported with no
importers anywhere.
## Docs
No documentation change is needed: this pass touches only source
comments, and no user-facing capability, tool, CLI flag, config key or
flow-file behaviour changed.
---------
Co-authored-by: filip131311 <f.kaminski2000@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
350 lines
13 KiB
Bash
350 lines
13 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Build native-devtools-ios dylibs for Argent.
|
|
# ObjC source lives in the argent-private submodule at packages/argent-private.
|
|
#
|
|
# Usage: build.sh [dev|release] [--transport unix|tcp]
|
|
# mode: dev (fast) or release (optimized, optional signing). Default: release.
|
|
# --transport: unix (default) builds against AF_UNIX sockets at /tmp/*.sock paths;
|
|
# tcp builds with -DARGENT_USE_TCP=1 so the dylib/daemon use AF_INET
|
|
# on 127.0.0.1 with a port, into dylibs/tcp/ and bin/tcp/ so both
|
|
# variants can coexist.
|
|
#
|
|
# Environment:
|
|
# PREBUILT_NATIVE_DEVTOOLS_IOS - if set, copy this path to dylibs/ instead of building (CI on non-macOS)
|
|
# PREBUILT_KEYBOARD_PATCH - same for keyboard patch dylib
|
|
# PREBUILT_INJECTION_BOOTSTRAP - same for bootstrap dylib
|
|
# PREBUILT_NATIVE_DEVTOOLS_IOS_TVOS / PREBUILT_KEYBOARD_PATCH_TVOS /
|
|
# PREBUILT_INJECTION_BOOTSTRAP_TVOS - tvOS-slice counterparts, copied to
|
|
# dylibs/tvos/; all three required together on the prebuilt path
|
|
# PREBUILT_TVOS_AX_SERVICE / PREBUILT_TVOS_HID_DAEMON - prebuilt tvOS daemon binaries
|
|
# Release signing: set IDENTITY (or CODESIGN_IDENTITY), or for CI keychain import set
|
|
# CERTIFICATE, PRIVATE_KEY_BASE64, PRIVATE_KEY_PASSWORD, KEYCHAIN_PASSWORD, IDENTITY.
|
|
|
|
set -euo pipefail
|
|
|
|
MODE="release"
|
|
TRANSPORT="unix"
|
|
|
|
while (($#)); do
|
|
case "$1" in
|
|
dev|release)
|
|
MODE="$1"; shift ;;
|
|
--transport)
|
|
TRANSPORT="${2:-}"; shift 2 ;;
|
|
--transport=*)
|
|
TRANSPORT="${1#--transport=}"; shift ;;
|
|
*)
|
|
echo "Usage: build.sh [dev|release] [--transport unix|tcp]" >&2
|
|
exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$TRANSPORT" != "unix" && "$TRANSPORT" != "tcp" ]]; then
|
|
echo "Invalid --transport '$TRANSPORT'. Expected unix or tcp." >&2
|
|
exit 1
|
|
fi
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
WORKSPACE_DIR="$(cd "${ROOT_DIR}/../.." && pwd)"
|
|
SUBMODULE_DIR="${WORKSPACE_DIR}/packages/argent-private/packages/native-devtools-ios"
|
|
SRC_DIR="${SUBMODULE_DIR}/Sources/NativeDevtoolsIos"
|
|
|
|
if [[ "$TRANSPORT" == "tcp" ]]; then
|
|
DEST_DIR="${ROOT_DIR}/dylibs/tcp"
|
|
# Platform-neutral (not bin/darwin/): the tcp ax-service is an iOS-sim binary
|
|
# uploaded from any host to the remote macOS orchestrator. Matches tcpBinDir()
|
|
# in src/index.ts.
|
|
BIN_DIR="${ROOT_DIR}/bin/tcp"
|
|
else
|
|
DEST_DIR="${ROOT_DIR}/dylibs"
|
|
BIN_DIR="${ROOT_DIR}/bin/darwin"
|
|
fi
|
|
|
|
if [[ ! -d "${SRC_DIR}" ]]; then
|
|
echo "Error: ObjC source not found at ${SRC_DIR}" >&2
|
|
echo " Run: git submodule update --init packages/argent-private" >&2
|
|
exit 1
|
|
fi
|
|
|
|
DEST_FILE="${DEST_DIR}/libNativeDevtoolsIos.dylib"
|
|
DEST_FILE_KB="${DEST_DIR}/libKeyboardPatch.dylib"
|
|
DEST_FILE_BS="${DEST_DIR}/libArgentInjectionBootstrap.dylib"
|
|
|
|
if [[ -n "${PREBUILT_NATIVE_DEVTOOLS_IOS:-}" ]] && [[ -n "${PREBUILT_KEYBOARD_PATCH:-}" ]] && [[ -n "${PREBUILT_INJECTION_BOOTSTRAP:-}" ]]; then
|
|
echo "Using pre-built dylibs"
|
|
mkdir -p "$DEST_DIR"
|
|
cp "$PREBUILT_NATIVE_DEVTOOLS_IOS" "$DEST_FILE"
|
|
cp "$PREBUILT_KEYBOARD_PATCH" "$DEST_FILE_KB"
|
|
cp "$PREBUILT_INJECTION_BOOTSTRAP" "$DEST_FILE_BS"
|
|
# tvOS dylibs have no TCP variant, and all three must ship together because
|
|
# InjectionBootstrap dlopen()s the other two from its own directory.
|
|
if [[ "$TRANSPORT" == "unix" \
|
|
&& -n "${PREBUILT_NATIVE_DEVTOOLS_IOS_TVOS:-}" \
|
|
&& -n "${PREBUILT_KEYBOARD_PATCH_TVOS:-}" \
|
|
&& -n "${PREBUILT_INJECTION_BOOTSTRAP_TVOS:-}" ]]; then
|
|
echo "Using pre-built tvOS dylibs"
|
|
mkdir -p "${ROOT_DIR}/dylibs/tvos"
|
|
cp "$PREBUILT_NATIVE_DEVTOOLS_IOS_TVOS" "${ROOT_DIR}/dylibs/tvos/libNativeDevtoolsIos.dylib"
|
|
cp "$PREBUILT_KEYBOARD_PATCH_TVOS" "${ROOT_DIR}/dylibs/tvos/libKeyboardPatch.dylib"
|
|
cp "$PREBUILT_INJECTION_BOOTSTRAP_TVOS" "${ROOT_DIR}/dylibs/tvos/libArgentInjectionBootstrap.dylib"
|
|
fi
|
|
# The tvOS daemons are built below, after this early exit, so the prebuilt
|
|
# (non-macOS CI) route has to copy them here too or tv-control has nothing to
|
|
# spawn. Unix transport only, matching the build path's guard.
|
|
if [[ "$TRANSPORT" == "unix" ]]; then
|
|
if [[ -n "${PREBUILT_TVOS_AX_SERVICE:-}" ]]; then
|
|
echo "Using pre-built tvos-ax-service"
|
|
mkdir -p "$BIN_DIR"
|
|
cp "$PREBUILT_TVOS_AX_SERVICE" "${BIN_DIR}/tvos-ax-service"
|
|
fi
|
|
if [[ -n "${PREBUILT_TVOS_HID_DAEMON:-}" ]]; then
|
|
echo "Using pre-built tvos-hid-daemon"
|
|
mkdir -p "$BIN_DIR"
|
|
cp "$PREBUILT_TVOS_HID_DAEMON" "${BIN_DIR}/tvos-hid-daemon"
|
|
fi
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "$OSTYPE" != "darwin"* ]]; then
|
|
echo "Skipping native-devtools-ios build on non-macOS host ($OSTYPE)"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "$MODE" == "release" && -n "${CERTIFICATE:-}" && -n "${PRIVATE_KEY_BASE64:-}" ]]; then
|
|
KEYCHAIN_PATH="${KEYCHAIN_PATH:-${TMPDIR:-/tmp}/codesign.keychain-db}"
|
|
security create-keychain -p "${KEYCHAIN_PASSWORD:?}" "$KEYCHAIN_PATH"
|
|
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
|
|
security unlock-keychain -p "${KEYCHAIN_PASSWORD:?}" "$KEYCHAIN_PATH"
|
|
CERTIFICATE_PATH="${TMPDIR:-/tmp}/certificate.pem"
|
|
PRIVATE_KEY_PATH="${TMPDIR:-/tmp}/private_key.p12"
|
|
echo -n "$CERTIFICATE" >"$CERTIFICATE_PATH"
|
|
echo -n "$PRIVATE_KEY_BASE64" | base64 --decode -o "$PRIVATE_KEY_PATH"
|
|
security import "$CERTIFICATE_PATH" -A -t cert -f pemseq -k "$KEYCHAIN_PATH"
|
|
security import "$PRIVATE_KEY_PATH" -A -t priv -f pkcs12 -P "${PRIVATE_KEY_PASSWORD:?}" -k "$KEYCHAIN_PATH"
|
|
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
|
|
security list-keychain -d user -s "$KEYCHAIN_PATH"
|
|
export IDENTITY="${IDENTITY:?}"
|
|
fi
|
|
|
|
mkdir -p "$DEST_DIR"
|
|
SDK_PATH="$(xcrun --sdk iphonesimulator --show-sdk-path)"
|
|
|
|
EXTRA_CFLAGS=()
|
|
if [[ "$MODE" == "release" ]]; then
|
|
EXTRA_CFLAGS=(-Os -DNDEBUG)
|
|
fi
|
|
if [[ "$TRANSPORT" == "tcp" ]]; then
|
|
EXTRA_CFLAGS+=(-DARGENT_USE_TCP=1)
|
|
fi
|
|
|
|
echo "Building libNativeDevtoolsIos.dylib..."
|
|
xcrun --sdk iphonesimulator clang \
|
|
-dynamiclib \
|
|
-fobjc-arc \
|
|
-fmodules \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${SDK_PATH}" \
|
|
-mios-simulator-version-min=13.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation \
|
|
-framework UIKit \
|
|
"${SRC_DIR}/InjectionEntry.m" \
|
|
"${SRC_DIR}/DevtoolsConnection.m" \
|
|
"${SRC_DIR}/NetworkInspector.m" \
|
|
"${SRC_DIR}/BodyStreamForwarder.m" \
|
|
"${SRC_DIR}/NativeDevtoolsURLProtocol.m" \
|
|
"${SRC_DIR}/ViewHierarchy/ViewHierarchyUtils.m" \
|
|
"${SRC_DIR}/ViewHierarchy/GetFullHierarchy.m" \
|
|
"${SRC_DIR}/ViewHierarchy/FindViews.m" \
|
|
"${SRC_DIR}/ViewHierarchy/ViewAtPoint.m" \
|
|
"${SRC_DIR}/ViewHierarchy/UserInteractableViewAtPoint.m" \
|
|
"${SRC_DIR}/ViewHierarchy/DescribeScreen.m" \
|
|
-o "${DEST_FILE}"
|
|
|
|
echo "Building libKeyboardPatch.dylib..."
|
|
xcrun --sdk iphonesimulator clang \
|
|
-dynamiclib \
|
|
-fobjc-arc \
|
|
-fmodules \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${SDK_PATH}" \
|
|
-mios-simulator-version-min=13.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation \
|
|
"${SRC_DIR}/KeyboardPatch.m" \
|
|
-o "${DEST_FILE_KB}"
|
|
|
|
echo "Building libArgentInjectionBootstrap.dylib..."
|
|
xcrun --sdk iphonesimulator clang \
|
|
-dynamiclib \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${SDK_PATH}" \
|
|
-mios-simulator-version-min=13.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
"${SRC_DIR}/InjectionBootstrap.c" \
|
|
-o "${DEST_FILE_BS}"
|
|
|
|
echo "Building ax-service..."
|
|
AX_SRC_DIR="${SUBMODULE_DIR}/Sources/AXService"
|
|
AX_DEST="${BIN_DIR}/ax-service"
|
|
mkdir -p "$(dirname "$AX_DEST")"
|
|
|
|
if [[ -n "${PREBUILT_AX_SERVICE:-}" ]]; then
|
|
cp "$PREBUILT_AX_SERVICE" "$AX_DEST"
|
|
else
|
|
xcrun --sdk iphonesimulator clang \
|
|
-fobjc-arc \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${SDK_PATH}" \
|
|
-target arm64-apple-ios17.0-simulator \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation -framework UIKit -framework CoreGraphics \
|
|
-lobjc \
|
|
-o "${AX_DEST}" "${AX_SRC_DIR}/ax_service.m"
|
|
fi
|
|
|
|
# tvOS control binaries + injection dylibs: unix-socket only, no TCP variant.
|
|
# tvos-ax-service runs inside an appletvsimulator; tvos-hid-daemon runs on the
|
|
# macOS host and injects HID via SimulatorKit.
|
|
if [[ "$TRANSPORT" == "unix" ]]; then
|
|
# Same sources as the iOS dylibs, recompiled against the appletvsimulator SDK:
|
|
# dyld silently skips an iOS slice injected into an Apple TV sim, so
|
|
# native-devtools never connects. bootstrapDylibPathTvos() reads dylibs/tvos/
|
|
# regardless of transport, and InjectionBootstrap dlopen()s the other two from
|
|
# its own directory, so all three must ship together.
|
|
TVOS_DYLIB_DIR="${ROOT_DIR}/dylibs/tvos"
|
|
TVOS_DEST_FILE="${TVOS_DYLIB_DIR}/libNativeDevtoolsIos.dylib"
|
|
TVOS_DEST_FILE_KB="${TVOS_DYLIB_DIR}/libKeyboardPatch.dylib"
|
|
TVOS_DEST_FILE_BS="${TVOS_DYLIB_DIR}/libArgentInjectionBootstrap.dylib"
|
|
mkdir -p "$TVOS_DYLIB_DIR"
|
|
TVOS_SDK_PATH="$(xcrun --sdk appletvsimulator --show-sdk-path)"
|
|
|
|
echo "Building libNativeDevtoolsIos.dylib (tvOS)..."
|
|
if [[ -n "${PREBUILT_NATIVE_DEVTOOLS_IOS_TVOS:-}" ]]; then
|
|
cp "$PREBUILT_NATIVE_DEVTOOLS_IOS_TVOS" "$TVOS_DEST_FILE"
|
|
else
|
|
xcrun --sdk appletvsimulator clang \
|
|
-dynamiclib \
|
|
-fobjc-arc \
|
|
-fmodules \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${TVOS_SDK_PATH}" \
|
|
-mtvos-simulator-version-min=17.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation \
|
|
-framework UIKit \
|
|
"${SRC_DIR}/InjectionEntry.m" \
|
|
"${SRC_DIR}/DevtoolsConnection.m" \
|
|
"${SRC_DIR}/NetworkInspector.m" \
|
|
"${SRC_DIR}/BodyStreamForwarder.m" \
|
|
"${SRC_DIR}/NativeDevtoolsURLProtocol.m" \
|
|
"${SRC_DIR}/ViewHierarchy/ViewHierarchyUtils.m" \
|
|
"${SRC_DIR}/ViewHierarchy/GetFullHierarchy.m" \
|
|
"${SRC_DIR}/ViewHierarchy/FindViews.m" \
|
|
"${SRC_DIR}/ViewHierarchy/ViewAtPoint.m" \
|
|
"${SRC_DIR}/ViewHierarchy/UserInteractableViewAtPoint.m" \
|
|
"${SRC_DIR}/ViewHierarchy/DescribeScreen.m" \
|
|
-o "${TVOS_DEST_FILE}"
|
|
fi
|
|
|
|
echo "Building libKeyboardPatch.dylib (tvOS)..."
|
|
if [[ -n "${PREBUILT_KEYBOARD_PATCH_TVOS:-}" ]]; then
|
|
cp "$PREBUILT_KEYBOARD_PATCH_TVOS" "$TVOS_DEST_FILE_KB"
|
|
else
|
|
xcrun --sdk appletvsimulator clang \
|
|
-dynamiclib \
|
|
-fobjc-arc \
|
|
-fmodules \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${TVOS_SDK_PATH}" \
|
|
-mtvos-simulator-version-min=17.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation \
|
|
"${SRC_DIR}/KeyboardPatch.m" \
|
|
-o "${TVOS_DEST_FILE_KB}"
|
|
fi
|
|
|
|
echo "Building libArgentInjectionBootstrap.dylib (tvOS)..."
|
|
if [[ -n "${PREBUILT_INJECTION_BOOTSTRAP_TVOS:-}" ]]; then
|
|
cp "$PREBUILT_INJECTION_BOOTSTRAP_TVOS" "$TVOS_DEST_FILE_BS"
|
|
else
|
|
xcrun --sdk appletvsimulator clang \
|
|
-dynamiclib \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${TVOS_SDK_PATH}" \
|
|
-mtvos-simulator-version-min=17.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
"${SRC_DIR}/InjectionBootstrap.c" \
|
|
-o "${TVOS_DEST_FILE_BS}"
|
|
fi
|
|
|
|
echo "Building tvos-ax-service..."
|
|
TVOS_SRC_DIR="${SUBMODULE_DIR}/Sources/TvosServices"
|
|
TVOS_AX_DEST="${BIN_DIR}/tvos-ax-service"
|
|
TVOS_HID_DEST="${BIN_DIR}/tvos-hid-daemon"
|
|
|
|
if [[ -n "${PREBUILT_TVOS_AX_SERVICE:-}" ]]; then
|
|
cp "$PREBUILT_TVOS_AX_SERVICE" "$TVOS_AX_DEST"
|
|
else
|
|
xcrun --sdk appletvsimulator clang \
|
|
-fobjc-arc \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-isysroot "${TVOS_SDK_PATH}" \
|
|
-target arm64-apple-tvos17.0-simulator \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation -framework UIKit -framework CoreGraphics \
|
|
-lobjc \
|
|
-o "${TVOS_AX_DEST}" "${TVOS_SRC_DIR}/tvos_ax_service.m"
|
|
fi
|
|
|
|
echo "Building tvos-hid-daemon..."
|
|
if [[ -n "${PREBUILT_TVOS_HID_DAEMON:-}" ]]; then
|
|
cp "$PREBUILT_TVOS_HID_DAEMON" "$TVOS_HID_DEST"
|
|
else
|
|
clang \
|
|
-fobjc-arc \
|
|
${EXTRA_CFLAGS[@]+"${EXTRA_CFLAGS[@]}"} \
|
|
-mmacosx-version-min=14.0 \
|
|
-arch arm64 \
|
|
-arch x86_64 \
|
|
-framework Foundation -framework AppKit -framework CoreGraphics \
|
|
-o "${TVOS_HID_DEST}" "${TVOS_SRC_DIR}/tvos_hid_daemon.m"
|
|
fi
|
|
fi
|
|
|
|
if [[ "$MODE" == "release" ]]; then
|
|
IDENTITY="${CODESIGN_IDENTITY:-${IDENTITY:-}}"
|
|
if [[ -n "$IDENTITY" ]]; then
|
|
codesign --force --options runtime --sign "$IDENTITY" "${DEST_FILE}"
|
|
codesign --verify --verbose "${DEST_FILE}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${DEST_FILE_KB}"
|
|
codesign --verify --verbose "${DEST_FILE_KB}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${DEST_FILE_BS}"
|
|
codesign --verify --verbose "${DEST_FILE_BS}"
|
|
if [[ "$TRANSPORT" == "unix" ]]; then
|
|
codesign --force --options runtime --sign "$IDENTITY" "${TVOS_DEST_FILE}"
|
|
codesign --verify --verbose "${TVOS_DEST_FILE}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${TVOS_DEST_FILE_KB}"
|
|
codesign --verify --verbose "${TVOS_DEST_FILE_KB}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${TVOS_DEST_FILE_BS}"
|
|
codesign --verify --verbose "${TVOS_DEST_FILE_BS}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${TVOS_AX_DEST}"
|
|
codesign --verify --verbose "${TVOS_AX_DEST}"
|
|
codesign --force --options runtime --sign "$IDENTITY" "${TVOS_HID_DEST}"
|
|
codesign --verify --verbose "${TVOS_HID_DEST}"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo "Done. Dylibs written to ${DEST_DIR}/ (transport=${TRANSPORT})"
|