-
Notifications
You must be signed in to change notification settings - Fork 1
/
xbuild-debianbookworm.sh
66 lines (55 loc) · 1.23 KB
/
xbuild-debianbookworm.sh
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
#!/bin/bash
# netmill: cross-build on Linux for Debian-bookworm
set -xe
if ! test -d "../netmill" ; then
exit 1
fi
if ! podman container exists netmill_debianbookworm_build ; then
if ! podman image exists netmill-debianbookworm-builder ; then
# Create builder image
cat <<EOF | podman build -t netmill-debianbookworm-builder -f - .
FROM debian:bookworm-slim
RUN apt update && \
apt install -y \
make
RUN apt install -y \
gcc g++
RUN apt install -y \
clang llvm
RUN apt install -y \
libelf-dev \
zstd unzip p7zip \
cmake patch dos2unix curl
RUN apt install -y \
netcat-traditional dnsutils
EOF
fi
# Create builder container
podman create --attach --tty \
-v `pwd`/..:/src \
--name netmill_debianbookworm_build \
netmill-debianbookworm-builder \
bash -c 'cd /src/netmill && source ./build_linux.sh'
fi
# Prepare build script
cat >build_linux.sh <<EOF
set -xe
make -j8 zlib \
-C ../ffpack
make -j8 openssl bpf xdp \
-C 3pt
mkdir -p _linux-amd64
make -j8 \
-C _linux-amd64 \
-f ../Makefile \
ROOT_DIR=../.. \
$@
make -j8 app \
-C _linux-amd64 \
-f ../Makefile \
ROOT_DIR=../..
cd _linux-amd64/netmill-0
bash /src/netmill/test.sh all
EOF
# Build inside the container
podman start --attach netmill_debianbookworm_build