2013-01-22 00:25:49 -05:00
|
|
|
#! /bin/sh
|
2014-12-10 23:49:55 -05:00
|
|
|
#
|
|
|
|
# Step 1.
|
|
|
|
# Configure for base system so simulator is covered
|
|
|
|
#
|
|
|
|
# Step 2.
|
|
|
|
# Make for iOS arm7 and arm64
|
|
|
|
#
|
|
|
|
# Step 3.
|
|
|
|
# Merge libs into final version for xcode import
|
|
|
|
|
|
|
|
export PREFIX="$(pwd)/libsodium-ios"
|
|
|
|
export IOS_PREFIX="$PREFIX/tmp/osx"
|
|
|
|
export OSX_PREFIX="$PREFIX/tmp/ios"
|
|
|
|
|
2014-12-11 00:21:15 -05:00
|
|
|
mkdir -p $IOS_PREFIX $OSX_PREFIX || exit 1
|
2014-12-10 23:49:55 -05:00
|
|
|
|
|
|
|
# Build for OSX First
|
2014-12-11 00:21:15 -05:00
|
|
|
./configure --disable-shared \
|
|
|
|
--enable-minimal \
|
|
|
|
--prefix="$OSX_PREFIX"
|
|
|
|
|
2014-12-10 23:49:55 -05:00
|
|
|
make clean && make -j3 install
|
|
|
|
|
|
|
|
# Cleanup
|
2014-12-11 00:22:01 -05:00
|
|
|
make distclean
|
2014-12-10 23:49:55 -05:00
|
|
|
|
|
|
|
# Build for iOS
|
2013-11-18 17:59:25 -05:00
|
|
|
export XCODEDIR=$(xcode-select -p)
|
2013-01-22 00:25:49 -05:00
|
|
|
export BASEDIR="${XCODEDIR}/Platforms/iPhoneOS.platform/Developer"
|
|
|
|
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
|
2014-11-20 17:01:35 -05:00
|
|
|
export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
|
|
|
|
export IPHONEOS_VERSION_MIN="5.1.1"
|
2014-12-10 23:49:55 -05:00
|
|
|
export CFLAGS="-Oz -mthumb -arch armv7 -arch arm64 -isysroot ${SDK} -miphoneos-version-min=${IPHONEOS_VERSION_MIN}"
|
|
|
|
export LDFLAGS="-mthumb -arch armv7 -arch arm64 -isysroot ${SDK} -miphoneos-version-min=${IPHONEOS_VERSION_MIN}"
|
2013-01-22 00:25:49 -05:00
|
|
|
|
2013-05-31 01:56:18 -04:00
|
|
|
./configure --host=arm-apple-darwin10 \
|
|
|
|
--disable-shared \
|
2014-08-14 02:32:26 -04:00
|
|
|
--enable-minimal \
|
2014-12-10 23:49:55 -05:00
|
|
|
--prefix="$IOS_PREFIX"
|
|
|
|
|
|
|
|
make clean && make -j3 install
|
|
|
|
|
|
|
|
# Create universal binary and include folder
|
|
|
|
lipo -create "$IOS_PREFIX/lib/libsodium.a" "$OSX_PREFIX/lib/libsodium.a" -output "$PREFIX/libsodium.a"
|
|
|
|
cp -r "$IOS_PREFIX/include" "$PREFIX/include"
|
|
|
|
|
2014-12-11 00:23:24 -05:00
|
|
|
echo "libsodium has been installed into $PREFIX"
|
|
|
|
|
2014-12-10 23:49:55 -05:00
|
|
|
# Cleanup
|
|
|
|
rm -rf "$PREFIX/tmp"
|
2014-12-11 00:23:24 -05:00
|
|
|
make distclean
|