nandi/jolt-nativepublic Fork 0
726f7c6204744da1ec206370a11b6c8d5e00c669
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 · 89 lines · 3.8 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
Build libvidya for the phone, and hold the glue that boots it d942053 nandi 19d ago52# libvidya alone, cross-compiled for a 64-bit Android device, staged where an
53# APK build can pick it up. There is no libjoltmoq here: the media plane is
54# V4L2 and PipeWire, neither of which the phone has.
55#
56# The NDK is fetched by buck2 from the pin in scripts/android-ndk.dotslash, so
57# the only thing a machine needs installed for this is nothing.
58ffi-android:
59 @just buck build //:libvidya-android
60 mkdir -p build/android/arm64-v8a
61 cp "$(just buck build --show-output //:libvidya-android | awk '/libvidya.so/{print $2}')" \
62 build/android/arm64-v8a/libvidya.so
63 @echo "{{justfile_directory()}}/build/android/arm64-v8a"
64
65# Where an APK build finds the Android libvidya, and the glue beside it.
66android-libdir:
67 @echo "{{justfile_directory()}}/build/android/arm64-v8a"
68
Lift freeq's AV media plane out of sleek 90f8b89 nandi 19d ago69test *args:
70 cargo test --workspace {{args}}
71
72# Without PipeWire — for a machine that has neither pkg-config nor PipeWire's
73# headers. Device *names* get worse (ALSA PCMs only); everything else is equal.
74test-minimal:
75 cargo test --workspace --no-default-features
76
77lint:
78 cargo clippy --workspace --all-targets -- -D warnings
79 cargo fmt --all --check
80
81# Where a consumer points LD_LIBRARY_PATH.
82libdir:
83 @echo "{{justfile_directory()}}/target/release"
Fetch rustc the way buck can ship it, from what DotSlash already pins 8cf1b33 nandi 19d ago84
85# Regenerate the table buck fetches its toolchains from, after editing any of
86# scripts/*.dotslash. DotSlash stays the one place a version is written down;
87# this only restates it in a form buck can act on.
88sync-dist:
89 scripts/dotslash-to-buck