-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbuild-app.sh
More file actions
executable file
·46 lines (33 loc) · 1.54 KB
/
build-app.sh
File metadata and controls
executable file
·46 lines (33 loc) · 1.54 KB
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
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
BUILD_ARGS=""
BUILD_DIR="debug"
if [[ "$1" == "--release" ]]; then
BUILD_ARGS="--release"
BUILD_DIR="release"
fi
cd "$SCRIPT_DIR"
FEATURES="freebsd"
FEATURE_ARG=""
if [ -n "$FEATURES" ]; then
FEATURE_ARG="-F $FEATURES"
fi
export PKG_CONFIG_PATH="/opt/homebrew/opt/util-linux/lib/pkgconfig"
(cd "anylinuxfs" && cargo build $BUILD_ARGS $FEATURE_ARG)
mkdir -p bin && cp "anylinuxfs/target/$BUILD_DIR/anylinuxfs" bin/
codesign --entitlements "anylinuxfs.entitlements" --force -s - bin/anylinuxfs
ROOTFS_PATH=~/.anylinuxfs/alpine/rootfs
(cd "vmproxy" && cargo build $BUILD_ARGS $FEATURE_ARG)
mkdir -p libexec && cp "vmproxy/target/aarch64-unknown-linux-musl/$BUILD_DIR/vmproxy" libexec/
(cd "init-rootfs" && go build -ldflags="-w -s" -tags containers_image_openpgp -o ../libexec/)
codesign --entitlements "anylinuxfs.entitlements" --force -s - libexec/init-rootfs
(cd "freebsd-bootstrap" && CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -tags netgo -ldflags '-extldflags "-static" -w -s' -o ../libexec/)
SYSROOT=freebsd-sysroot
(cd "vmproxy" \
&& test -d $SYSROOT \
|| (mkdir $SYSROOT && cd $SYSROOT \
&& curl -LO http://ftp.cz.freebsd.org/pub/FreeBSD/releases/arm64/14.3-RELEASE/base.txz \
&& tar xJf base.txz 2>/dev/null || true && rm base.txz) \
&& cargo +nightly-2026-01-25 build -Z build-std --target aarch64-unknown-freebsd $BUILD_ARGS)
cp "vmproxy/target/aarch64-unknown-freebsd/$BUILD_DIR/vmproxy" libexec/vmproxy-bsd