1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-28 22:21:15 -07:00
libsodium/dist-build/osx.sh

31 lines
862 B
Bash
Raw Normal View History

2015-04-19 02:18:08 -07:00
#! /bin/sh
export PREFIX="$(pwd)/libsodium-osx"
export OSX_VERSION_MIN=${OSX_VERSION_MIN-"10.10"}
2015-04-19 02:18:08 -07:00
export OSX_CPU_ARCH=${OSX_CPU_ARCH-"core2"}
mkdir -p $PREFIX || exit 1
2017-12-30 16:56:51 -07:00
export CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g"
export LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH}"
2015-04-19 02:18:08 -07:00
make distclean > /dev/null
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
2018-03-06 13:20:17 -07:00
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
2015-04-19 02:18:08 -07:00
--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
2015-04-19 02:18:08 -07:00
# Cleanup
make distclean > /dev/null