2017-08-11 05:40:37 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "${BASH_SOURCE%/*}/../External/libjson-c"
|
|
|
|
[[ -d libjson-c-osx ]] && exit
|
|
|
|
|
|
|
|
# Prepare
|
2017-08-31 19:14:08 +00:00
|
|
|
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
2017-08-11 05:40:37 +00:00
|
|
|
rm -rf "${prefix=$PWD/libjson-c-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 $CFLAGS" # -flto
|
|
|
|
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} $LDFLAGS" # -flto
|
|
|
|
export CPPFLAGS="$CFLAGS $CPPFLAGS"
|
|
|
|
[[ -e Makefile ]] && make -s really-clean
|
2017-08-11 05:40:37 +00:00
|
|
|
./configure --disable-shared --prefix="$prefix"
|
2017-08-31 19:14:08 +00:00
|
|
|
make -j3 check
|
2017-08-11 05:40:37 +00:00
|
|
|
make -j3 install
|
|
|
|
)
|
|
|
|
|
|
|
|
# Cleanup
|
2017-08-31 19:14:08 +00:00
|
|
|
make -s really-clean
|