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

Paint the same tree into a terminal, for the machines with no window a7f6202 · on c4f56b0a96ecb29336e2cf16c522b794ae62ad3f · nandi · 17d ago
justfile · 101 lines · 4.5 KBMakefile Blame HistoryRaw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
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, told where the C tools are. They are named by absolute path because
# the prelude re-execs them from a build script's own directory — see the note
# in toolchains/BUCK. rustc is not here: buck fetches it itself now, so it
# needs neither a path nor a place on PATH.
#
# The zig version goes in for the same reason the paths do not carry it: the
# path stays the same when the binary behind it changes, and the cache cannot
# tell.
buck *args:
    printf '[jolt]\n  scripts = %s\n  zig_version = %s\n' \
        "{{justfile_directory()}}/scripts" \
        "$(scripts/zig version | tr -d '\n')" > .buckconfig.local
    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
    cp "$(just buck build --show-output //:libjolttui | awk '/libjolttui.so/{print $2}')" build/lib/libjolttui.so
    @echo "{{justfile_directory()}}/build/lib"

# Where a consumer points LD_LIBRARY_PATH for the buck2 build.
buck-libdir:
    @echo "{{justfile_directory()}}/build/lib"

# Both objects, cross-compiled for a 64-bit Android device and staged where an
# APK build can pick them up. libjoltmoq crosses too now — its camera is
# Camera2 over JNI rather than V4L2, and its audio is cpal's AAudio host rather
# than PipeWire. The camera needs two things from the APK, though, which this
# recipe cannot supply: a `CameraCapture` class in its classes.dex (frq has
# one), and a call to joltmoq_android_init. See android/jolt_main.c.
#
# The NDK is fetched by buck2 from the pin in scripts/android-ndk.dotslash, so
# the only thing a machine needs installed for this is nothing.
ffi-android:
    @just buck build //:libs-android
    mkdir -p build/android/arm64-v8a
    cp "$(just buck build --show-output //:libvidya-android | awk '/libvidya.so/{print $2}')" \
        build/android/arm64-v8a/libvidya.so
    cp "$(just buck build --show-output //:libjoltmoq-android | awk '/libjoltmoq.so/{print $2}')" \
        build/android/arm64-v8a/libjoltmoq.so
    @echo "{{justfile_directory()}}/build/android/arm64-v8a"

# Where an APK build finds the Android objects, and the glue beside them.
android-libdir:
    @echo "{{justfile_directory()}}/build/android/arm64-v8a"

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"

# Regenerate the table buck fetches its toolchains from, after editing any of
# scripts/*.dotslash. DotSlash stays the one place a version is written down;
# this only restates it in a form buck can act on.
sync-dist:
    scripts/dotslash-to-buck

# Regenerate third-party/rust/BUCK. Runs reindeer, then rewrites the git
# dependencies into archive fetches so no action in the graph requires a local
# worker — see scripts/buckify.
buckify:
    scripts/buckify