diff --git a/watcher-c/cross-compile.sh b/watcher-c/cross-compile.sh index 218be652..198c7089 100755 --- a/watcher-c/cross-compile.sh +++ b/watcher-c/cross-compile.sh @@ -13,11 +13,13 @@ set -e [ "${1:---build}" = --build ] && { [ -d "$(dirname "$0")/out" ] || mkdir "$(dirname "$0")/out" cd "$(dirname "$0")" - linux-cross-compilation-containers/build-containers.sh - [ -f out/meson.build ] || cp meson.build out - [ -d out/src ] || cp -r src out - [ -d out/include ] || cp -r include out - ( + [ -d out/include ] || cp -r ../include out + [ -d out/watcher-c ] || cp -r ../watcher-c out + [ -d out/watcher-py ] || cp -r ../watcher-py out + [ -d out/tool ] || cp -r ../tool out + [ -f out/meson.build ] || cp ../meson.build out + command -v docker &> /dev/null && ( + linux-cross-compilation-containers/build-containers.sh cd out SRC=$PWD docker run --platform linux/amd64 --rm -v "$SRC:/src" meson-builder-x86_64-unknown-linux-gnu:latest @@ -25,8 +27,8 @@ set -e docker run --platform linux/arm/v7 --rm -v "$SRC:/src" meson-builder-armv7-unknown-linux-gnueabihf:latest ) [ "$(uname)" = Darwin ] && { - [ -d out/x86_64-apple-darwin ] || meson setup --cross-file cross-files/x86_64-apple-darwin.txt out/x86_64-apple-darwin - [ -d out/aarch64-apple-darwin ] || meson setup --cross-file cross-files/aarch64-apple-darwin.txt out/aarch64-apple-darwin + [ -d out/x86_64-apple-darwin ] || meson setup --cross-file cross-files/x86_64-apple-darwin.txt out/x86_64-apple-darwin .. + [ -d out/aarch64-apple-darwin ] || meson setup --cross-file cross-files/aarch64-apple-darwin.txt out/aarch64-apple-darwin .. meson compile -C out/x86_64-apple-darwin meson compile -C out/aarch64-apple-darwin } @@ -40,3 +42,7 @@ set -e done echo '---------------------------' } +[ "${1:-}" = --pahole ] && { + s=$(dirname "$0")/out/x86_64-unknown-linux-gnu/watcher-c + docker run --platform linux/amd64 --rm -v "$s:/src" -w /src pahole libwatcher-c-0.11.0.so 2> /dev/null | grep wtr_watcher_event --after-context=10 +} diff --git a/watcher-c/include/wtr/watcher-c.h b/watcher-c/include/wtr/watcher-c.h index 56e459d0..a88a98b9 100644 --- a/watcher-c/include/wtr/watcher-c.h +++ b/watcher-c/include/wtr/watcher-c.h @@ -47,11 +47,11 @@ static const int8_t WTR_WATCHER_PATH_OTHER = 5; The time of the event in nanoseconds since epoch. */ struct wtr_watcher_event { + int64_t effect_time; char const* path_name; + char const* associated_path_name; int8_t effect_type; int8_t path_type; - int64_t effect_time; - char const* associated_path_name; }; /* Ensure the user's callback can receive diff --git a/watcher-c/linux-cross-compilation-containers/Dockerfile.pahole b/watcher-c/linux-cross-compilation-containers/Dockerfile.pahole new file mode 100644 index 00000000..bb96cffd --- /dev/null +++ b/watcher-c/linux-cross-compilation-containers/Dockerfile.pahole @@ -0,0 +1,3 @@ +FROM debian:latest +RUN apt-get update -yqq && apt-get install -yqq pahole +ENTRYPOINT ["pahole"] diff --git a/watcher-c/linux-cross-compilation-containers/build-containers.sh b/watcher-c/linux-cross-compilation-containers/build-containers.sh index 50c645dc..e2743a37 100755 --- a/watcher-c/linux-cross-compilation-containers/build-containers.sh +++ b/watcher-c/linux-cross-compilation-containers/build-containers.sh @@ -1,6 +1,7 @@ #! /usr/bin/env bash set -e cd "$(dirname "$0")" +docker build -t pahole --platform linux/amd64 . -f Dockerfile.pahole docker build -t meson-builder-x86_64-unknown-linux-gnu --build-arg BUILD_DIR=x86_64-unknown-linux-gnu --platform linux/amd64 . docker build -t meson-builder-aarch64-unknown-linux-gnu --build-arg BUILD_DIR=aarch64-unknown-linux-gnu --platform linux/arm64 . docker build -t meson-builder-armv7-unknown-linux-gnueabihf --build-arg BUILD_DIR=armv7-unknown-linux-gnueabihf --platform linux/arm/v7 .