nandi/jolt-nativepublic Fork 0
c7dc288
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Merge branch 'no-moq-deps' into jvui-for-frq

nandi committed 2026-09-10T05:56:05-07:00 Browse files
c7dc288 parents: d5dfd53 2bd393e
modified android/jolt_main.c +14 -0
@@ -29,7 +29,15 @@
2929 #include <android/log.h>
3030 #include <pthread.h>
3131
32+/* JOLT_WITHOUT_MOQ builds this glue for an app that does not link
33+ * libjoltmoq. frq is one: its media plane is jolt now — MoQ through
34+ * libmoq_ffi, Opus, H.264, V4L2 and ALSA — so the Rust one is an object it
35+ * never opens, and seventeen megabytes of APK for nothing. Everything moq
36+ * below is behind this, because --no-undefined turns an unreferenced symbol
37+ * into a link error rather than a surprise on the phone. */
38+#ifndef JOLT_WITHOUT_MOQ
3239 #include "joltmoq.h"
40+#endif
3341 #include "scheme.h"
3442 #include "vidya.h"
3543 #include "vidya_tree.h"
@@ -114,6 +122,7 @@ static void register_vidya_api(void) {
114122 REGISTER_VIDYA(vidya_tree_dump);
115123 }
116124
125+#ifndef JOLT_WITHOUT_MOQ
117126 /*
118127 * The media plane's symbols, registered for the same reason the Vidya ones
119128 * above are: they live in libjoltmoq.so, a third object, and Android's loader
@@ -164,6 +173,7 @@ static void register_joltmoq_api(void) {
164173 REGISTER_JOLTMOQ(joltmoq_can_dial);
165174 REGISTER_JOLTMOQ(joltmoq_new_instance);
166175 }
176+#endif /* JOLT_WITHOUT_MOQ */
167177
168178 /*
169179 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into
@@ -204,8 +214,11 @@ int vidya_jolt_main(void) {
204214 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));
205215 Sbuild_heap(NULL, NULL);
206216 register_vidya_api();
217+#ifndef JOLT_WITHOUT_MOQ
207218 register_joltmoq_api();
219+#endif
208220
221+#ifndef JOLT_WITHOUT_MOQ
209222 /* The media plane's own handles, which it cannot get for itself: they arrive
210223 in android-activity's glue, and the glue is in libvidya.so. This is the
211224 only place both objects are in scope. Before Scheme starts, so no call can
@@ -221,6 +234,7 @@ int vidya_jolt_main(void) {
221234 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",
222235 moq_vm, moq_activity);
223236 joltmoq_android_init(moq_vm, moq_activity);
237+#endif
224238
225239 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");
226240 int status = Sscheme_start(1, argv);
@@ -29,7 +29,15 @@
29 #include <android/log.h>29 #include <android/log.h>
30 #include <pthread.h>30 #include <pthread.h>
31 31
32+/* JOLT_WITHOUT_MOQ builds this glue for an app that does not link
33+ * libjoltmoq. frq is one: its media plane is jolt now — MoQ through
34+ * libmoq_ffi, Opus, H.264, V4L2 and ALSA — so the Rust one is an object it
35+ * never opens, and seventeen megabytes of APK for nothing. Everything moq
36+ * below is behind this, because --no-undefined turns an unreferenced symbol
37+ * into a link error rather than a surprise on the phone. */
38+#ifndef JOLT_WITHOUT_MOQ
32 #include "joltmoq.h"39 #include "joltmoq.h"
40+#endif
33 #include "scheme.h"41 #include "scheme.h"
34 #include "vidya.h"42 #include "vidya.h"
35 #include "vidya_tree.h"43 #include "vidya_tree.h"
@@ -114,6 +122,7 @@ static void register_vidya_api(void) {
114 REGISTER_VIDYA(vidya_tree_dump);122 REGISTER_VIDYA(vidya_tree_dump);
115 }123 }
116 124
125+#ifndef JOLT_WITHOUT_MOQ
117 /*126 /*
118 * The media plane's symbols, registered for the same reason the Vidya ones127 * The media plane's symbols, registered for the same reason the Vidya ones
119 * above are: they live in libjoltmoq.so, a third object, and Android's loader128 * above are: they live in libjoltmoq.so, a third object, and Android's loader
@@ -164,6 +173,7 @@ static void register_joltmoq_api(void) {
164 REGISTER_JOLTMOQ(joltmoq_can_dial);173 REGISTER_JOLTMOQ(joltmoq_can_dial);
165 REGISTER_JOLTMOQ(joltmoq_new_instance);174 REGISTER_JOLTMOQ(joltmoq_new_instance);
166 }175 }
176+#endif /* JOLT_WITHOUT_MOQ */
167 177
168 /*178 /*
169 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into179 * Chez writes to stdout/stderr, which on Android goes nowhere. Pump both into
@@ -204,8 +214,11 @@ int vidya_jolt_main(void) {
204 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));214 (iptr)(_binary_jolt_boot_end - _binary_jolt_boot_start));
205 Sbuild_heap(NULL, NULL);215 Sbuild_heap(NULL, NULL);
206 register_vidya_api();216 register_vidya_api();
217+#ifndef JOLT_WITHOUT_MOQ
207 register_joltmoq_api();218 register_joltmoq_api();
219+#endif
208 220
221+#ifndef JOLT_WITHOUT_MOQ
209 /* The media plane's own handles, which it cannot get for itself: they arrive222 /* The media plane's own handles, which it cannot get for itself: they arrive
210 in android-activity's glue, and the glue is in libvidya.so. This is the223 in android-activity's glue, and the glue is in libvidya.so. This is the
211 only place both objects are in scope. Before Scheme starts, so no call can224 only place both objects are in scope. Before Scheme starts, so no call can
@@ -221,6 +234,7 @@ int vidya_jolt_main(void) {
221 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",234 "VidyaJolt", "media plane JNI handles: vm=%p activity=%p",
222 moq_vm, moq_activity);235 moq_vm, moq_activity);
223 joltmoq_android_init(moq_vm, moq_activity);236 joltmoq_android_init(moq_vm, moq_activity);
237+#endif
224 238
225 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");239 __android_log_print(ANDROID_LOG_INFO, "VidyaJolt", "starting Jolt application");
226 int status = Sscheme_start(1, argv);240 int status = Sscheme_start(1, argv);
modified flake.nix +40 -4
@@ -132,8 +132,40 @@
132132 buildInputs = desktopBuildInputs;
133133 } // v4l2Env;
134134
135- # Every external crate, compiled once and shared by the three objects,
136- # the clippy run and the test run.
135+ # Every external crate, compiled once and shared by the objects that
136+ # actually want it.
137+ #
138+ # This used to be ONE derivation for the whole workspace, and the
139+ # sharing was the point: three objects, one dependency build. What it
140+ # cost was invisible until a consumer wanted only some of them.
141+ # jolt-moq brings moq-net, iroh, quinn, rustls and aws-lc-sys behind
142+ # it -- 440 crates that nothing else here touches -- so a build of
143+ # libvidya alone still paid for the media plane. A client that has
144+ # stopped loading libjoltmoq paid for it too, which is the case that
145+ # made this worth splitting.
146+ #
147+ # Split by CONSUMER rather than per package: vidya and tui share
148+ # nearly everything, and giving them an artifact each would trade one
149+ # kind of waste for another.
150+ depsFor = { pname, packages }:
151+ craneLib.buildDepsOnly (commonArgs // {
152+ inherit pname;
153+ version = "0.1.0";
154+ cargoExtraArgs =
155+ "--locked " + lib.concatMapStringsSep " " (p: "-p " + p) packages;
156+ });
157+
158+ uiArtifacts = depsFor {
159+ pname = "jolt-native-ui-deps";
160+ packages = [ "vidya-ffi" "jolt-tui" ];
161+ };
162+ moqArtifacts = depsFor {
163+ pname = "jolt-native-moq-deps";
164+ packages = [ "jolt-moq" ];
165+ };
166+
167+ # The whole workspace, for the clippy and test runs — those do build
168+ # everything, and want the sharing this split gives up.
137169 cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
138170 pname = "jolt-native-deps";
139171 version = "0.1.0";
@@ -147,9 +179,10 @@
147179 # crates/jolt-vidya. Nothing is silenced — a header that stops being
148180 # there should fail the build rather than ship an object with no ABI
149181 # beside it.
150- soPackage = { pname, package, dir, soname }:
182+ soPackage = { pname, package, dir, soname, artifacts }:
151183 craneLib.buildPackage (commonArgs // {
152- inherit pname cargoArtifacts;
184+ inherit pname;
185+ cargoArtifacts = artifacts;
153186 version = "0.1.0";
154187 cargoExtraArgs = "--locked -p ${package}";
155188 doCheck = false;
@@ -161,18 +194,21 @@
161194 });
162195
163196 libvidya = soPackage {
197+ artifacts = uiArtifacts;
164198 pname = "libvidya";
165199 package = "vidya-ffi";
166200 dir = "jolt-vidya";
167201 soname = "libvidya.so";
168202 };
169203 libjolttui = soPackage {
204+ artifacts = uiArtifacts;
170205 pname = "libjolttui";
171206 package = "jolt-tui";
172207 dir = "jolt-tui";
173208 soname = "libjolttui.so";
174209 };
175210 libjoltmoq = soPackage {
211+ artifacts = moqArtifacts;
176212 pname = "libjoltmoq";
177213 package = "jolt-moq";
178214 dir = "jolt-moq";
@@ -132,8 +132,40 @@
132 buildInputs = desktopBuildInputs;132 buildInputs = desktopBuildInputs;
133 } // v4l2Env;133 } // v4l2Env;
134 134
135- # Every external crate, compiled once and shared by the three objects,135+ # Every external crate, compiled once and shared by the objects that
136- # the clippy run and the test run.136+ # actually want it.
137+ #
138+ # This used to be ONE derivation for the whole workspace, and the
139+ # sharing was the point: three objects, one dependency build. What it
140+ # cost was invisible until a consumer wanted only some of them.
141+ # jolt-moq brings moq-net, iroh, quinn, rustls and aws-lc-sys behind
142+ # it -- 440 crates that nothing else here touches -- so a build of
143+ # libvidya alone still paid for the media plane. A client that has
144+ # stopped loading libjoltmoq paid for it too, which is the case that
145+ # made this worth splitting.
146+ #
147+ # Split by CONSUMER rather than per package: vidya and tui share
148+ # nearly everything, and giving them an artifact each would trade one
149+ # kind of waste for another.
150+ depsFor = { pname, packages }:
151+ craneLib.buildDepsOnly (commonArgs // {
152+ inherit pname;
153+ version = "0.1.0";
154+ cargoExtraArgs =
155+ "--locked " + lib.concatMapStringsSep " " (p: "-p " + p) packages;
156+ });
157+
158+ uiArtifacts = depsFor {
159+ pname = "jolt-native-ui-deps";
160+ packages = [ "vidya-ffi" "jolt-tui" ];
161+ };
162+ moqArtifacts = depsFor {
163+ pname = "jolt-native-moq-deps";
164+ packages = [ "jolt-moq" ];
165+ };
166+
167+ # The whole workspace, for the clippy and test runs — those do build
168+ # everything, and want the sharing this split gives up.
137 cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {169 cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
138 pname = "jolt-native-deps";170 pname = "jolt-native-deps";
139 version = "0.1.0";171 version = "0.1.0";
@@ -147,9 +179,10 @@
147 # crates/jolt-vidya. Nothing is silenced — a header that stops being179 # crates/jolt-vidya. Nothing is silenced — a header that stops being
148 # there should fail the build rather than ship an object with no ABI180 # there should fail the build rather than ship an object with no ABI
149 # beside it.181 # beside it.
150- soPackage = { pname, package, dir, soname }:182+ soPackage = { pname, package, dir, soname, artifacts }:
151 craneLib.buildPackage (commonArgs // {183 craneLib.buildPackage (commonArgs // {
152- inherit pname cargoArtifacts;184+ inherit pname;
185+ cargoArtifacts = artifacts;
153 version = "0.1.0";186 version = "0.1.0";
154 cargoExtraArgs = "--locked -p ${package}";187 cargoExtraArgs = "--locked -p ${package}";
155 doCheck = false;188 doCheck = false;
@@ -161,18 +194,21 @@
161 });194 });
162 195
163 libvidya = soPackage {196 libvidya = soPackage {
197+ artifacts = uiArtifacts;
164 pname = "libvidya";198 pname = "libvidya";
165 package = "vidya-ffi";199 package = "vidya-ffi";
166 dir = "jolt-vidya";200 dir = "jolt-vidya";
167 soname = "libvidya.so";201 soname = "libvidya.so";
168 };202 };
169 libjolttui = soPackage {203 libjolttui = soPackage {
204+ artifacts = uiArtifacts;
170 pname = "libjolttui";205 pname = "libjolttui";
171 package = "jolt-tui";206 package = "jolt-tui";
172 dir = "jolt-tui";207 dir = "jolt-tui";
173 soname = "libjolttui.so";208 soname = "libjolttui.so";
174 };209 };
175 libjoltmoq = soPackage {210 libjoltmoq = soPackage {
211+ artifacts = moqArtifacts;
176 pname = "libjoltmoq";212 pname = "libjoltmoq";
177 package = "jolt-moq";213 package = "jolt-moq";
178 dir = "jolt-moq";214 dir = "jolt-moq";