nandi/jolt-nativepublic Fork 0
807f68183d34c39f2c251c5ad1ec50bb79005211
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.

justfile · 100 lines · 4.4 KBMakefile Blame HistoryRaw
Lift freeq's AV media plane out of sleek 90f8b89 nandi 19d ago1set shell := ["bash", "-euo", "pipefail", "-c"]
2
3# Everything is compiled by zig, including the C and C++ dependencies, so a
4# build needs no system toolchain — but bindgen runs libclang directly and does
5# not inherit zig's own header search path. `v4l2r` wants `linux/videodev2.h`,
6# which lives in /usr/include on a machine with kernel headers installed and
7# nowhere at all on one without. Point it at zig's bundled copies instead.
8zig_include := `scripts/zig-include`
9headers := "-I" + zig_include + " -I" + parent_directory(zig_include) + "/x86-linux-gnu -I" + parent_directory(zig_include) + "/generic-glibc"
10
11export V4L2R_VIDEODEV2_H_PATH := zig_include
12export BINDGEN_EXTRA_CLANG_ARGS := headers
13
14default:
15 @just --list
16
17# The shared objects, ready to be put on a loader search path.
18build *args:
19 cargo build --release {{args}}
20
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago21# buck2, told where the C tools are. They are named by absolute path because
22# the prelude re-execs them from a build script's own directory — see the note
23# in toolchains/BUCK. rustc is not here: buck fetches it itself now, so it
24# needs neither a path nor a place on PATH.
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago25#
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago26# The zig version goes in for the same reason the paths do not carry it: the
27# path stays the same when the binary behind it changes, and the cache cannot
28# tell.
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago29buck *args:
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago30 printf '[jolt]\n scripts = %s\n zig_version = %s\n' \
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago31 "{{justfile_directory()}}/scripts" \
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago32 "$(scripts/zig version | tr -d '\n')" > .buckconfig.local
33 scripts/buck2 {{args}}
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago34
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago35# The same two objects under buck2, staged into one directory a consumer can
36# put on its loader path — the same shape `build` leaves in target/release.
37#
38# Not the default yet, and only for one reason: cpal's `pipewire` feature is
39# off here, so device *names* in a call are ALSA PCMs rather than the real OS
40# sources. See the note in third-party/rust/Cargo.toml.
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago41buck-build *args:
42 @just buck build //:libs {{args}}
Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 19d ago43 mkdir -p build/lib
44 cp "$(just buck build --show-output //:libvidya | awk '/libvidya.so/{print $2}')" build/lib/libvidya.so
45 cp "$(just buck build --show-output //:libjoltmoq | awk '/libjoltmoq.so/{print $2}')" build/lib/libjoltmoq.so
46 @echo "{{justfile_directory()}}/build/lib"
47
48# Where a consumer points LD_LIBRARY_PATH for the buck2 build.
49buck-libdir:
50 @echo "{{justfile_directory()}}/build/lib"
Build under buck2, with the toolchain pinned rather than found 460541b nandi 19d ago51
Let the media plane cross to the phone, camera and all fd0e21a nandi 18d ago52# Both objects, cross-compiled for a 64-bit Android device and staged where an
53# APK build can pick them up. libjoltmoq crosses too now — its camera is
54# Camera2 over JNI rather than V4L2, and its audio is cpal's AAudio host rather
55# than PipeWire. The camera needs two things from the APK, though, which this
56# recipe cannot supply: a `CameraCapture` class in its classes.dex (frq has
57# one), and a call to joltmoq_android_init. See android/jolt_main.c.
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago58#
59# The NDK is fetched by buck2 from the pin in scripts/android-ndk.dotslash, so
60# the only thing a machine needs installed for this is nothing.
61ffi-android:
Let the media plane cross to the phone, camera and all fd0e21a nandi 18d ago62 @just buck build //:libs-android
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago63 mkdir -p build/android/arm64-v8a
64 cp "$(just buck build --show-output //:libvidya-android | awk '/libvidya.so/{print $2}')" \
65 build/android/arm64-v8a/libvidya.so
Let the media plane cross to the phone, camera and all fd0e21a nandi 18d ago66 cp "$(just buck build --show-output //:libjoltmoq-android | awk '/libjoltmoq.so/{print $2}')" \
67 build/android/arm64-v8a/libjoltmoq.so
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago68 @echo "{{justfile_directory()}}/build/android/arm64-v8a"
69
Let the media plane cross to the phone, camera and all fd0e21a nandi 18d ago70# Where an APK build finds the Android objects, and the glue beside them.
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago71android-libdir:
72 @echo "{{justfile_directory()}}/build/android/arm64-v8a"
73
Lift freeq's AV media plane out of sleek 90f8b89 nandi 19d ago74test *args:
75 cargo test --workspace {{args}}
76
77# Without PipeWire — for a machine that has neither pkg-config nor PipeWire's
78# headers. Device *names* get worse (ALSA PCMs only); everything else is equal.
79test-minimal:
80 cargo test --workspace --no-default-features
81
82lint:
83 cargo clippy --workspace --all-targets -- -D warnings
84 cargo fmt --all --check
85
86# Where a consumer points LD_LIBRARY_PATH.
87libdir:
88 @echo "{{justfile_directory()}}/target/release"
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago89
90# Regenerate the table buck fetches its toolchains from, after editing any of
91# scripts/*.dotslash. DotSlash stays the one place a version is written down;
92# this only restates it in a form buck can act on.
93sync-dist:
94 scripts/dotslash-to-buck
Fetch the git dependencies as archives, so nothing has to run here 807f681 nandi 18d ago95
96# Regenerate third-party/rust/BUCK. Runs reindeer, then rewrites the git
97# dependencies into archive fetches so no action in the graph requires a local
98# worker — see scripts/buckify.
99buckify:
100 scripts/buckify