Skip to content

Commit

Permalink
watcher-c/build: get cross-compilation back in order
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Jul 25, 2024
1 parent e34db5d commit de2165a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
20 changes: 13 additions & 7 deletions watcher-c/cross-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ 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
docker run --platform linux/arm64 --rm -v "$SRC:/src" meson-builder-aarch64-unknown-linux-gnu:latest
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
}
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions watcher-c/include/wtr/watcher-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM debian:latest
RUN apt-get update -yqq && apt-get install -yqq pahole
ENTRYPOINT ["pahole"]
Original file line number Diff line number Diff line change
@@ -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 .

0 comments on commit de2165a

Please sign in to comment.