Add libsodium source

This commit is contained in:
Mikhail Thompson
2024-06-27 15:00:43 +03:00
parent 7f4e947cf5
commit 6bd505c313
566 changed files with 77692 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
EXTRA_DIST = \
android-build.sh \
android-arm.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 \
msys2-win32.sh \
msys2-win64.sh \
watchos.sh \
wasm32-wasi.sh

View File

@@ -0,0 +1,4 @@
#!/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

@@ -0,0 +1,4 @@
#!/bin/sh
export TARGET_ARCH=armv7-a
export CFLAGS="-Os -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=${TARGET_ARCH}"
ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"

View File

@@ -0,0 +1,4 @@
#!/bin/sh
export TARGET_ARCH=armv8-a
export CFLAGS="-Os -march=${TARGET_ARCH}"
NDK_PLATFORM=android-21 ARCH=arm64 HOST_COMPILER=aarch64-linux-android "$(dirname "$0")/android-build.sh"

View File

@@ -0,0 +1,98 @@
#! /bin/sh
if [ -z "$NDK_PLATFORM" ]; then
export NDK_PLATFORM="android-16"
fi
export NDK_PLATFORM_COMPAT="${NDK_PLATFORM_COMPAT:-${NDK_PLATFORM}}"
export NDK_API_VERSION=$(echo "$NDK_PLATFORM" | sed 's/^android-//')
export NDK_API_VERSION_COMPAT=$(echo "$NDK_PLATFORM_COMPAT" | sed 's/^android-//')
if [ -z "$ANDROID_NDK_HOME" ]; then
echo "You should probably set ANDROID_NDK_HOME to the directory containing"
echo "the Android NDK"
exit
fi
if [ ! -f ./configure ]; then
echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?" >&2
exit 1
fi
if [ "x$TARGET_ARCH" = 'x' ] || [ "x$ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' ]; then
echo "You shouldn't use android-build.sh directly, use android-[arch].sh instead" >&2
exit 1
fi
export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make_standalone_toolchain.py"
export PREFIX="$(pwd)/libsodium-android-${TARGET_ARCH}"
export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
export CC=${CC:-"${HOST_COMPILER}-clang"}
rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
echo
echo "Warnings related to headers being present but not usable are due to functions"
echo "that didn't exist in the specified minimum API version level."
echo "They can be safely ignored."
echo
echo
if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then
echo "Building for platform [${NDK_PLATFORM}], retaining compatibility with platform [${NDK_PLATFORM_COMPAT}]"
else
echo "Building for platform [${NDK_PLATFORM}]"
fi
echo
env - PATH="$PATH" \
"$MAKE_TOOLCHAIN" --force --api="$NDK_API_VERSION_COMPAT" \
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure \
--disable-soname-versions \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--host="${HOST_COMPILER}" \
--prefix="${PREFIX}" \
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then
egrep '^#define ' config.log | sort -u > config-def-compat.log
echo
echo "Configuring again for platform [${NDK_PLATFORM}]"
echo
env - PATH="$PATH" \
"$MAKE_TOOLCHAIN" --force --api="$NDK_API_VERSION" \
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1
./configure \
--disable-soname-versions \
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--host="${HOST_COMPILER}" \
--prefix="${PREFIX}" \
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
egrep '^#define ' config.log | sort -u > config-def.log
if ! cmp config-def.log config-def-compat.log; then
echo "Platform [${NDK_PLATFORM}] is not backwards-compatible with [${NDK_PLATFORM_COMPAT}]" >&2
diff -u config-def.log config-def-compat.log >&2
exit 1
fi
rm -f config-def.log config-def-compat.log
fi
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
make clean && \
make -j${PROCESSORS} install && \
echo "libsodium has been installed into ${PREFIX}"

View File

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

View File

@@ -0,0 +1,4 @@
#!/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

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

View File

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

View File

@@ -0,0 +1,608 @@
_crypto_aead_aes256gcm_abytes 0 0
_crypto_aead_aes256gcm_beforenm 0 0
_crypto_aead_aes256gcm_decrypt 0 0
_crypto_aead_aes256gcm_decrypt_afternm 0 0
_crypto_aead_aes256gcm_decrypt_detached 0 0
_crypto_aead_aes256gcm_decrypt_detached_afternm 0 0
_crypto_aead_aes256gcm_encrypt 0 0
_crypto_aead_aes256gcm_encrypt_afternm 0 0
_crypto_aead_aes256gcm_encrypt_detached 0 0
_crypto_aead_aes256gcm_encrypt_detached_afternm 0 0
_crypto_aead_aes256gcm_is_available 0 0
_crypto_aead_aes256gcm_keybytes 0 0
_crypto_aead_aes256gcm_keygen 0 0
_crypto_aead_aes256gcm_messagebytes_max 0 0
_crypto_aead_aes256gcm_npubbytes 0 0
_crypto_aead_aes256gcm_nsecbytes 0 0
_crypto_aead_aes256gcm_statebytes 0 0
_crypto_aead_chacha20poly1305_abytes 1 1
_crypto_aead_chacha20poly1305_decrypt 1 1
_crypto_aead_chacha20poly1305_decrypt_detached 1 1
_crypto_aead_chacha20poly1305_encrypt 1 1
_crypto_aead_chacha20poly1305_encrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_abytes 1 1
_crypto_aead_chacha20poly1305_ietf_decrypt 1 1
_crypto_aead_chacha20poly1305_ietf_decrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_encrypt 1 1
_crypto_aead_chacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_chacha20poly1305_ietf_keybytes 1 1
_crypto_aead_chacha20poly1305_ietf_keygen 1 1
_crypto_aead_chacha20poly1305_ietf_messagebytes_max 1 1
_crypto_aead_chacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_chacha20poly1305_ietf_nsecbytes 1 1
_crypto_aead_chacha20poly1305_keybytes 1 1
_crypto_aead_chacha20poly1305_keygen 1 1
_crypto_aead_chacha20poly1305_messagebytes_max 1 1
_crypto_aead_chacha20poly1305_npubbytes 1 1
_crypto_aead_chacha20poly1305_nsecbytes 1 1
_crypto_aead_xchacha20poly1305_ietf_abytes 1 1
_crypto_aead_xchacha20poly1305_ietf_decrypt 1 1
_crypto_aead_xchacha20poly1305_ietf_decrypt_detached 1 1
_crypto_aead_xchacha20poly1305_ietf_encrypt 1 1
_crypto_aead_xchacha20poly1305_ietf_encrypt_detached 1 1
_crypto_aead_xchacha20poly1305_ietf_keybytes 1 1
_crypto_aead_xchacha20poly1305_ietf_keygen 1 1
_crypto_aead_xchacha20poly1305_ietf_messagebytes_max 1 1
_crypto_aead_xchacha20poly1305_ietf_npubbytes 1 1
_crypto_aead_xchacha20poly1305_ietf_nsecbytes 1 1
_crypto_auth 1 1
_crypto_auth_bytes 1 1
_crypto_auth_hmacsha256 0 1
_crypto_auth_hmacsha256_bytes 0 1
_crypto_auth_hmacsha256_final 0 1
_crypto_auth_hmacsha256_init 0 1
_crypto_auth_hmacsha256_keybytes 0 1
_crypto_auth_hmacsha256_keygen 0 1
_crypto_auth_hmacsha256_statebytes 0 1
_crypto_auth_hmacsha256_update 0 1
_crypto_auth_hmacsha256_verify 0 1
_crypto_auth_hmacsha512 0 1
_crypto_auth_hmacsha512256 0 1
_crypto_auth_hmacsha512256_bytes 0 1
_crypto_auth_hmacsha512256_final 0 1
_crypto_auth_hmacsha512256_init 0 1
_crypto_auth_hmacsha512256_keybytes 0 1
_crypto_auth_hmacsha512256_keygen 0 1
_crypto_auth_hmacsha512256_statebytes 0 1
_crypto_auth_hmacsha512256_update 0 1
_crypto_auth_hmacsha512256_verify 0 1
_crypto_auth_hmacsha512_bytes 0 1
_crypto_auth_hmacsha512_final 0 1
_crypto_auth_hmacsha512_init 0 1
_crypto_auth_hmacsha512_keybytes 0 1
_crypto_auth_hmacsha512_keygen 0 1
_crypto_auth_hmacsha512_statebytes 0 1
_crypto_auth_hmacsha512_update 0 1
_crypto_auth_hmacsha512_verify 0 1
_crypto_auth_keybytes 1 1
_crypto_auth_keygen 1 1
_crypto_auth_primitive 0 1
_crypto_auth_verify 1 1
_crypto_box 0 1
_crypto_box_afternm 0 1
_crypto_box_beforenm 1 1
_crypto_box_beforenmbytes 1 1
_crypto_box_boxzerobytes 0 1
_crypto_box_curve25519xchacha20poly1305_beforenm 0 1
_crypto_box_curve25519xchacha20poly1305_beforenmbytes 0 1
_crypto_box_curve25519xchacha20poly1305_detached 0 1
_crypto_box_curve25519xchacha20poly1305_detached_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_easy 0 1
_crypto_box_curve25519xchacha20poly1305_easy_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_keypair 0 1
_crypto_box_curve25519xchacha20poly1305_macbytes 0 1
_crypto_box_curve25519xchacha20poly1305_messagebytes_max 0 1
_crypto_box_curve25519xchacha20poly1305_noncebytes 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached 0 1
_crypto_box_curve25519xchacha20poly1305_open_detached_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_open_easy 0 1
_crypto_box_curve25519xchacha20poly1305_open_easy_afternm 0 1
_crypto_box_curve25519xchacha20poly1305_publickeybytes 0 1
_crypto_box_curve25519xchacha20poly1305_seal 0 1
_crypto_box_curve25519xchacha20poly1305_seal_open 0 1
_crypto_box_curve25519xchacha20poly1305_sealbytes 0 1
_crypto_box_curve25519xchacha20poly1305_secretkeybytes 0 1
_crypto_box_curve25519xchacha20poly1305_seed_keypair 0 1
_crypto_box_curve25519xchacha20poly1305_seedbytes 0 1
_crypto_box_curve25519xsalsa20poly1305 0 1
_crypto_box_curve25519xsalsa20poly1305_afternm 0 1
_crypto_box_curve25519xsalsa20poly1305_beforenm 0 1
_crypto_box_curve25519xsalsa20poly1305_beforenmbytes 0 1
_crypto_box_curve25519xsalsa20poly1305_boxzerobytes 0 1
_crypto_box_curve25519xsalsa20poly1305_keypair 0 1
_crypto_box_curve25519xsalsa20poly1305_macbytes 0 1
_crypto_box_curve25519xsalsa20poly1305_messagebytes_max 0 1
_crypto_box_curve25519xsalsa20poly1305_noncebytes 0 1
_crypto_box_curve25519xsalsa20poly1305_open 0 1
_crypto_box_curve25519xsalsa20poly1305_open_afternm 0 1
_crypto_box_curve25519xsalsa20poly1305_publickeybytes 0 1
_crypto_box_curve25519xsalsa20poly1305_secretkeybytes 0 1
_crypto_box_curve25519xsalsa20poly1305_seed_keypair 0 1
_crypto_box_curve25519xsalsa20poly1305_seedbytes 0 1
_crypto_box_curve25519xsalsa20poly1305_zerobytes 0 1
_crypto_box_detached 1 1
_crypto_box_detached_afternm 1 1
_crypto_box_easy 1 1
_crypto_box_easy_afternm 1 1
_crypto_box_keypair 1 1
_crypto_box_macbytes 1 1
_crypto_box_messagebytes_max 1 1
_crypto_box_noncebytes 1 1
_crypto_box_open 0 1
_crypto_box_open_afternm 0 1
_crypto_box_open_detached 1 1
_crypto_box_open_detached_afternm 1 1
_crypto_box_open_easy 1 1
_crypto_box_open_easy_afternm 1 1
_crypto_box_primitive 0 1
_crypto_box_publickeybytes 1 1
_crypto_box_seal 1 1
_crypto_box_seal_open 1 1
_crypto_box_sealbytes 1 1
_crypto_box_secretkeybytes 1 1
_crypto_box_seed_keypair 1 1
_crypto_box_seedbytes 1 1
_crypto_box_zerobytes 0 1
_crypto_core_ed25519_add 0 1
_crypto_core_ed25519_bytes 0 1
_crypto_core_ed25519_from_hash 0 1
_crypto_core_ed25519_from_uniform 0 1
_crypto_core_ed25519_hashbytes 0 1
_crypto_core_ed25519_is_valid_point 0 1
_crypto_core_ed25519_nonreducedscalarbytes 0 1
_crypto_core_ed25519_random 0 1
_crypto_core_ed25519_scalar_add 0 1
_crypto_core_ed25519_scalar_complement 0 1
_crypto_core_ed25519_scalar_invert 0 1
_crypto_core_ed25519_scalar_mul 0 1
_crypto_core_ed25519_scalar_negate 0 1
_crypto_core_ed25519_scalar_random 0 1
_crypto_core_ed25519_scalar_reduce 0 1
_crypto_core_ed25519_scalar_sub 0 1
_crypto_core_ed25519_scalarbytes 0 1
_crypto_core_ed25519_sub 0 1
_crypto_core_ed25519_uniformbytes 0 1
_crypto_core_hchacha20 0 1
_crypto_core_hchacha20_constbytes 0 1
_crypto_core_hchacha20_inputbytes 0 1
_crypto_core_hchacha20_keybytes 0 1
_crypto_core_hchacha20_outputbytes 0 1
_crypto_core_hsalsa20 0 1
_crypto_core_hsalsa20_constbytes 0 1
_crypto_core_hsalsa20_inputbytes 0 1
_crypto_core_hsalsa20_keybytes 0 1
_crypto_core_hsalsa20_outputbytes 0 1
_crypto_core_ristretto255_add 0 1
_crypto_core_ristretto255_bytes 0 1
_crypto_core_ristretto255_from_hash 0 1
_crypto_core_ristretto255_hashbytes 0 1
_crypto_core_ristretto255_is_valid_point 0 1
_crypto_core_ristretto255_nonreducedscalarbytes 0 1
_crypto_core_ristretto255_random 0 1
_crypto_core_ristretto255_scalar_add 0 1
_crypto_core_ristretto255_scalar_complement 0 1
_crypto_core_ristretto255_scalar_invert 0 1
_crypto_core_ristretto255_scalar_mul 0 1
_crypto_core_ristretto255_scalar_negate 0 1
_crypto_core_ristretto255_scalar_random 0 1
_crypto_core_ristretto255_scalar_reduce 0 1
_crypto_core_ristretto255_scalar_sub 0 1
_crypto_core_ristretto255_scalarbytes 0 1
_crypto_core_ristretto255_sub 0 1
_crypto_core_ristretto255_uniformbytes 0 1
_crypto_core_salsa20 0 1
_crypto_core_salsa2012 0 1
_crypto_core_salsa2012_constbytes 0 1
_crypto_core_salsa2012_inputbytes 0 1
_crypto_core_salsa2012_keybytes 0 1
_crypto_core_salsa2012_outputbytes 0 1
_crypto_core_salsa208 0 1
_crypto_core_salsa208_constbytes 0 1
_crypto_core_salsa208_inputbytes 0 1
_crypto_core_salsa208_keybytes 0 1
_crypto_core_salsa208_outputbytes 0 1
_crypto_core_salsa20_constbytes 0 1
_crypto_core_salsa20_inputbytes 0 1
_crypto_core_salsa20_keybytes 0 1
_crypto_core_salsa20_outputbytes 0 1
_crypto_generichash 1 1
_crypto_generichash_blake2b 0 1
_crypto_generichash_blake2b_bytes 0 1
_crypto_generichash_blake2b_bytes_max 0 1
_crypto_generichash_blake2b_bytes_min 0 1
_crypto_generichash_blake2b_final 0 1
_crypto_generichash_blake2b_init 0 1
_crypto_generichash_blake2b_init_salt_personal 0 1
_crypto_generichash_blake2b_keybytes 0 1
_crypto_generichash_blake2b_keybytes_max 0 1
_crypto_generichash_blake2b_keybytes_min 0 1
_crypto_generichash_blake2b_keygen 0 1
_crypto_generichash_blake2b_personalbytes 0 1
_crypto_generichash_blake2b_salt_personal 0 1
_crypto_generichash_blake2b_saltbytes 0 1
_crypto_generichash_blake2b_statebytes 0 1
_crypto_generichash_blake2b_update 0 1
_crypto_generichash_bytes 1 1
_crypto_generichash_bytes_max 1 1
_crypto_generichash_bytes_min 1 1
_crypto_generichash_final 1 1
_crypto_generichash_init 1 1
_crypto_generichash_keybytes 1 1
_crypto_generichash_keybytes_max 1 1
_crypto_generichash_keybytes_min 1 1
_crypto_generichash_keygen 1 1
_crypto_generichash_primitive 0 1
_crypto_generichash_statebytes 1 1
_crypto_generichash_update 1 1
_crypto_hash 1 1
_crypto_hash_bytes 1 1
_crypto_hash_primitive 0 1
_crypto_hash_sha256 0 1
_crypto_hash_sha256_bytes 0 1
_crypto_hash_sha256_final 0 1
_crypto_hash_sha256_init 0 1
_crypto_hash_sha256_statebytes 0 1
_crypto_hash_sha256_update 0 1
_crypto_hash_sha512 0 1
_crypto_hash_sha512_bytes 0 1
_crypto_hash_sha512_final 0 1
_crypto_hash_sha512_init 0 1
_crypto_hash_sha512_statebytes 0 1
_crypto_hash_sha512_update 0 1
_crypto_kdf_blake2b_bytes_max 0 1
_crypto_kdf_blake2b_bytes_min 0 1
_crypto_kdf_blake2b_contextbytes 0 1
_crypto_kdf_blake2b_derive_from_key 0 1
_crypto_kdf_blake2b_keybytes 0 1
_crypto_kdf_bytes_max 1 1
_crypto_kdf_bytes_min 1 1
_crypto_kdf_contextbytes 1 1
_crypto_kdf_derive_from_key 1 1
_crypto_kdf_keybytes 1 1
_crypto_kdf_keygen 1 1
_crypto_kdf_primitive 0 1
_crypto_kx_client_session_keys 1 1
_crypto_kx_keypair 1 1
_crypto_kx_primitive 0 1
_crypto_kx_publickeybytes 1 1
_crypto_kx_secretkeybytes 1 1
_crypto_kx_seed_keypair 1 1
_crypto_kx_seedbytes 1 1
_crypto_kx_server_session_keys 1 1
_crypto_kx_sessionkeybytes 1 1
_crypto_onetimeauth 0 1
_crypto_onetimeauth_bytes 0 1
_crypto_onetimeauth_final 0 1
_crypto_onetimeauth_init 0 1
_crypto_onetimeauth_keybytes 0 1
_crypto_onetimeauth_keygen 0 1
_crypto_onetimeauth_poly1305 0 1
_crypto_onetimeauth_poly1305_bytes 0 1
_crypto_onetimeauth_poly1305_final 0 1
_crypto_onetimeauth_poly1305_init 0 1
_crypto_onetimeauth_poly1305_keybytes 0 1
_crypto_onetimeauth_poly1305_keygen 0 1
_crypto_onetimeauth_poly1305_statebytes 0 1
_crypto_onetimeauth_poly1305_update 0 1
_crypto_onetimeauth_poly1305_verify 0 1
_crypto_onetimeauth_primitive 0 1
_crypto_onetimeauth_statebytes 0 1
_crypto_onetimeauth_update 0 1
_crypto_onetimeauth_verify 0 1
_crypto_pwhash 1 1
_crypto_pwhash_alg_argon2i13 1 1
_crypto_pwhash_alg_argon2id13 1 1
_crypto_pwhash_alg_default 1 1
_crypto_pwhash_argon2i 0 1
_crypto_pwhash_argon2i_alg_argon2i13 0 1
_crypto_pwhash_argon2i_bytes_max 0 1
_crypto_pwhash_argon2i_bytes_min 0 1
_crypto_pwhash_argon2i_memlimit_interactive 0 1
_crypto_pwhash_argon2i_memlimit_max 0 1
_crypto_pwhash_argon2i_memlimit_min 0 1
_crypto_pwhash_argon2i_memlimit_moderate 0 1
_crypto_pwhash_argon2i_memlimit_sensitive 0 1
_crypto_pwhash_argon2i_opslimit_interactive 0 1
_crypto_pwhash_argon2i_opslimit_max 0 1
_crypto_pwhash_argon2i_opslimit_min 0 1
_crypto_pwhash_argon2i_opslimit_moderate 0 1
_crypto_pwhash_argon2i_opslimit_sensitive 0 1
_crypto_pwhash_argon2i_passwd_max 0 1
_crypto_pwhash_argon2i_passwd_min 0 1
_crypto_pwhash_argon2i_saltbytes 0 1
_crypto_pwhash_argon2i_str 0 1
_crypto_pwhash_argon2i_str_needs_rehash 0 1
_crypto_pwhash_argon2i_str_verify 0 1
_crypto_pwhash_argon2i_strbytes 0 1
_crypto_pwhash_argon2i_strprefix 0 1
_crypto_pwhash_argon2id 0 1
_crypto_pwhash_argon2id_alg_argon2id13 0 1
_crypto_pwhash_argon2id_bytes_max 0 1
_crypto_pwhash_argon2id_bytes_min 0 1
_crypto_pwhash_argon2id_memlimit_interactive 0 1
_crypto_pwhash_argon2id_memlimit_max 0 1
_crypto_pwhash_argon2id_memlimit_min 0 1
_crypto_pwhash_argon2id_memlimit_moderate 0 1
_crypto_pwhash_argon2id_memlimit_sensitive 0 1
_crypto_pwhash_argon2id_opslimit_interactive 0 1
_crypto_pwhash_argon2id_opslimit_max 0 1
_crypto_pwhash_argon2id_opslimit_min 0 1
_crypto_pwhash_argon2id_opslimit_moderate 0 1
_crypto_pwhash_argon2id_opslimit_sensitive 0 1
_crypto_pwhash_argon2id_passwd_max 0 1
_crypto_pwhash_argon2id_passwd_min 0 1
_crypto_pwhash_argon2id_saltbytes 0 1
_crypto_pwhash_argon2id_str 0 1
_crypto_pwhash_argon2id_str_needs_rehash 0 1
_crypto_pwhash_argon2id_str_verify 0 1
_crypto_pwhash_argon2id_strbytes 0 1
_crypto_pwhash_argon2id_strprefix 0 1
_crypto_pwhash_bytes_max 1 1
_crypto_pwhash_bytes_min 1 1
_crypto_pwhash_memlimit_interactive 1 1
_crypto_pwhash_memlimit_max 1 1
_crypto_pwhash_memlimit_min 1 1
_crypto_pwhash_memlimit_moderate 1 1
_crypto_pwhash_memlimit_sensitive 1 1
_crypto_pwhash_opslimit_interactive 1 1
_crypto_pwhash_opslimit_max 1 1
_crypto_pwhash_opslimit_min 1 1
_crypto_pwhash_opslimit_moderate 1 1
_crypto_pwhash_opslimit_sensitive 1 1
_crypto_pwhash_passwd_max 1 1
_crypto_pwhash_passwd_min 1 1
_crypto_pwhash_primitive 0 1
_crypto_pwhash_saltbytes 1 1
_crypto_pwhash_scryptsalsa208sha256 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_max 0 1
_crypto_pwhash_scryptsalsa208sha256_bytes_min 0 1
_crypto_pwhash_scryptsalsa208sha256_ll 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_max 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_min 0 1
_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_max 0 1
_crypto_pwhash_scryptsalsa208sha256_passwd_min 0 1
_crypto_pwhash_scryptsalsa208sha256_saltbytes 0 1
_crypto_pwhash_scryptsalsa208sha256_str 0 1
_crypto_pwhash_scryptsalsa208sha256_str_needs_rehash 0 1
_crypto_pwhash_scryptsalsa208sha256_str_verify 0 1
_crypto_pwhash_scryptsalsa208sha256_strbytes 0 1
_crypto_pwhash_scryptsalsa208sha256_strprefix 0 1
_crypto_pwhash_str 1 1
_crypto_pwhash_str_alg 1 1
_crypto_pwhash_str_needs_rehash 1 1
_crypto_pwhash_str_verify 1 1
_crypto_pwhash_strbytes 1 1
_crypto_pwhash_strprefix 1 1
_crypto_scalarmult 1 1
_crypto_scalarmult_base 1 1
_crypto_scalarmult_bytes 1 1
_crypto_scalarmult_curve25519 0 1
_crypto_scalarmult_curve25519_base 0 1
_crypto_scalarmult_curve25519_bytes 0 1
_crypto_scalarmult_curve25519_scalarbytes 0 1
_crypto_scalarmult_ed25519 0 1
_crypto_scalarmult_ed25519_base 0 1
_crypto_scalarmult_ed25519_base_noclamp 0 1
_crypto_scalarmult_ed25519_bytes 0 1
_crypto_scalarmult_ed25519_noclamp 0 1
_crypto_scalarmult_ed25519_scalarbytes 0 1
_crypto_scalarmult_primitive 0 1
_crypto_scalarmult_ristretto255 0 1
_crypto_scalarmult_ristretto255_base 0 1
_crypto_scalarmult_ristretto255_bytes 0 1
_crypto_scalarmult_ristretto255_scalarbytes 0 1
_crypto_scalarmult_scalarbytes 1 1
_crypto_secretbox 0 1
_crypto_secretbox_boxzerobytes 0 1
_crypto_secretbox_detached 1 1
_crypto_secretbox_easy 1 1
_crypto_secretbox_keybytes 1 1
_crypto_secretbox_keygen 1 1
_crypto_secretbox_macbytes 1 1
_crypto_secretbox_messagebytes_max 1 1
_crypto_secretbox_noncebytes 1 1
_crypto_secretbox_open 0 1
_crypto_secretbox_open_detached 1 1
_crypto_secretbox_open_easy 1 1
_crypto_secretbox_primitive 0 1
_crypto_secretbox_xchacha20poly1305_detached 0 1
_crypto_secretbox_xchacha20poly1305_easy 0 1
_crypto_secretbox_xchacha20poly1305_keybytes 0 1
_crypto_secretbox_xchacha20poly1305_macbytes 0 1
_crypto_secretbox_xchacha20poly1305_messagebytes_max 0 1
_crypto_secretbox_xchacha20poly1305_noncebytes 0 1
_crypto_secretbox_xchacha20poly1305_open_detached 0 1
_crypto_secretbox_xchacha20poly1305_open_easy 0 1
_crypto_secretbox_xsalsa20poly1305 0 1
_crypto_secretbox_xsalsa20poly1305_boxzerobytes 0 1
_crypto_secretbox_xsalsa20poly1305_keybytes 0 1
_crypto_secretbox_xsalsa20poly1305_keygen 0 1
_crypto_secretbox_xsalsa20poly1305_macbytes 0 1
_crypto_secretbox_xsalsa20poly1305_messagebytes_max 0 1
_crypto_secretbox_xsalsa20poly1305_noncebytes 0 1
_crypto_secretbox_xsalsa20poly1305_open 0 1
_crypto_secretbox_xsalsa20poly1305_zerobytes 0 1
_crypto_secretbox_zerobytes 0 1
_crypto_secretstream_xchacha20poly1305_abytes 1 1
_crypto_secretstream_xchacha20poly1305_headerbytes 1 1
_crypto_secretstream_xchacha20poly1305_init_pull 1 1
_crypto_secretstream_xchacha20poly1305_init_push 1 1
_crypto_secretstream_xchacha20poly1305_keybytes 1 1
_crypto_secretstream_xchacha20poly1305_keygen 1 1
_crypto_secretstream_xchacha20poly1305_messagebytes_max 1 1
_crypto_secretstream_xchacha20poly1305_pull 1 1
_crypto_secretstream_xchacha20poly1305_push 1 1
_crypto_secretstream_xchacha20poly1305_rekey 1 1
_crypto_secretstream_xchacha20poly1305_statebytes 1 1
_crypto_secretstream_xchacha20poly1305_tag_final 1 1
_crypto_secretstream_xchacha20poly1305_tag_message 1 1
_crypto_secretstream_xchacha20poly1305_tag_push 1 1
_crypto_secretstream_xchacha20poly1305_tag_rekey 1 1
_crypto_shorthash 1 1
_crypto_shorthash_bytes 1 1
_crypto_shorthash_keybytes 1 1
_crypto_shorthash_keygen 1 1
_crypto_shorthash_primitive 0 1
_crypto_shorthash_siphash24 0 1
_crypto_shorthash_siphash24_bytes 0 1
_crypto_shorthash_siphash24_keybytes 0 1
_crypto_shorthash_siphashx24 0 1
_crypto_shorthash_siphashx24_bytes 0 1
_crypto_shorthash_siphashx24_keybytes 0 1
_crypto_sign 1 1
_crypto_sign_bytes 1 1
_crypto_sign_detached 1 1
_crypto_sign_ed25519 0 1
_crypto_sign_ed25519_bytes 0 1
_crypto_sign_ed25519_detached 0 1
_crypto_sign_ed25519_keypair 0 1
_crypto_sign_ed25519_messagebytes_max 0 1
_crypto_sign_ed25519_open 0 1
_crypto_sign_ed25519_pk_to_curve25519 1 1
_crypto_sign_ed25519_publickeybytes 0 1
_crypto_sign_ed25519_secretkeybytes 0 1
_crypto_sign_ed25519_seed_keypair 0 1
_crypto_sign_ed25519_seedbytes 0 1
_crypto_sign_ed25519_sk_to_curve25519 1 1
_crypto_sign_ed25519_sk_to_pk 0 1
_crypto_sign_ed25519_sk_to_seed 0 1
_crypto_sign_ed25519_verify_detached 0 1
_crypto_sign_ed25519ph_final_create 0 1
_crypto_sign_ed25519ph_final_verify 0 1
_crypto_sign_ed25519ph_init 0 1
_crypto_sign_ed25519ph_statebytes 0 1
_crypto_sign_ed25519ph_update 0 1
_crypto_sign_edwards25519sha512batch 0 0
_crypto_sign_edwards25519sha512batch_keypair 0 0
_crypto_sign_edwards25519sha512batch_open 0 0
_crypto_sign_final_create 1 1
_crypto_sign_final_verify 1 1
_crypto_sign_init 1 1
_crypto_sign_keypair 1 1
_crypto_sign_messagebytes_max 1 1
_crypto_sign_open 1 1
_crypto_sign_primitive 0 1
_crypto_sign_publickeybytes 1 1
_crypto_sign_secretkeybytes 1 1
_crypto_sign_seed_keypair 1 1
_crypto_sign_seedbytes 1 1
_crypto_sign_statebytes 1 1
_crypto_sign_update 1 1
_crypto_sign_verify_detached 1 1
_crypto_stream 0 1
_crypto_stream_chacha20 0 1
_crypto_stream_chacha20_ietf 0 1
_crypto_stream_chacha20_ietf_keybytes 0 1
_crypto_stream_chacha20_ietf_keygen 0 1
_crypto_stream_chacha20_ietf_messagebytes_max 0 1
_crypto_stream_chacha20_ietf_noncebytes 0 1
_crypto_stream_chacha20_ietf_xor 0 1
_crypto_stream_chacha20_ietf_xor_ic 0 1
_crypto_stream_chacha20_keybytes 0 1
_crypto_stream_chacha20_keygen 0 1
_crypto_stream_chacha20_messagebytes_max 0 1
_crypto_stream_chacha20_noncebytes 0 1
_crypto_stream_chacha20_xor 0 1
_crypto_stream_chacha20_xor_ic 0 1
_crypto_stream_keybytes 0 1
_crypto_stream_keygen 0 1
_crypto_stream_messagebytes_max 0 1
_crypto_stream_noncebytes 0 1
_crypto_stream_primitive 0 1
_crypto_stream_salsa20 0 1
_crypto_stream_salsa2012 0 1
_crypto_stream_salsa2012_keybytes 0 1
_crypto_stream_salsa2012_keygen 0 1
_crypto_stream_salsa2012_messagebytes_max 0 1
_crypto_stream_salsa2012_noncebytes 0 1
_crypto_stream_salsa2012_xor 0 1
_crypto_stream_salsa208 0 1
_crypto_stream_salsa208_keybytes 0 1
_crypto_stream_salsa208_keygen 0 1
_crypto_stream_salsa208_messagebytes_max 0 1
_crypto_stream_salsa208_noncebytes 0 1
_crypto_stream_salsa208_xor 0 1
_crypto_stream_salsa20_keybytes 0 1
_crypto_stream_salsa20_keygen 0 1
_crypto_stream_salsa20_messagebytes_max 0 1
_crypto_stream_salsa20_noncebytes 0 1
_crypto_stream_salsa20_xor 0 1
_crypto_stream_salsa20_xor_ic 0 1
_crypto_stream_xchacha20 0 1
_crypto_stream_xchacha20_keybytes 0 1
_crypto_stream_xchacha20_keygen 0 1
_crypto_stream_xchacha20_messagebytes_max 0 1
_crypto_stream_xchacha20_noncebytes 0 1
_crypto_stream_xchacha20_xor 0 1
_crypto_stream_xchacha20_xor_ic 0 1
_crypto_stream_xor 0 1
_crypto_stream_xsalsa20 0 1
_crypto_stream_xsalsa20_keybytes 0 1
_crypto_stream_xsalsa20_keygen 0 1
_crypto_stream_xsalsa20_messagebytes_max 0 1
_crypto_stream_xsalsa20_noncebytes 0 1
_crypto_stream_xsalsa20_xor 0 1
_crypto_stream_xsalsa20_xor_ic 0 1
_crypto_verify_16 0 1
_crypto_verify_16_bytes 0 1
_crypto_verify_32 0 1
_crypto_verify_32_bytes 0 1
_crypto_verify_64 0 1
_crypto_verify_64_bytes 0 1
_randombytes 1 1
_randombytes_buf 1 1
_randombytes_buf_deterministic 1 1
_randombytes_close 1 1
_randombytes_implementation_name 0 1
_randombytes_random 1 1
_randombytes_seedbytes 1 1
_randombytes_set_implementation 0 0
_randombytes_stir 1 1
_randombytes_uniform 1 1
_sodium_add 0 0
_sodium_allocarray 0 0
_sodium_base642bin 1 1
_sodium_base64_encoded_len 1 1
_sodium_bin2base64 1 1
_sodium_bin2hex 1 1
_sodium_compare 0 0
_sodium_free 0 0
_sodium_hex2bin 1 1
_sodium_increment 0 0
_sodium_init 1 1
_sodium_is_zero 0 0
_sodium_library_minimal 1 1
_sodium_library_version_major 1 1
_sodium_library_version_minor 1 1
_sodium_malloc 0 0
_sodium_memcmp 0 0
_sodium_memzero 0 0
_sodium_misuse 0 0
_sodium_mlock 0 0
_sodium_mprotect_noaccess 0 0
_sodium_mprotect_readonly 0 0
_sodium_mprotect_readwrite 0 0
_sodium_munlock 0 0
_sodium_pad 1 1
_sodium_runtime_has_aesni 0 0
_sodium_runtime_has_avx 0 0
_sodium_runtime_has_avx2 0 0
_sodium_runtime_has_avx512f 0 0
_sodium_runtime_has_neon 0 0
_sodium_runtime_has_pclmul 0 0
_sodium_runtime_has_rdrand 0 0
_sodium_runtime_has_sse2 0 0
_sodium_runtime_has_sse3 0 0
_sodium_runtime_has_sse41 0 0
_sodium_runtime_has_ssse3 0 0
_sodium_set_misuse_handler 0 0
_sodium_stackzero 0 0
_sodium_sub 0 0
_sodium_unpad 1 1
_sodium_version_string 1 1

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
#! /bin/sh
set -e
symbols() {
{
SUMO="$1"
while read symbol standard sumo; do
found="$standard"
if [ "x$SUMO" = "xsumo" ]; then
found="$sumo"
fi
if [ "$found" = "1" ]; then
eval "defined_${symbol}=yes"
else
eval "defined_${symbol}=no"
fi
done < emscripten-symbols.def
/usr/bin/nm /usr/local/lib/libsodium.23.dylib | \
fgrep ' T _' | \
cut -d' ' -f3 | {
while read symbol; do
eval "found=\$defined_${symbol}"
if [ "$found" = "yes" ]; then
echo "$symbol"
elif [ "$found" != "no" ]; then
echo >&2
echo "*** [$symbol] was not expected ***" >&2
echo >&2
exit 1
fi
done
}
} | \
sort | \
{
out='"_malloc","_free"'
while read symbol ; do
if [ ! -z "$out" ]; then
out="${out},"
fi
out="${out}\"${symbol}\""
done
echo "[${out}]"
}
}
out=$(symbols standard)
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 && \
mv -f emscripten.sh.tmp emscripten.sh
chmod +x emscripten.sh

View File

@@ -0,0 +1,135 @@
#! /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} -fembed-bitcode"
export LDFLAGS="-fembed-bitcode -arch arm64 -isysroot ${SDK} -mios-version-min=${IOS_VERSION_MIN} -fembed-bitcode"
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

@@ -0,0 +1,18 @@
#! /bin/sh
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
echo MinGW found
else
echo Please install mingw-w64-i686-gcc >&2
exit
fi
./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
--host=i686-w64-mingw32 && \
make clean && \
make && \
make check && \
make install

View File

@@ -0,0 +1,18 @@
#! /bin/sh
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
echo MinGW found
else
echo Please install mingw-w64-x86_64-gcc >&2
exit
fi
./configure --prefix="$PREFIX" --exec-prefix="$PREFIX" \
--host=x86_64-w64-mingw32 && \
make clean && \
make && \
make check && \
make install

View File

@@ -0,0 +1,30 @@
#! /bin/sh
export PREFIX="$(pwd)/libsodium-osx"
export OSX_VERSION_MIN=${OSX_VERSION_MIN-"10.8"}
export OSX_CPU_ARCH=${OSX_CPU_ARCH-"core2"}
mkdir -p $PREFIX || exit 1
export CFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH} -O2 -g"
export LDFLAGS="-arch x86_64 -mmacosx-version-min=${OSX_VERSION_MIN} -march=${OSX_CPU_ARCH}"
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 ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$PREFIX" || exit 1
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
make -j${PROCESSORS} check && make -j${PROCESSORS} install || exit 1
# Cleanup
make distclean > /dev/null

View File

@@ -0,0 +1,49 @@
#! /bin/sh
if [ -z "$WASI_SYSROOT" ]; then
export WASI_SYSROOT="/opt/wasi-sysroot"
fi
export PATH="/usr/local/opt/llvm/bin:$PATH"
export PREFIX="$(pwd)/libsodium-wasm32-wasi"
mkdir -p $PREFIX || exit 1
export CC="clang"
export CFLAGS="-DED25519_NONDETERMINISTIC=1 --target=wasm32-wasi --sysroot=${WASI_SYSROOT} -O2"
export LDFLAGS="-s -Wl,--no-threads"
export NM="llvm-nm"
export AR="llvm-ar"
export RANLIB="llvm-ranlib"
export STRIP="llvm-strip"
make distclean > /dev/null
grep -q -F -- 'wasi' build-aux/config.sub || \
sed -i -e 's/-nacl\*)/-nacl*|-wasi)/' build-aux/config.sub
if [ "x$1" = "x--bench" ]; then
export BENCHMARKS=1
export CPPFLAGS="-DBENCHMARKS -DITERATIONS=100"
fi
if [ -n "$LIBSODIUM_MINIMAL_BUILD" ]; then
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
else
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
fi
./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$PREFIX" --with-sysroot="$WASI_SYSROOT" \
--host=wasm32-wasi \
--disable-ssp --disable-shared || exit 1
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
PROCESSORS=${NPROCESSORS:-3}
if [ -z "$BENCHMARKS" ]; then
make -j${PROCESSORS} check && make install && make distclean > /dev/null
else
make -j${PROCESSORS} && make check
fi

View File

@@ -0,0 +1,114 @@
#! /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