xref: /freebsd/sys/contrib/libsodium/dist-build/osx.sh (revision 3611ec604864a7d4dcc9a3ea898c80eb35eef8a0)
1*0ac341f1SConrad Meyer#! /bin/sh
2*0ac341f1SConrad Meyer
3*0ac341f1SConrad Meyerexport PREFIX="$(pwd)/libsodium-osx"
4*0ac341f1SConrad Meyerexport OSX_VERSION_MIN=${OSX_VERSION_MIN-"10.8"}
5*0ac341f1SConrad Meyerexport OSX_CPU_ARCH=${OSX_CPU_ARCH-"core2"}
6*0ac341f1SConrad Meyer
7*0ac341f1SConrad Meyermkdir -p $PREFIX || exit 1
8*0ac341f1SConrad Meyer
9*0ac341f1SConrad Meyerexport CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g"
10*0ac341f1SConrad Meyerexport LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH}"
11*0ac341f1SConrad Meyer
12*0ac341f1SConrad Meyermake distclean > /dev/null
13*0ac341f1SConrad Meyer
14*0ac341f1SConrad Meyerif [ -z "$LIBSODIUM_FULL_BUILD" ]; then
15*0ac341f1SConrad Meyer  export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
16*0ac341f1SConrad Meyerelse
17*0ac341f1SConrad Meyer  export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
18*0ac341f1SConrad Meyerfi
19*0ac341f1SConrad Meyer
20*0ac341f1SConrad Meyer./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
21*0ac341f1SConrad Meyer            --prefix="$PREFIX" || exit 1
22*0ac341f1SConrad Meyer
23*0ac341f1SConrad Meyer
24*0ac341f1SConrad MeyerNPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
25*0ac341f1SConrad MeyerPROCESSORS=${NPROCESSORS:-3}
26*0ac341f1SConrad Meyer
27*0ac341f1SConrad Meyermake -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1
28*0ac341f1SConrad Meyer
29*0ac341f1SConrad Meyer# Cleanup
30*0ac341f1SConrad Meyermake distclean > /dev/null
31