-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·42 lines (39 loc) · 1012 Bytes
/
build.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
#!/bin/bash
build() (
local dir="$1"; shift
cd "$dir"
cmake -DCMAKE_INSTALL_PREFIX=$PWD/../install "$@" .
make -j9
make install
)
clone() (
local dir="$1"
local url="$2"
if [ -d "$dir" ]; then
cd "$dir"
git pull --rebase
else
git clone "$url" "$dir"
fi
)
UNAME="$(uname)"
set -e -x
rm -rf install
mkdir -p install
ln -s lib install/lib64
clone libubox git://git.openwrt.org/project/libubox.git
build libubox -DBUILD_LUA=off -DCMAKE_POSITION_INDEPENDENT_CODE=on
if [ "$UNAME" = "Linux" ]; then
clone libnl-tiny git://git.openwrt.org/project/libnl-tiny.git
build libnl-tiny -DBUILD_LUA=off -DCMAKE_POSITION_INDEPENDENT_CODE=on
clone libbpf https://github.com/libbpf/libbpf
make -j9 -C libbpf/src PREFIX=$PWD/install all install
fi
rm -f install/lib/*.{so,dylib}
if [ "$UNAME" = "Linux" ]; then
mv install/include/libnl-tiny/* install/include/
fi
export CFLAGS=-I$PWD/install/include
export LDFLAGS=-L$PWD/install/lib
cmake -DCMAKE_FIND_ROOT_PATH=$PWD/install -DUBUS_SUPPORT=off .
make -j9