2017-08-11 05:40:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "${BASH_SOURCE%/*}/../External/libsodium"
|
2017-09-01 15:16:09 +00:00
|
|
|
[[ -e "${prefix=$PWD/libsodium-osx}/lib/libsodium.a" ]] && exit
|
2017-08-11 05:40:37 +00:00
|
|
|
|
|
|
|
# Inspired by libsodium/dist-build/osx.sh
|
|
|
|
# Prepare
|
2017-08-31 19:14:08 +00:00
|
|
|
autoreconf --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
2017-08-11 05:40:37 +00:00
|
|
|
rm -rf "${prefix=$PWD/libsodium-osx}"
|
|
|
|
mkdir -p "$prefix"
|
|
|
|
|
2017-08-31 19:14:08 +00:00
|
|
|
# Targets
|
2017-08-11 05:40:37 +00:00
|
|
|
(
|
|
|
|
## ARCH: x86_64
|
2017-08-31 19:14:08 +00:00
|
|
|
export SDKROOT="$(xcrun --show-sdk-path --sdk macosx)"
|
|
|
|
export PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH"
|
|
|
|
export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -g -flto $CFLAGS"
|
|
|
|
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -flto $LDFLAGS"
|
|
|
|
export CPPFLAGS="$CFLAGS $CPPFLAGS"
|
2017-08-11 05:40:37 +00:00
|
|
|
[[ -e Makefile ]] && make -s distclean
|
|
|
|
./configure --disable-shared --prefix="$prefix"
|
|
|
|
make -j3 check
|
|
|
|
make -j3 install
|
|
|
|
)
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
make -s distclean
|