aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci/build.sh
blob: 38127edc123928eb04687b63f5210209f5e5c83a (plain)
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
#!/bin/bash
set -e

cd "$(dirname "$0")"/../..
./bootstrap
./configure \
	--host=${TARGET_ARCH} --build=${BUILD_ARCH:-x86_64-linux-gnu} \
	--prefix=/opt/odp \
	${CONF}

make clean

make -j $(nproc)

make install

pushd ${HOME}

# Fix build on CentOS
PKG_CONFIG="${TARGET_ARCH}-pkg-config"
if ! [ -x "$(command -v ${PKG_CONFIG})" ]; then
        PKG_CONFIG="pkg-config"
fi

# Default ODP library name
if [ -z "$ODP_LIB_NAME" ] ; then
ODP_LIB_NAME=libodp-dpdk
fi

# Additional warning checks
EXTRA_CHECKS="-Werror -Wall -Wextra -Wconversion -Wfloat-equal -Wpacked"
# Ignore clang warning about large atomic operations causing significant performance penalty
if [ "${CC#clang}" != "${CC}" ] ; then
	EXTRA_CHECKS="${EXTRA_CHECKS} -Wno-unknown-warning-option -Wno-atomic-alignment"
fi
# Ignore warnings from aarch64 DPDK internals
if [ "${TARGET_ARCH}" == "aarch64-linux-gnu" ] ; then
	EXTRA_CHECKS="${EXTRA_CHECKS} -Wno-conversion -Wno-packed"
fi

CC="${CC:-${TARGET_ARCH}-gcc}"
${CC} ${CFLAGS} ${EXTRA_CHECKS} ${OLDPWD}/example/hello/odp_hello.c -o odp_hello_inst_dynamic \
	`PKG_CONFIG_PATH=/opt/odp/lib/pkgconfig ${PKG_CONFIG} --cflags --libs ${ODP_LIB_NAME}` \
	`${PKG_CONFIG} --cflags --libs libdpdk`

sysctl vm.nr_hugepages=1000
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge

if [ -z "$TARGET_ARCH" ] || [ "$TARGET_ARCH" == "$BUILD_ARCH" ]
then
	LD_LIBRARY_PATH="/opt/odp/lib:$LD_LIBRARY_PATH" ./odp_hello_inst_dynamic
fi
popd

#dpdk wrapper script can umount hugepages itself
umount /mnt/huge || true