#!/usr/bin/env bash # Compiles src/main/c/vtpinning.c into libvtpinning.so, linked against the JNI headers of # whichever JDK is on JAVA_HOME (any JDK's jni.h works - the JNI ABI is stable across versions; # this repo built it once against JDK 21's headers and loads it fine under JDK 21 and JDK 25). # The .so is NOT committed to the repo; run this before the other scripts. set -euo pipefail cd "$(dirname "$0")/.." : "${JAVA_HOME:?Set JAVA_HOME to a JDK install (its include/ dir must have jni.h)}" mkdir -p target/native gcc -shared -fPIC \ -I"$JAVA_HOME/include" \ -I"$JAVA_HOME/include/linux" \ -o target/native/libvtpinning.so \ src/main/c/vtpinning.c echo "Built target/native/libvtpinning.so"