xref: /freebsd/sys/contrib/libsodium/dist-build/nativeclient-pnacl.sh (revision 02e9120893770924227138ba49df1edb3896112a)
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_pnacl"}
5export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"}
6export PREFIX="$(pwd)/libsodium-nativeclient"
7export PATH="${NACL_BIN}:$PATH"
8export AR=${AR-"pnacl-ar"}
9export AS=${AS-"pnacl-as"}
10export CC=${CC-"pnacl-clang"}
11export LD=${LD-"pnacl-ld"}
12export NM=${NM-"pnacl-nm"}
13export RANLIB=${RANLIB-"pnacl-ranlib"}
14export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"}
15export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"}
16export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr"
17
18mkdir -p $PREFIX || exit 1
19
20make distclean > /dev/null
21
22if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
23  export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
24else
25  export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
26fi
27
28./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
29            --host=nacl \
30            --disable-ssp --without-pthreads \
31            --prefix="$PREFIX" || exit 1
32
33
34NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
35PROCESSORS=${NPROCESSORS:-3}
36
37make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1
38