set shell := ["bash", "-euo", "pipefail", "-c"] # Everything is compiled by zig, including the C and C++ dependencies, so a # build needs no system toolchain — but bindgen runs libclang directly and does # not inherit zig's own header search path. `v4l2r` wants `linux/videodev2.h`, # which lives in /usr/include on a machine with kernel headers installed and # nowhere at all on one without. Point it at zig's bundled copies instead. zig_include := `scripts/zig-include` headers := "-I" + zig_include + " -I" + parent_directory(zig_include) + "/x86-linux-gnu -I" + parent_directory(zig_include) + "/generic-glibc" export V4L2R_VIDEODEV2_H_PATH := zig_include export BINDGEN_EXTRA_CLANG_ARGS := headers default: @just --list # The shared objects, ready to be put on a loader search path. build *args: cargo build --release {{args}} # buck2, with scripts/ reachable two ways, because two things need it # differently. `rustc` is resolved off PATH: the prelude's # system_rust_toolchain hardcodes the bare name and offers no attribute to # override it, so the pinned compiler is selected by shadowing. The C tools are # named by absolute path in .buckconfig.local, which the toolchain reads — # see the note in toolchains/BUCK for why a bare name will not do for those. # # Without the PATH half the build silently uses the host's rustc, which is a # different compiler than the one the cache was populated with. buck *args: printf '[jolt]\n scripts = %s\n rustc_version = %s\n' \ "{{justfile_directory()}}/scripts" \ "$(scripts/rustc --version | tr -d '\n')" > .buckconfig.local PATH="{{justfile_directory()}}/scripts:$PATH" scripts/buck2 {{args}} # The same two objects under buck2, staged into one directory a consumer can # put on its loader path — the same shape `build` leaves in target/release. # # Not the default yet, and only for one reason: cpal's `pipewire` feature is # off here, so device *names* in a call are ALSA PCMs rather than the real OS # sources. See the note in third-party/rust/Cargo.toml. buck-build *args: @just buck build //:libs {{args}} mkdir -p build/lib cp "$(just buck build --show-output //:libvidya | awk '/libvidya.so/{print $2}')" build/lib/libvidya.so cp "$(just buck build --show-output //:libjoltmoq | awk '/libjoltmoq.so/{print $2}')" build/lib/libjoltmoq.so @echo "{{justfile_directory()}}/build/lib" # Where a consumer points LD_LIBRARY_PATH for the buck2 build. buck-libdir: @echo "{{justfile_directory()}}/build/lib" test *args: cargo test --workspace {{args}} # Without PipeWire — for a machine that has neither pkg-config nor PipeWire's # headers. Device *names* get worse (ALSA PCMs only); everything else is equal. test-minimal: cargo test --workspace --no-default-features lint: cargo clippy --workspace --all-targets -- -D warnings cargo fmt --all --check # Where a consumer points LD_LIBRARY_PATH. libdir: @echo "{{justfile_directory()}}/target/release"