Sync build scripts with 1.0.20

This commit is contained in:
Frank Denis 2023-09-11 19:15:18 +02:00
parent 443617d750
commit d1177e2eb8
12 changed files with 42 additions and 308 deletions

View File

@ -12,6 +12,7 @@ safer to use than AES-GCM. They can also be used as high-performance MACs.
now available in the `crypto_kdf_hkdf_*()` namespace. It is implemented for
the SHA-256 and SHA-512 hash functions.
- The `osx.sh` build script was renamed to `macos.sh`.
- Support for android-mips was removed.
* Version 1.0.18-stable
- Visual Studio: support for Windows/ARM64 builds has been added.

View File

@ -1,17 +1,14 @@
EXTRA_DIST = \
android-build.sh \
android-arm.sh \
android-aar.sh \
android-armv7-a.sh \
android-armv8-a.sh \
android-mips32.sh \
android-mips64.sh \
android-x86.sh \
android-x86_64.sh \
emscripten.sh \
ios.sh \
apple-xcframework.sh \
macos.sh \
msys2-win32.sh \
msys2-win64.sh \
watchos.sh \
wasm32-wasi.sh

View File

@ -301,19 +301,16 @@ valgrind_enabled_tools = @valgrind_enabled_tools@
valgrind_tools = @valgrind_tools@
EXTRA_DIST = \
android-build.sh \
android-arm.sh \
android-aar.sh \
android-armv7-a.sh \
android-armv8-a.sh \
android-mips32.sh \
android-mips64.sh \
android-x86.sh \
android-x86_64.sh \
emscripten.sh \
ios.sh \
apple-xcframework.sh \
macos.sh \
msys2-win32.sh \
msys2-win64.sh \
watchos.sh \
wasm32-wasi.sh
all: all-am

View File

@ -1,4 +0,0 @@
#!/bin/sh
export TARGET_ARCH=armv6
export CFLAGS="-Os -mthumb -marm -march=${TARGET_ARCH}"
ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"

View File

@ -1,4 +0,0 @@
#!/bin/sh
export TARGET_ARCH=mips32
export CFLAGS="-Os"
ARCH=mips HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh"

View File

@ -1,4 +0,0 @@
#!/bin/sh
export TARGET_ARCH=mips64r6
export CFLAGS="-Os -march=${TARGET_ARCH}"
CC="mips64el-linux-android-gcc" NDK_PLATFORM=android-21 ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh"

View File

@ -71,7 +71,7 @@ build_macos() {
## macOS arm64
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
export CFLAGS="-O2 -arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
export LDFLAGS="-arch arm64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -81,7 +81,7 @@ build_macos() {
fi
## macOS x86_64
export CFLAGS="-O2 -arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
export CFLAGS="-Ofast -arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -96,7 +96,7 @@ build_ios() {
export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
## 32-bit iOS
export CFLAGS="-O2 -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export CFLAGS="-Ofast -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -105,7 +105,7 @@ build_ios() {
make -j${PROCESSORS} install || exit 1
## 32-bit armv7s iOS
export CFLAGS="-O2 -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export CFLAGS="-Ofast -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -114,7 +114,7 @@ build_ios() {
make -j${PROCESSORS} install || exit 1
## 64-bit iOS
export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -130,7 +130,7 @@ build_ios_simulator() {
## arm64 simulator
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -140,7 +140,7 @@ build_ios_simulator() {
fi
## i386 simulator
export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -149,7 +149,7 @@ build_ios_simulator() {
make -j${PROCESSORS} install || exit 1
## x86_64 simulator
export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -164,7 +164,7 @@ build_watchos() {
export SDK="${BASEDIR}/SDKs/WatchOS.sdk"
# 32-bit watchOS
export CFLAGS="-O2 -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export CFLAGS="-Ofast -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export LDFLAGS="-mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -173,7 +173,7 @@ build_watchos() {
make -j${PROCESSORS} install || exit 1
## 64-bit arm64_32 watchOS
export CFLAGS="-O2 -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export CFLAGS="-Ofast -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export LDFLAGS="-mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -182,7 +182,7 @@ build_watchos() {
make -j${PROCESSORS} install || exit 1
## 64-bit arm64 watchOS
export CFLAGS="-O2 -mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export CFLAGS="-Ofast -mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export LDFLAGS="-mthumb -arch arm64 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -198,7 +198,7 @@ build_watchos_simulator() {
## arm64 simulator
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -208,7 +208,7 @@ build_watchos_simulator() {
fi
## i386 simulator
export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -217,7 +217,7 @@ build_watchos_simulator() {
make -j${PROCESSORS} install || exit 1
## x86_64 simulator
export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -232,7 +232,7 @@ build_tvos() {
export SDK="${BASEDIR}/SDKs/AppleTVOS.sdk"
## 64-bit tvOS
export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mtvos-version-min=${TVOS_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -248,7 +248,7 @@ build_tvos_simulator() {
## arm64 simulator
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
export CFLAGS="-O2 -arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch arm64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -258,7 +258,7 @@ build_tvos_simulator() {
fi
## x86_64 simulator
export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
export CFLAGS="-Ofast -arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mtvos-simulator-version-min=${TVOS_SIMULATOR_VERSION_MIN}"
make distclean >/dev/null 2>&1
@ -304,7 +304,7 @@ build_catalyst() {
## arm64 catalyst
if [ "$APPLE_SILICON_SUPPORTED" = "true" ]; then
export CFLAGS="-O2 -arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
export CFLAGS="-Ofast -arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
export LDFLAGS="-arch arm64 -target arm64-apple-ios13.1-macabi -isysroot ${SDK}"
make distclean >/dev/null 2>&1
@ -314,7 +314,7 @@ build_catalyst() {
fi
## x86_64 catalyst
export CFLAGS="-O2 -arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
export CFLAGS="-Ofast -arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
export LDFLAGS="-arch x86_64 -target x86_64-apple-ios13.1-macabi -isysroot ${SDK}"
make distclean >/dev/null 2>&1

View File

@ -34,8 +34,8 @@ symbols() {
fi
done
}
} | \
sort | \
} |
sort |
{
out='"_malloc","_free"'
while read symbol; do
@ -49,11 +49,11 @@ symbols() {
}
out=$(symbols standard)
sed s/EXPORTED_FUNCTIONS_STANDARD=\'.*\'/EXPORTED_FUNCTIONS_STANDARD=\'${out}\'/ < emscripten.sh > emscripten.sh.tmp && \
sed s/EXPORTED_FUNCTIONS_STANDARD=\'.*\'/EXPORTED_FUNCTIONS_STANDARD=\'${out}\'/ <emscripten.sh >emscripten.sh.tmp &&
mv -f emscripten.sh.tmp emscripten.sh
out=$(symbols sumo)
sed s/EXPORTED_FUNCTIONS_SUMO=\'.*\'/EXPORTED_FUNCTIONS_SUMO=\'${out}\'/ < emscripten.sh > emscripten.sh.tmp && \
sed s/EXPORTED_FUNCTIONS_SUMO=\'.*\'/EXPORTED_FUNCTIONS_SUMO=\'${out}\'/ <emscripten.sh >emscripten.sh.tmp &&
mv -f emscripten.sh.tmp emscripten.sh
chmod +x emscripten.sh

View File

@ -1,135 +0,0 @@
#! /bin/sh
#
# Step 1.
# Configure for base system so simulator is covered
#
# Step 2.
# Make for iOS and iOS simulator
#
# Step 3.
# Merge libs into final version for xcode import
export PREFIX="$(pwd)/libsodium-ios"
export IOS32_PREFIX="$PREFIX/tmp/ios32"
export IOS32s_PREFIX="$PREFIX/tmp/ios32s"
export IOS64_PREFIX="$PREFIX/tmp/ios64"
export SIMULATOR32_PREFIX="$PREFIX/tmp/simulator32"
export SIMULATOR64_PREFIX="$PREFIX/tmp/simulator64"
export XCODEDIR=$(xcode-select -p)
export IOS_SIMULATOR_VERSION_MIN=${IOS_SIMULATOR_VERSION_MIN-"6.0.0"}
export IOS_VERSION_MIN=${IOS_VERSION_MIN-"6.0.0"}
echo
echo "Warnings related to headers being present but not usable are due to functions"
echo "that didn't exist in the specified minimum iOS version level."
echo "They can be safely ignored."
echo
mkdir -p $SIMULATOR32_PREFIX $SIMULATOR64_PREFIX $IOS32_PREFIX $IOS32s_PREFIX $IOS64_PREFIX || exit 1
# Build for the simulator
export BASEDIR="${XCODEDIR}/Platforms/iPhoneSimulator.platform/Developer"
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
export SDK="${BASEDIR}/SDKs/iPhoneSimulator.sdk"
## i386 simulator
export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch i386 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean > /dev/null
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure --host=i686-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR32_PREFIX" || exit 1
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
make -j${PROCESSORS} install || exit 1
## x86_64 simulator
export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mios-simulator-version-min=${IOS_SIMULATOR_VERSION_MIN}"
make distclean > /dev/null
./configure --host=x86_64-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR64_PREFIX"
make -j${PROCESSORS} install || exit 1
# Build for iOS
export BASEDIR="${XCODEDIR}/Platforms/iPhoneOS.platform/Developer"
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
export SDK="${BASEDIR}/SDKs/iPhoneOS.sdk"
## 32-bit iOS
export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-fembed-bitcode -mthumb -arch armv7 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS32_PREFIX" || exit 1
make -j${PROCESSORS} install || exit 1
## 32-bit armv7s iOS
export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-fembed-bitcode -mthumb -arch armv7s -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS32s_PREFIX" || exit 1
make -j${PROCESSORS} install || exit 1
## 64-bit iOS
export CFLAGS="-fembed-bitcode -O2 -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
export LDFLAGS="-fembed-bitcode -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$IOS64_PREFIX" || exit 1
make -j${PROCESSORS} install || exit 1
# Create universal binary and include folder
rm -fr -- "$PREFIX/include" "$PREFIX/libsodium.a" 2> /dev/null
mkdir -p -- "$PREFIX/lib"
lipo -create \
"$SIMULATOR32_PREFIX/lib/libsodium.a" \
"$SIMULATOR64_PREFIX/lib/libsodium.a" \
"$IOS32_PREFIX/lib/libsodium.a" \
"$IOS32s_PREFIX/lib/libsodium.a" \
"$IOS64_PREFIX/lib/libsodium.a" \
-output "$PREFIX/lib/libsodium.a"
mv -f -- "$IOS32_PREFIX/include" "$PREFIX/"
echo
echo "libsodium has been installed into $PREFIX"
echo
file -- "$PREFIX/lib/libsodium.a"
# Cleanup
rm -rf -- "$PREFIX/tmp"
make distclean > /dev/null

View File

@ -3,7 +3,7 @@
export CFLAGS="-Ofast -fomit-frame-pointer -m32 -march=pentium3 -mtune=westmere"
export PREFIX="$(pwd)/libsodium-win32"
if (i686-w64-mingw32-gcc --version > /dev/null 2>&1) then
if (i686-w64-mingw32-gcc --version >/dev/null 2>&1); then
echo MinGW found
else
echo Please install mingw-w64-i686-gcc >&2
@ -11,8 +11,8 @@ else
fi
./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
--host=i686-w64-mingw32 && \
make clean && \
make && \
make check && \
--host=i686-w64-mingw32 &&
make clean &&
make &&
make check &&
make install

View File

@ -3,7 +3,7 @@
export CFLAGS="-Ofast -fomit-frame-pointer -m64 -mtune=westmere"
export PREFIX="$(pwd)/libsodium-win64"
if (x86_64-w64-mingw32-gcc --version > /dev/null 2>&1) then
if (x86_64-w64-mingw32-gcc --version >/dev/null 2>&1); then
echo MinGW found
else
echo Please install mingw-w64-x86_64-gcc >&2
@ -11,8 +11,8 @@ else
fi
./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
--host=x86_64-w64-mingw32 && \
make clean && \
make && \
make check && \
--host=x86_64-w64-mingw32 &&
make clean &&
make &&
make check &&
make install

View File

@ -1,114 +0,0 @@
#! /bin/sh
#
# Step 1.
# Configure for base system so simulator is covered
#
# Step 2.
# Make for watchOS and watchOS simulator
#
# Step 3.
# Merge libs into final version for xcode import
export PREFIX="$(pwd)/libsodium-watchos"
export WATCHOS32_PREFIX="$PREFIX/tmp/watchos32"
export WATCHOS64_32_PREFIX="$PREFIX/tmp/watchos64_32"
export SIMULATOR32_PREFIX="$PREFIX/tmp/simulator32"
export SIMULATOR64_PREFIX="$PREFIX/tmp/simulator64"
export XCODEDIR=$(xcode-select -p)
export WATCHOS_SIMULATOR_VERSION_MIN=${WATCHOS_SIMULATOR_VERSION_MIN-"4.0.0"}
export WATCHOS_VERSION_MIN=${WATCHOS_VERSION_MIN-"4.0.0"}
mkdir -p $SIMULATOR32_PREFIX $SIMULATOR64_PREFIX $WATCHOS32_PREFIX $WATCHOS64_32_PREFIX || exit 1
# Build for the simulator
export BASEDIR="${XCODEDIR}/Platforms/WatchSimulator.platform/Developer"
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
export SDK="${BASEDIR}/SDKs/WatchSimulator.sdk"
## i386 simulator
export CFLAGS="-O2 -arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch i386 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
make distclean > /dev/null
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure --host=i686-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR32_PREFIX" || exit 1
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
make -j${PROCESSORS} install || exit 1
## x86_64 simulator
export CFLAGS="-O2 -arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
export LDFLAGS="-arch x86_64 -isysroot ${SDK} -mwatchos-simulator-version-min=${WATCHOS_SIMULATOR_VERSION_MIN}"
make distclean > /dev/null
./configure --host=x86_64-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$SIMULATOR64_PREFIX"
make -j${PROCESSORS} install || exit 1
# Build for watchOS
export BASEDIR="${XCODEDIR}/Platforms/WatchOS.platform/Developer"
export PATH="${BASEDIR}/usr/bin:$BASEDIR/usr/sbin:$PATH"
export SDK="${BASEDIR}/SDKs/WatchOS.sdk"
## 32-bit watchOS
export CFLAGS="-fembed-bitcode -O2 -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export LDFLAGS="-fembed-bitcode -mthumb -arch armv7k -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$WATCHOS32_PREFIX" || exit 1
make -j${PROCESSORS} install || exit 1
## 64-bit arm64_32 watchOS
export CFLAGS="-fembed-bitcode -O2 -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
export LDFLAGS="-fembed-bitcode -mthumb -arch arm64_32 -isysroot ${SDK} -mwatchos-version-min=${WATCHOS_VERSION_MIN}"
make distclean > /dev/null
./configure --host=arm-apple-darwin10 \
--disable-shared \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$WATCHOS64_32_PREFIX" || exit 1
make -j${PROCESSORS} install || exit 1
# Create universal binary and include folder
rm -fr -- "$PREFIX/include" "$PREFIX/libsodium.a" 2> /dev/null
mkdir -p -- "$PREFIX/lib"
lipo -create \
"$SIMULATOR32_PREFIX/lib/libsodium.a" \
"$SIMULATOR64_PREFIX/lib/libsodium.a" \
"$WATCHOS32_PREFIX/lib/libsodium.a" \
"$WATCHOS64_32_PREFIX/lib/libsodium.a" \
-output "$PREFIX/lib/libsodium.a"
mv -f -- "$WATCHOS32_PREFIX/include" "$PREFIX/"
echo
echo "libsodium has been installed into $PREFIX"
echo
file -- "$PREFIX/lib/libsodium.a"
# Cleanup
rm -rf -- "$PREFIX/tmp"
make distclean > /dev/null