aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 6adfcb75473236798b5f6fec3d4f3a72cc79fcd2 (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
set -e

# GO build options
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64

# Checking for build programs
if ! command -v go 2>&1 /dev/null; then
    echo "Unable to find go"
    exit 1
fi
if ! command -v make 2>&1 /dev/null; then
    echo "Unable to find make"
    exit 1
fi
if ! command -v autoconf 2>&1 /dev/null; then
    echo "Unable to find autoconf"
    exit 1
fi
if ! command -v patchelf 2>&1 /dev/null; then
    echo "Unable to find patchelf"
    exit 1
fi
if ! command -v sed 2>&1 /dev/null; then
    echo "Unable to find sed"
    exit 1
fi
if ! command -v minisign 2>&1 /dev/null; then
    echo "Unable to find minisign"
    exit 1
fi

if [ ! -f ./verifyConfig.go ]; then
    echo "Unable to find verifyConfig.go"
    exit 1
fi

if [ ! -f ./graphic.bvg ]; then
    echo "Unable to find graphic.bvg"
    exit 1
fi

mkdir -p fsverify_root/bin
mkdir -p fsverify_root/share
mkdir -p fsverify_root/lib

echo "Building raylib"
git submodule init
git submodule update
cd raylib/src
make PLATFORM=PLATFORM_DRM RAYLIB_LIBTYPE=SHARED
cd ../..
mkdir include
cp raylib/src/libraylib.so fsverify_root/lib/libraylib.so
cp raylib/src/raylib.h include/raylib.h

echo "Building fbwarn"
cd fbwarn
autoreconf --install
./configure CFLAGS="-O2 -std=gnu99 -DEGL_NO_X11 -DLPATFORM_DRM -I../../include -L../../fsverify_root/lib"
make
patchelf --replace-needed libraylib.so.500 /fsverify/lib/libraylib.so src/fbwarn
cp src/fbwarn ../fsverify_root/bin/fbwarn
cd ..
cp graphic.bvg fsverify_root/share/warn.bvg

echo "Configuring fsverify"
sed 's|FBWARNLOCATION|"/fsverify/bin/fbwarn"|g' ./verifyConfig.go > ./verifyConfig.go.tmp
sed 's|BVGLOCATION|"/fsverify/share/warn.bvg"|g' ./verifyConfig.go.tmp > verify/config/config.go

echo "Building fsverify"
cd verify
go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ../fsverify_root/bin/fsverify
gcc getScreensize.c -o ../fsverify_root/bin/getscreensize
cd ..

echo "Building verifysetup"
cd verifysetup
go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ../fsverify_root/bin/verifysetup
cd ..

echo "Done."