@geastack/core 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +36 -0
- package/app_frame_perf.cpp +77 -0
- package/css.d.ts +1 -0
- package/events.cpp +67 -0
- package/gea_app_entry.cpp +317 -0
- package/gea_sources.mjs +126 -0
- package/gea_sources.sh +36 -0
- package/include/app.h +60 -0
- package/include/apps.h +46 -0
- package/include/audio.h +90 -0
- package/include/ble.h +212 -0
- package/include/bluetooth/hid_profile.h +92 -0
- package/include/camera.h +107 -0
- package/include/canvas.h +290 -0
- package/include/display.h +390 -0
- package/include/display_present.h +869 -0
- package/include/event.h +32 -0
- package/include/events.h +116 -0
- package/include/gea/embedded.h +13 -0
- package/include/gea/reactive_runtime.h +32 -0
- package/include/gea.h +14 -0
- package/include/gea_perf_config.h +96 -0
- package/include/geaos/abi.h +165 -0
- package/include/geolocation.h +126 -0
- package/include/gpio.h +61 -0
- package/include/graphics/font.h +122 -0
- package/include/i2c.h +20 -0
- package/include/image.h +156 -0
- package/include/imu.h +23 -0
- package/include/input.h +33 -0
- package/include/memory.h +52 -0
- package/include/pixel.h +907 -0
- package/include/platform/file_cache.h +18 -0
- package/include/power.h +11 -0
- package/include/runtime.h +83 -0
- package/include/services/app_runner.h +10 -0
- package/include/services/app_state.h +14 -0
- package/include/services/battery_service.h +12 -0
- package/include/services/bluetooth_service.h +13 -0
- package/include/services/diagnostics.h +76 -0
- package/include/services/diagnostics_platform.h +54 -0
- package/include/services/frame_scheduler.h +71 -0
- package/include/services/mirror.h +49 -0
- package/include/services/network_services.h +25 -0
- package/include/services/ota.h +32 -0
- package/include/services/runtime_log.h +11 -0
- package/include/services/storage_service.h +26 -0
- package/include/touch.h +38 -0
- package/include/ui/signal.h +149 -0
- package/include/wifi.h +67 -0
- package/index.d.ts +1940 -0
- package/jsx.d.ts +1 -0
- package/package.json +70 -0
- package/runtime/ble.ts +49 -0
- package/runtime/color.ts +21 -0
- package/runtime/compiler.ts +43 -0
- package/runtime/host.ts +1083 -0
- package/runtime/images.ts +129 -0
- package/runtime/primitives.ts +49 -0
- package/runtime-surface.ts +180 -0
- package/runtime.cpp +431 -0
- package/runtime.ts +34 -0
- package/scripts/build-gea-vite-geatsc.mjs +4514 -0
- package/scripts/dotenv-defines.mjs +98 -0
- package/scripts/gea-bundle-type-hints.mjs +546 -0
- package/scripts/gea-embedded-compat-staging.mjs +17 -0
- package/scripts/gea-embedded-compat-transform.mjs +427 -0
- package/scripts/gea-vite-module-graph-plugin.mjs +578 -0
- package/scripts/generate-gea-embedded-assets.mjs +296 -0
- package/scripts/generate-gea-embedded-fonts.mjs +1252 -0
- package/scripts/generate-installed-app-plan.mjs +55 -0
- package/scripts/native-object-cache.sh +244 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const [, , partitionsPath, outputPath] = process.argv;
|
|
6
|
+
|
|
7
|
+
if (!partitionsPath || !outputPath) {
|
|
8
|
+
console.error('Usage: generate-installed-app-plan.mjs <partitions.csv> <output.h>');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let source = '';
|
|
13
|
+
try {
|
|
14
|
+
source = readFileSync(partitionsPath, 'utf8');
|
|
15
|
+
} catch {
|
|
16
|
+
source = '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const entries = [];
|
|
20
|
+
for (const line of source.split(/\r?\n/)) {
|
|
21
|
+
const match = line.match(/^\s*#\s*(ota_\d+)\s*:\s*([A-Za-z0-9_.-]+)\s*$/);
|
|
22
|
+
if (match) entries.push({ slot: match[1], appId: match[2] });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const quote = (value) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
26
|
+
const lines = [
|
|
27
|
+
'#pragma once',
|
|
28
|
+
'',
|
|
29
|
+
'typedef struct {',
|
|
30
|
+
' const char *app_id;',
|
|
31
|
+
' const char *slot_label;',
|
|
32
|
+
'} gea_embedded_installed_app_plan_entry_t;',
|
|
33
|
+
'',
|
|
34
|
+
'static const gea_embedded_installed_app_plan_entry_t gea_embedded_installed_app_plan[] = {',
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
if (entries.length === 0) {
|
|
38
|
+
lines.push(' { 0, 0 },');
|
|
39
|
+
} else {
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
lines.push(` { "${quote(entry.appId)}", "${quote(entry.slot)}" },`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
lines.push(
|
|
46
|
+
'};',
|
|
47
|
+
`static const int gea_embedded_installed_app_plan_count = ${entries.length};`,
|
|
48
|
+
'',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const newContent = lines.join('\n');
|
|
52
|
+
const existing = existsSync(outputPath) ? readFileSync(outputPath, 'utf8') : null;
|
|
53
|
+
if (existing !== newContent) {
|
|
54
|
+
writeFileSync(outputPath, newContent);
|
|
55
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Shared native C/C++ object cache for geastack shell builds.
|
|
4
|
+
#
|
|
5
|
+
# Caller contract:
|
|
6
|
+
# GEA_NATIVE_CACHE_BASE_DIR stable root for deterministic relative object names
|
|
7
|
+
# GEA_NATIVE_CACHE_OBJ_ROOT cache root, default: $PWD/.build/obj
|
|
8
|
+
# GEA_NATIVE_CACHE_OUTPUT linked executable path
|
|
9
|
+
# GEA_NATIVE_CC_BIN C compiler, default: ${CC:-clang}
|
|
10
|
+
# GEA_NATIVE_CXX_BIN C++ linker/compiler, default: ${CXX:-clang++}
|
|
11
|
+
# GEA_NATIVE_C_SOURCES array of C sources
|
|
12
|
+
# GEA_NATIVE_CXX_SOURCES array of C++ sources
|
|
13
|
+
# GEA_NATIVE_MM_SOURCES array of Objective-C++ sources
|
|
14
|
+
# GEA_NATIVE_CFLAGS array of C compile flags
|
|
15
|
+
# GEA_NATIVE_CXXFLAGS array of C++ compile flags
|
|
16
|
+
# GEA_NATIVE_MMFLAGS array of Objective-C++ compile flags
|
|
17
|
+
# GEA_NATIVE_LINK_FLAGS array of link flags
|
|
18
|
+
|
|
19
|
+
gea_native_cpu_count() {
|
|
20
|
+
local count=""
|
|
21
|
+
count="$(sysctl -n hw.ncpu 2>/dev/null || true)"
|
|
22
|
+
if [[ -z "$count" ]]; then count="$(nproc 2>/dev/null || true)"; fi
|
|
23
|
+
if ! [[ "$count" =~ ^[0-9]+$ ]] || (( count < 1 )); then count=1; fi
|
|
24
|
+
printf '%s\n' "$count"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
gea_native_sha256() {
|
|
28
|
+
if command -v shasum >/dev/null 2>&1; then
|
|
29
|
+
shasum -a 256 | awk '{print $1}'
|
|
30
|
+
elif command -v sha256sum >/dev/null 2>&1; then
|
|
31
|
+
sha256sum | awk '{print $1}'
|
|
32
|
+
else
|
|
33
|
+
openssl dgst -sha256 | awk '{print $NF}'
|
|
34
|
+
fi
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
gea_native_init_cache() {
|
|
38
|
+
GEA_NATIVE_CACHE_BASE_DIR="${GEA_NATIVE_CACHE_BASE_DIR:-$(pwd)}"
|
|
39
|
+
GEA_NATIVE_CACHE_OBJ_ROOT="${GEA_NATIVE_CACHE_OBJ_ROOT:-$(pwd)/.build/obj}"
|
|
40
|
+
GEA_NATIVE_CC_BIN="${GEA_NATIVE_CC_BIN:-${CC:-clang}}"
|
|
41
|
+
GEA_NATIVE_CXX_BIN="${GEA_NATIVE_CXX_BIN:-${CXX:-clang++}}"
|
|
42
|
+
GEA_NATIVE_CACHE_JOBS="${GEA_NATIVE_CACHE_JOBS:-${GEA_NATIVE_JOBS:-$(gea_native_cpu_count)}}"
|
|
43
|
+
if ! [[ "$GEA_NATIVE_CACHE_JOBS" =~ ^[0-9]+$ ]] || (( GEA_NATIVE_CACHE_JOBS < 1 )); then
|
|
44
|
+
GEA_NATIVE_CACHE_JOBS=1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
GEA_NATIVE_CCACHE_PREFIX=()
|
|
48
|
+
if [[ "${GEA_NATIVE_CCACHE:-1}" != "0" ]]; then
|
|
49
|
+
if command -v sccache >/dev/null 2>&1; then
|
|
50
|
+
GEA_NATIVE_CCACHE_PREFIX=(sccache)
|
|
51
|
+
elif command -v ccache >/dev/null 2>&1; then
|
|
52
|
+
GEA_NATIVE_CCACHE_PREFIX=(ccache)
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
GEA_NATIVE_OBJECTS=()
|
|
57
|
+
GEA_NATIVE_PIDS=()
|
|
58
|
+
GEA_NATIVE_COMPILE_FAILED=0
|
|
59
|
+
GEA_NATIVE_COMPILED=0
|
|
60
|
+
GEA_NATIVE_REUSED=0
|
|
61
|
+
GEA_NATIVE_LINKED=0
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
gea_native_compiler_version() {
|
|
65
|
+
local compiler="$1"
|
|
66
|
+
"$compiler" --version 2>/dev/null | head -n 1 || true
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
gea_native_join_flags() {
|
|
70
|
+
local flag
|
|
71
|
+
for flag in "$@"; do
|
|
72
|
+
printf '%s\n' "$flag"
|
|
73
|
+
done
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
gea_native_compile_signature() {
|
|
77
|
+
local kind="$1"
|
|
78
|
+
local compiler="$2"
|
|
79
|
+
shift 2
|
|
80
|
+
{
|
|
81
|
+
printf 'geastack-native-object-cache-v1\n'
|
|
82
|
+
printf 'kind=%s\n' "$kind"
|
|
83
|
+
printf 'platform=%s\n' "$(uname -s 2>/dev/null || true)"
|
|
84
|
+
printf 'arch=%s\n' "$(uname -m 2>/dev/null || true)"
|
|
85
|
+
printf 'compiler=%s\n' "$compiler"
|
|
86
|
+
printf 'compiler-version=%s\n' "$(gea_native_compiler_version "$compiler")"
|
|
87
|
+
printf 'wrapper:\n'
|
|
88
|
+
gea_native_join_flags ${GEA_NATIVE_CCACHE_PREFIX[@]+"${GEA_NATIVE_CCACHE_PREFIX[@]}"}
|
|
89
|
+
printf 'flags:\n'
|
|
90
|
+
gea_native_join_flags "$@"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
gea_native_link_signature() {
|
|
95
|
+
{
|
|
96
|
+
printf 'geastack-native-link-cache-v1\n'
|
|
97
|
+
printf 'linker=%s\n' "$GEA_NATIVE_CXX_BIN"
|
|
98
|
+
printf 'linker-version=%s\n' "$(gea_native_compiler_version "$GEA_NATIVE_CXX_BIN")"
|
|
99
|
+
printf 'wrapper:\n'
|
|
100
|
+
gea_native_join_flags ${GEA_NATIVE_CCACHE_PREFIX[@]+"${GEA_NATIVE_CCACHE_PREFIX[@]}"}
|
|
101
|
+
printf 'flags:\n'
|
|
102
|
+
gea_native_join_flags ${GEA_NATIVE_LINK_FLAGS[@]+"${GEA_NATIVE_LINK_FLAGS[@]}"}
|
|
103
|
+
printf 'objects:\n'
|
|
104
|
+
gea_native_join_flags ${GEA_NATIVE_OBJECTS[@]+"${GEA_NATIVE_OBJECTS[@]}"}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
gea_native_object_rel() {
|
|
109
|
+
local src="$1"
|
|
110
|
+
local kind="$2"
|
|
111
|
+
local rel="$src"
|
|
112
|
+
local base="${GEA_NATIVE_CACHE_BASE_DIR%/}"
|
|
113
|
+
if [[ "$rel" == "$base/"* ]]; then
|
|
114
|
+
rel="${rel#$base/}"
|
|
115
|
+
else
|
|
116
|
+
rel="${rel#/}"
|
|
117
|
+
fi
|
|
118
|
+
rel="${rel%.*}"
|
|
119
|
+
rel="${rel//[^A-Za-z0-9._-]/__}"
|
|
120
|
+
printf '%s.%s.o\n' "$rel" "$kind"
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
gea_native_depfile_has_newer_input() {
|
|
124
|
+
local depfile="$1"
|
|
125
|
+
local obj="$2"
|
|
126
|
+
[[ -f "$depfile" ]] || return 0
|
|
127
|
+
local dep
|
|
128
|
+
while IFS= read -r dep; do
|
|
129
|
+
[[ -n "$dep" ]] || continue
|
|
130
|
+
dep="${dep//\\ / }"
|
|
131
|
+
if [[ -e "$dep" && "$dep" -nt "$obj" ]]; then
|
|
132
|
+
return 0
|
|
133
|
+
fi
|
|
134
|
+
done < <(sed -e ':again' -e '/\\$/N' -e 's/\\\n/ /' -e 'tagain' -e 's/^[^:]*: //' "$depfile" | tr ' ' '\n' | sed -e 's/\\$//' -e '/^$/d')
|
|
135
|
+
return 1
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
gea_native_needs_compile() {
|
|
139
|
+
local src="$1"
|
|
140
|
+
local obj="$2"
|
|
141
|
+
[[ -f "$obj" ]] || return 0
|
|
142
|
+
[[ -f "$obj.d" ]] || return 0
|
|
143
|
+
[[ "$src" -nt "$obj" ]] && return 0
|
|
144
|
+
gea_native_depfile_has_newer_input "$obj.d" "$obj" && return 0
|
|
145
|
+
return 1
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
gea_native_wait_for_slot() {
|
|
149
|
+
(( ${#GEA_NATIVE_PIDS[@]} < GEA_NATIVE_CACHE_JOBS )) && return 0
|
|
150
|
+
local pid="${GEA_NATIVE_PIDS[0]}"
|
|
151
|
+
local rest=("${GEA_NATIVE_PIDS[@]:1}")
|
|
152
|
+
if ! wait "$pid"; then
|
|
153
|
+
GEA_NATIVE_COMPILE_FAILED=1
|
|
154
|
+
fi
|
|
155
|
+
GEA_NATIVE_PIDS=("${rest[@]}")
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
gea_native_wait_for_all() {
|
|
159
|
+
local pid
|
|
160
|
+
for pid in ${GEA_NATIVE_PIDS[@]+"${GEA_NATIVE_PIDS[@]}"}; do
|
|
161
|
+
if ! wait "$pid"; then
|
|
162
|
+
GEA_NATIVE_COMPILE_FAILED=1
|
|
163
|
+
fi
|
|
164
|
+
done
|
|
165
|
+
GEA_NATIVE_PIDS=()
|
|
166
|
+
if (( GEA_NATIVE_COMPILE_FAILED != 0 )); then
|
|
167
|
+
return 1
|
|
168
|
+
fi
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
gea_native_queue_compile() {
|
|
172
|
+
local kind="$1"
|
|
173
|
+
local src="$2"
|
|
174
|
+
shift 2
|
|
175
|
+
local compiler="$1"
|
|
176
|
+
shift
|
|
177
|
+
local signature hash obj rel
|
|
178
|
+
signature="$(gea_native_compile_signature "$kind" "$compiler" "$@")"
|
|
179
|
+
hash="$(printf '%s' "$signature" | gea_native_sha256)"
|
|
180
|
+
rel="$(gea_native_object_rel "$src" "$kind")"
|
|
181
|
+
obj="$GEA_NATIVE_CACHE_OBJ_ROOT/$hash/$rel"
|
|
182
|
+
GEA_NATIVE_OBJECTS+=("$obj")
|
|
183
|
+
|
|
184
|
+
if ! gea_native_needs_compile "$src" "$obj"; then
|
|
185
|
+
GEA_NATIVE_REUSED=$((GEA_NATIVE_REUSED + 1))
|
|
186
|
+
return 0
|
|
187
|
+
fi
|
|
188
|
+
|
|
189
|
+
mkdir -p "$(dirname "$obj")"
|
|
190
|
+
GEA_NATIVE_COMPILED=$((GEA_NATIVE_COMPILED + 1))
|
|
191
|
+
if [[ "${GEA_NATIVE_CACHE_TRACE:-0}" == "1" ]]; then
|
|
192
|
+
printf 'native-cache: compile %s\n' "$src" >&2
|
|
193
|
+
fi
|
|
194
|
+
(
|
|
195
|
+
${GEA_NATIVE_CCACHE_PREFIX[@]+"${GEA_NATIVE_CCACHE_PREFIX[@]}"} "$compiler" "$@" -MMD -MP -MF "$obj.d" -c "$src" -o "$obj"
|
|
196
|
+
) &
|
|
197
|
+
GEA_NATIVE_PIDS+=("$!")
|
|
198
|
+
gea_native_wait_for_slot
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
gea_native_link_needs_rebuild() {
|
|
202
|
+
local output="$1"
|
|
203
|
+
local sigFile="$2"
|
|
204
|
+
local signature="$3"
|
|
205
|
+
[[ -f "$output" ]] || return 0
|
|
206
|
+
[[ -f "$sigFile" ]] || return 0
|
|
207
|
+
[[ "$(cat "$sigFile")" == "$signature" ]] || return 0
|
|
208
|
+
local obj
|
|
209
|
+
for obj in "${GEA_NATIVE_OBJECTS[@]}"; do
|
|
210
|
+
[[ "$obj" -nt "$output" ]] && return 0
|
|
211
|
+
done
|
|
212
|
+
return 1
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
gea_native_compile_and_link() {
|
|
216
|
+
gea_native_init_cache
|
|
217
|
+
local src
|
|
218
|
+
for src in ${GEA_NATIVE_C_SOURCES[@]+"${GEA_NATIVE_C_SOURCES[@]}"}; do
|
|
219
|
+
[[ -n "$src" ]] || continue
|
|
220
|
+
gea_native_queue_compile c "$src" "$GEA_NATIVE_CC_BIN" ${GEA_NATIVE_CFLAGS[@]+"${GEA_NATIVE_CFLAGS[@]}"}
|
|
221
|
+
done
|
|
222
|
+
for src in ${GEA_NATIVE_CXX_SOURCES[@]+"${GEA_NATIVE_CXX_SOURCES[@]}"}; do
|
|
223
|
+
[[ -n "$src" ]] || continue
|
|
224
|
+
gea_native_queue_compile cxx "$src" "$GEA_NATIVE_CXX_BIN" ${GEA_NATIVE_CXXFLAGS[@]+"${GEA_NATIVE_CXXFLAGS[@]}"}
|
|
225
|
+
done
|
|
226
|
+
for src in ${GEA_NATIVE_MM_SOURCES[@]+"${GEA_NATIVE_MM_SOURCES[@]}"}; do
|
|
227
|
+
[[ -n "$src" ]] || continue
|
|
228
|
+
gea_native_queue_compile mm "$src" "$GEA_NATIVE_CXX_BIN" ${GEA_NATIVE_MMFLAGS[@]+"${GEA_NATIVE_MMFLAGS[@]}"}
|
|
229
|
+
done
|
|
230
|
+
gea_native_wait_for_all
|
|
231
|
+
|
|
232
|
+
local linkSig linkSigFile
|
|
233
|
+
linkSig="$(gea_native_link_signature)"
|
|
234
|
+
linkSigFile="$GEA_NATIVE_CACHE_OUTPUT.link.sig"
|
|
235
|
+
mkdir -p "$(dirname "$GEA_NATIVE_CACHE_OUTPUT")"
|
|
236
|
+
if gea_native_link_needs_rebuild "$GEA_NATIVE_CACHE_OUTPUT" "$linkSigFile" "$linkSig"; then
|
|
237
|
+
GEA_NATIVE_LINKED=1
|
|
238
|
+
${GEA_NATIVE_CCACHE_PREFIX[@]+"${GEA_NATIVE_CCACHE_PREFIX[@]}"} "$GEA_NATIVE_CXX_BIN" ${GEA_NATIVE_OBJECTS[@]+"${GEA_NATIVE_OBJECTS[@]}"} ${GEA_NATIVE_LINK_FLAGS[@]+"${GEA_NATIVE_LINK_FLAGS[@]}"} -o "$GEA_NATIVE_CACHE_OUTPUT"
|
|
239
|
+
printf '%s\n' "$linkSig" > "$linkSigFile"
|
|
240
|
+
fi
|
|
241
|
+
|
|
242
|
+
printf 'native-cache: compiled=%s reused=%s linked=%s jobs=%s obj-root=%s\n' \
|
|
243
|
+
"$GEA_NATIVE_COMPILED" "$GEA_NATIVE_REUSED" "$GEA_NATIVE_LINKED" "$GEA_NATIVE_CACHE_JOBS" "$GEA_NATIVE_CACHE_OBJ_ROOT" >&2
|
|
244
|
+
}
|