GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — shadow/build.sh at master · jjolano/shadow

Expand file tree

/

build.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
192 lines (172 loc) · 8.15 KB
/

build.sh

Copy path

File metadata and controls

executable file
·
192 lines (172 loc) · 8.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/usr/bin/env bash
set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd)
cd "$ROOT"
: "${THEOS:?THEOS must point to Theos}"
# Lane matrix lives in one place; see build-support/lanes.sh.
. "$ROOT/build-support/lanes.sh"
PB=${PREBUILT_ROOT:-$ROOT/../prebuilt}
CONTROL_VAR=_THEOS_DEB_PACKAGE_CONTROL_PATH
STAGE=$(mktemp -d "${TMPDIR:-/tmp}/shadow-build.XXXXXX")
LIBRARY_PATH=$STAGE/lib
INCLUDE_PATH=$STAGE/include
MAKE_PATHS=(
"THEOS_LIBRARY_PATH=$LIBRARY_PATH"
"THEOS_INCLUDE_PATH=$INCLUDE_PATH"
"ADDITIONAL_CFLAGS=-fmodules-cache-path=$STAGE/module-cache"
"ADDITIONAL_OBJCFLAGS=-fmodules-cache-path=$STAGE/module-cache"
)
trap 'rm -rf "$STAGE"' EXIT
rm -rf "$ROOT/build"
mkdir -p "$ROOT/build"
stage_deps() { # rootful-legacy|rootful-modern|rootless|roothide
local profile=$1 scheme= target sdk
scheme=$(shadow_lane_field "$profile" SCHEME 2>/dev/null) || { echo "unknown dependency profile: $profile" >&2; return 2; }
# HookKit is resolved from the Theos install (HookKit repo: make
# install-theos), not staged here — see build-support/hookkit.mk. AltList and libSandy are
# still built from source into prebuilt and staged into the lane sandbox.
local altlist="$PB/altlist/$profile/AltList.framework"
local sandy="$PB/sandy/$profile/libsandy.dylib"
[ -f "$altlist/AltList" ] && [ -f "$sandy" ] || {
echo "missing $profile dependencies; run .github/scripts/build-deps.sh $profile" >&2
return 1
}
# HookKit framework dir is owned by build-support/hookkit.mk; consume its mapping.
local hookkit_dir
hookkit_dir=$(printf 'include %s\nshdw_print:\n\t@echo $(SHADOW_HOOKKIT_DIR)\n' \
"$ROOT/build-support/hookkit.mk" | make -f - THEOS="$THEOS" SHADOW_LANE="$profile" shdw_print)
local hookkit_theos="$hookkit_dir/HookKit.framework"
[ -f "$hookkit_theos/HookKit" ] || {
echo "missing Theos HookKit for $profile ($hookkit_theos); run 'make install-theos' in the HookKit repo" >&2
return 1
}
rm -rf "$LIBRARY_PATH" "$INCLUDE_PATH"
mkdir -p "$LIBRARY_PATH" "$INCLUDE_PATH"
cp -R "$altlist" "$LIBRARY_PATH/AltList.framework"
cp "$sandy" "$LIBRARY_PATH/libsandy.dylib"
if [ -f "$PB/sandy/$profile/libSandy.h" ]; then
cp "$PB/sandy/$profile/libSandy.h" "$INCLUDE_PATH/libSandy.h"
elif [ -f "$THEOS/include/libSandy.h" ]; then
cp "$THEOS/include/libSandy.h" "$INCLUDE_PATH/libSandy.h"
elif [ -f "$THEOS/vendor/include/libSandy.h" ]; then
cp "$THEOS/vendor/include/libSandy.h" "$INCLUDE_PATH/libSandy.h"
fi
# libSandy imports <xpc/xpc.h>. Older SDKs need the vendored module;
# modern SDKs already provide it and reject a duplicate definition.
target=$(shadow_lane_field "$profile" TARGET)
sdk=${target#iphone:clang:}
sdk=${sdk%%:*}
if [ -n "${XPC_HEADERS:-}" ] || [ ! -f "$THEOS/sdks/iPhoneOS$sdk.sdk/usr/include/xpc/xpc.h" ]; then
local xpc=${XPC_HEADERS:-$ROOT/.github/vendor/xpc}
[ -d "$xpc" ] || { echo "set XPC_HEADERS to an xpc headers directory" >&2; return 1; }
cp -R "$xpc" "$INCLUDE_PATH/"
fi
if [ -n "$scheme" ]; then
mkdir -p "$LIBRARY_PATH/iphone/$scheme"
cp -R "$altlist" "$LIBRARY_PATH/iphone/$scheme/AltList.framework"
cp "$sandy" "$LIBRARY_PATH/iphone/$scheme/libsandy.dylib"
fi
if [ "$profile" = roothide ]; then
# -lroothide resolves from Theos' vendor/lib, which our
# THEOS_LIBRARY_PATH override hides; stage the stub locally.
local roothide_tbd="$THEOS/vendor/lib/iphone/roothide/libroothide.tbd"
[ -f "$roothide_tbd" ] || { echo "missing libroothide.tbd under $THEOS/vendor/lib" >&2; return 1; }
cp "$roothide_tbd" "$LIBRARY_PATH/iphone/roothide/libroothide.tbd"
fi
}
# Both ABIs' toolchain selection and validation live in $THEOS/bin/lane.sh
# (sourced via lanes.sh) so Shadow and HookKit cannot disagree about which
# compiler a lane needs. macOS/Xcode compiles either ABI itself, so
# theos_abi_args emits nothing there; on Linux it emits SDKBINPATH plus
# IS_NEW_ABI=1, which wins on stock and roothide Theos alike.
legacy_args() {
theos_abi_require old rootful-legacy
mapfile -t LEGACY_ARGS < <(theos_abi_args old)
}
modern_args() { # sets MODERN_ARGS for the new arm64e ABI
MODERN_ARGS=()
[ "$(uname -s)" = Linux ] || return 0
theos_abi_require new "${1:-modern lane}"
mapfile -t MODERN_ARGS < <(theos_abi_args new)
}
prepare_scheme_framework() { # rootless|roothide
local lane=$1
# src/Shadow.framework/Makefile includes build-support/build-lanes.mk, which
# derives ARCHS/TARGET/THEOS_PACKAGE_SCHEME from SHADOW_LANE -- so the scheme
# matches the main build (a mismatch would leave stale caller objects compiled
# without -DSHADOW_ROOTHIDE while JBPath.m recompiles empty).
make -C src/Shadow.framework "SHADOW_LANE=$lane" "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
rm -rf "$LIBRARY_PATH/iphone/$lane/Shadow.framework"
mkdir -p "$LIBRARY_PATH/iphone/$lane"
cp -R src/Shadow.framework/.theos/obj/debug/Shadow.framework "$LIBRARY_PATH/iphone/$lane/"
}
last_package() {
local package
package=$(<.theos/last_package)
case "$package" in
/*) printf '%s\n' "$package" ;;
*) printf '%s/%s\n' "$ROOT" "$package" ;;
esac
}
copy_dependency_packages() { # profile
local package
[ -d "$PB/packages/$1" ] || return 0
for package in "$PB/packages/$1"/*.deb; do
[ -f "$package" ] && cp -p "$package" "$ROOT/build/"
done
}
build_lane() { # profile
local lane=$1 control="$STAGE/control.$1" package destination
scripts/gen-control.sh "$lane" > "$control"
[ "$lane" = rootful-legacy ] || modern_args
stage_deps "$lane"
make clean "SHADOW_LANE=$lane" "${MAKE_PATHS[@]}"
case "$lane" in
rootful-legacy)
legacy_args
make package FINALPACKAGE=1 "SHADOW_LANE=$lane" "$CONTROL_VAR=$control" "${MAKE_PATHS[@]}" "${LEGACY_ARGS[@]}"
;;
rootful-modern)
make package FINALPACKAGE=1 "SHADOW_LANE=$lane" "$CONTROL_VAR=$control" "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
;;
rootless|roothide)
prepare_scheme_framework "$lane"
make package FINALPACKAGE=1 "SHADOW_LANE=$lane" "$CONTROL_VAR=$control" "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
;;
esac
package=$(last_package)
destination="$ROOT/build/$(basename "$package")"
cp -p "$package" "$destination"
scripts/check-compat.sh "$lane" "$destination"
# HookKit ABI drift advisory: Shadow links the Theos-installed HookKit
# (build-support/hookkit.mk). This surfaces — but does not fail the build on
# — a HookKit update that adds/removes/renames the ABI surface Shadow's
# binding layer depends on, so it can be reviewed and adopted. Set
# SHADOW_HOOKKIT_ABI_STRICT=1 to make drift fatal.
if ! "$ROOT/scripts/check-hookkit-abi.sh" "$lane"; then
if [ "${SHADOW_HOOKKIT_ABI_STRICT:-0}" = 1 ]; then
echo "HookKit ABI drift is fatal (SHADOW_HOOKKIT_ABI_STRICT=1)" >&2
return 1
fi
echo "WARNING: HookKit ABI drift detected for $lane (advisory; build continues)" >&2
fi
copy_dependency_packages "$lane"
}
build_quick() {
stage_deps rootful-modern
modern_args
make -C src/Shadow.framework SHADOW_LANE=rootful-modern "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
make -C src/Shadow.dylib SHADOW_LANE=rootful-modern "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
make -C src/ShadowCore.dylib SHADOW_LANE=rootful-modern "${MAKE_PATHS[@]}" ${MODERN_ARGS[@]+"${MODERN_ARGS[@]}"}
}
case ${1:-all} in
rootful-legacy) build_lane rootful-legacy ;;
rootful-modern) build_lane rootful-modern ;;
rootful) build_lane rootful-legacy; build_lane rootful-modern ;;
rootless) build_lane rootless ;;
roothide) build_lane roothide ;;
quick) build_quick ;;
deps) stage_deps "${2:-rootful-modern}" ;;
all) build_lane rootless; build_lane rootful-legacy; build_lane rootful-modern; build_lane roothide ;;
*) echo "usage: $0 [all|rootful|rootful-legacy|rootful-modern|rootless|roothide|quick|deps PROFILE]" >&2; exit 2 ;;
esac
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.