Skip to content

Commit b1a6580

Browse files
committed
added cleaner to docker (not called yet)
1 parent 7b80c45 commit b1a6580

File tree

9 files changed

+48
-8
lines changed

9 files changed

+48
-8
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "wasi-sdk"]
88
path = wasi-sdk
99
url = https://github.com/eqlabs/wasi-sdk.git
10+
[submodule "hook-cleaner-c"]
11+
path = hook-cleaner-c
12+
url = https://github.com/RichardAH/hook-cleaner-c

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ checkout:
88
git submodule update --init --recursive c2wasm-api
99
git submodule update --init --recursive llvm-project
1010
git submodule update --init --recursive wasi-sdk
11+
git submodule update --init --recursive hook-cleaner-c
1112

1213
bin:
1314
mkdir $@
@@ -20,6 +21,7 @@ doc:
2021
build: bin
2122
$(MAKE) -C clang-build
2223
$(MAKE) -C clangd-build
24+
$(MAKE) -C cleaner-build
2325
$(MAKE) -C docker
2426

2527
doc-build: doc
@@ -34,5 +36,6 @@ doc.zip: doc
3436
clean:
3537
$(MAKE) -C clang-build clean
3638
$(MAKE) -C clangd-build clean
39+
$(MAKE) -C cleaner-build clean
3740
$(MAKE) -C docker clean
3841
-rm -rf bin doc

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ even work on computers with less than 8GB of memory (16GB is better),
4343
so the LLVM binaries are maintained in releases of
4444
[xrpl-hooks-compiler](https://github.com/eqlabs/xrpl-hooks-compiler/).
4545
These binaries can be extracted from the file bin.zip in the top-level
46-
directory, providing the results of running `make` in clang-build and
47-
clangd-build directories, so that running the top-level make `build`
48-
target can be replaced by running just the (default) make `build`
49-
target in the docker directory. This also allows skipping the checkout
50-
of the `llvm-project` and `wasi-sdk` submodules; the other submodules
51-
are still needed, so running the `checkout` target should be replaced
52-
by running
46+
directory, providing the results of running `make` in clang-build,
47+
clangd-build and cleaner-build directories, so that running the
48+
top-level make `build` target can be replaced by running just the
49+
(default) make `build` target in the docker directory. This also
50+
allows skipping the checkout of the `llvm-project`, `wasi-sdk` and
51+
`hook-cleaner-c` submodules; the API submodule is still needed, so
52+
running the `checkout` target should be replaced by running
5353

5454
```bash
5555
git submodule update --init c2wasm-api

cleaner-build/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM --platform=linux/amd64 node:17-alpine
2+
MAINTAINER Vaclav Barta "vaclav@equilibrium.co"
3+
RUN apk --no-cache add --update bash build-base
4+
ADD build.sh .
5+
CMD ./build.sh

cleaner-build/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# must be run as root
2+
3+
CLEANER_BUILD_CONTAINER_TAG?=cleaner-build
4+
5+
all: build1 build2 install
6+
7+
build1:
8+
docker build -t $(CLEANER_BUILD_CONTAINER_TAG) .
9+
10+
build2:
11+
docker run -v $(realpath ../hook-cleaner-c):/mnt/hook-cleaner $(CLEANER_BUILD_CONTAINER_TAG):latest
12+
13+
install:
14+
cp ../hook-cleaner-c/cleaner ../bin
15+
16+
clean:
17+
-rm ../hook-cleaner-c/cleaner

cleaner-build/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
echo running build.sh...
4+
set -e
5+
6+
cd /mnt/hook-cleaner
7+
make

docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COPY c2wasm-api/yarn.lock .
1010
COPY c2wasm-api/tsconfig.json .
1111
COPY c2wasm-api/src ./src
1212
COPY wasi-sdk ./clang/wasi-sdk
13+
COPY cleaner /usr/bin
1314
COPY run.sh .
1415
ADD compile_flags.txt /etc/clangd/compile_flags.txt
1516
ADD .clang-tidy /work/.clang-tidy

docker/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
MAIN_CONTAINER_TAG?=xrpl-hooks-compiler
44

5-
build: wasi-sdk c2wasm-api clangd
5+
build: wasi-sdk c2wasm-api clangd cleaner
66
docker build -t $(MAIN_CONTAINER_TAG) .
77

88
run:
@@ -21,6 +21,9 @@ wasi-sdk: ../wasi-sdk.ts
2121
clangd: ../bin/clangd
2222
cp $< .
2323

24+
cleaner: ../bin/cleaner
25+
cp $< .
26+
2427
c2wasm-api: ../c2wasm-api
2528
cp -LR $< .
2629
rm -rf c2wasm-api/.git

hook-cleaner-c

Submodule hook-cleaner-c added at a43e988

0 commit comments

Comments
 (0)