| Lift freeq's AV media plane out of sleek 90f8b89 nandi 20d ago | 1 | set 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. |
| 8 | zig_include := `scripts/zig-include` |
| 9 | headers := "-I" + zig_include + " -I" + parent_directory(zig_include) + "/x86-linux-gnu -I" + parent_directory(zig_include) + "/generic-glibc" |
| 10 | |
| 11 | export V4L2R_VIDEODEV2_H_PATH := zig_include |
| 12 | export BINDGEN_EXTRA_CLANG_ARGS := headers |
| 13 | |
| 14 | default: |
| 15 | @just --list |
| 16 | |
| 17 | # The shared objects, ready to be put on a loader search path. |
| 18 | build *args: |
| 19 | cargo build --release {{args}} |
| 20 | |
| Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 20d ago | 21 | # buck2, with scripts/ reachable two ways, because two things need it |
| 22 | # differently. `rustc` is resolved off PATH: the prelude's |
| 23 | # system_rust_toolchain hardcodes the bare name and offers no attribute to |
| 24 | # override it, so the pinned compiler is selected by shadowing. The C tools are |
| 25 | # named by absolute path in .buckconfig.local, which the toolchain reads — |
| 26 | # see the note in toolchains/BUCK for why a bare name will not do for those. |
| 27 | # |
| 28 | # Without the PATH half the build silently uses the host's rustc, which is a |
| 29 | # different compiler than the one the cache was populated with. |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 20d ago | 30 | buck *args: |
| Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 20d ago | 31 | printf '[jolt]\n scripts = %s\n rustc_version = %s\n' \ |
| 32 | "{{justfile_directory()}}/scripts" \ |
| 33 | "$(scripts/rustc --version | tr -d '\n')" > .buckconfig.local |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 20d ago | 34 | PATH="{{justfile_directory()}}/scripts:$PATH" scripts/buck2 {{args}} |
| 35 | |
| Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 20d ago | 36 | # The same two objects under buck2, staged into one directory a consumer can |
| 37 | # put on its loader path — the same shape `build` leaves in target/release. |
| 38 | # |
| 39 | # Not the default yet, and only for one reason: cpal's `pipewire` feature is |
| 40 | # off here, so device *names* in a call are ALSA PCMs rather than the real OS |
| 41 | # sources. See the note in third-party/rust/Cargo.toml. |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 20d ago | 42 | buck-build *args: |
| 43 | @just buck build //:libs {{args}} |
| Build both objects under buck2, against the BuildBuddy cache 600f207 nandi 20d ago | 44 | mkdir -p build/lib |
| 45 | cp "$(just buck build --show-output //:libvidya | awk '/libvidya.so/{print $2}')" build/lib/libvidya.so |
| 46 | cp "$(just buck build --show-output //:libjoltmoq | awk '/libjoltmoq.so/{print $2}')" build/lib/libjoltmoq.so |
| 47 | @echo "{{justfile_directory()}}/build/lib" |
| 48 | |
| 49 | # Where a consumer points LD_LIBRARY_PATH for the buck2 build. |
| 50 | buck-libdir: |
| 51 | @echo "{{justfile_directory()}}/build/lib" |
| Build under buck2, with the toolchain pinned rather than found 460541b nandi 20d ago | 52 | |
| Lift freeq's AV media plane out of sleek 90f8b89 nandi 20d ago | 53 | test *args: |
| 54 | cargo test --workspace {{args}} |
| 55 | |
| 56 | # Without PipeWire — for a machine that has neither pkg-config nor PipeWire's |
| 57 | # headers. Device *names* get worse (ALSA PCMs only); everything else is equal. |
| 58 | test-minimal: |
| 59 | cargo test --workspace --no-default-features |
| 60 | |
| 61 | lint: |
| 62 | cargo clippy --workspace --all-targets -- -D warnings |
| 63 | cargo fmt --all --check |
| 64 | |
| 65 | # Where a consumer points LD_LIBRARY_PATH. |
| 66 | libdir: |
| 67 | @echo "{{justfile_directory()}}/target/release" |