freebsd-dev/sys/contrib/libsodium/dist-build/nativeclient-pnacl.sh
Conrad Meyer 0ac341f145 Bring in libsodium to sys/contrib
Bring in https://github.com/jedisct1/libsodium at
461ac93b260b91db8ad957f5a576860e3e9c88a1 (August 7, 2018), unmodified.

libsodium is derived from Daniel J. Bernstein et al.'s 2011 NaCl
("Networking and Cryptography Library," pronounced "salt") software library.
At the risk of oversimplifying, libsodium primarily exists to make it easier
to use NaCl.  NaCl and libsodium provide high quality implementations of a
number of useful cryptographic concepts (as well as the underlying
primitics) seeing some adoption in newer network protocols.

I considered but dismissed cleaning up the directory hierarchy and
discarding artifacts of other build systems in favor of remaining close to
upstream (and easing future updates).

Nothing is integrated into the build system yet, so in that sense, no
functional change.
2018-08-17 00:23:50 +00:00

38 lines
1.2 KiB
Bash
Executable File

#! /bin/sh
export NACL_SDK_ROOT=${NACL_SDK_ROOT-"/opt/nacl_sdk/pepper_49"}
export NACL_TOOLCHAIN=${NACL_TOOLCHAIN-"${NACL_SDK_ROOT}/toolchain/mac_pnacl"}
export NACL_BIN=${NACL_BIN-"${NACL_TOOLCHAIN}/bin"}
export PREFIX="$(pwd)/libsodium-nativeclient"
export PATH="${NACL_BIN}:$PATH"
export AR=${AR-"pnacl-ar"}
export AS=${AS-"pnacl-as"}
export CC=${CC-"pnacl-clang"}
export LD=${LD-"pnacl-ld"}
export NM=${NM-"pnacl-nm"}
export RANLIB=${RANLIB-"pnacl-ranlib"}
export PNACL_FINALIZE=${PNACL_FINALIZE-"pnacl-finalize"}
export PNACL_TRANSLATE=${PNACL_TRANSLATE-"pnacl-translate"}
export CFLAGS="-O3 -fomit-frame-pointer -fforce-addr"
mkdir -p $PREFIX || exit 1
make distclean > /dev/null
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--host=nacl \
--disable-ssp --without-pthreads \
--prefix="$PREFIX" || exit 1
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1