xref: /freebsd/sys/contrib/libsodium/dist-build/nativeclient-x86.sh (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1#! /bin/sh
2
3export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"}
4export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_x86_glibc"}
5export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"}
6export PREFIX="$(pwd)/libsodium-nativeclient-x86"
7export PATH="${NACL_BIN}:$PATH"
8export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr"
9
10mkdir -p $PREFIX || exit 1
11
12make distclean > /dev/null
13
14if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
15  export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
16else
17  export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
18fi
19
20
21./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
22            --host=i686-nacl \
23            --disable-ssp --without-pthreads \
24            --prefix="$PREFIX" || exit 1
25
26NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
27PROCESSORS=${NPROCESSORS:-3}
28
29make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1
30