xref: /freebsd/sys/contrib/libsodium/dist-build/osx.sh (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1#! /bin/sh
2
3export PREFIX="$(pwd)/libsodium-osx"
4export OSX_VERSION_MIN=${OSX_VERSION_MIN-"10.8"}
5export OSX_CPU_ARCH=${OSX_CPU_ARCH-"core2"}
6
7mkdir -p $PREFIX || exit 1
8
9export CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g"
10export LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH}"
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./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
21            --prefix="$PREFIX" || exit 1
22
23
24NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
25PROCESSORS=${NPROCESSORS:-3}
26
27make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1
28
29# Cleanup
30make distclean > /dev/null
31