2019-06-27 02:22:33 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Overridable.
|
|
|
|
[ -z "$LIBSODIUM_BUILD_DIR" ] && LIBSODIUM_BUILD_DIR=`pwd`/build
|
|
|
|
|
|
|
|
|
|
|
|
# Upgraded from time to time.
|
|
|
|
export MIN_LIBSODIUM_VERSION=1.0.18
|
|
|
|
export LIBSODIUM_SHA256=6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1
|
|
|
|
|
|
|
|
|
2019-06-29 01:17:09 +02:00
|
|
|
[ ! -z "$SODIUM_BUILD_DEBUG" ] && export SODIUM_BUILD_VERBOSE=1
|
2019-06-27 02:22:33 +02:00
|
|
|
|
|
|
|
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
|
|
|
|
|
|
|
|
if `pkg-config libsodium --exists`; then
|
|
|
|
PKG_VER=`pkg-config libsodium --modversion`
|
|
|
|
|
|
|
|
if [ $(version "$PKG_VER") -ge $(version "$MIN_LIBSODIUM_VERSION") ]; then
|
2021-06-01 19:13:28 +02:00
|
|
|
[ ! -z "$SODIUM_BUILD_VERBOSE" ] && echo "Using packaged libsodium." 1>&2
|
2019-06-27 02:22:33 +02:00
|
|
|
else
|
2021-06-01 19:13:28 +02:00
|
|
|
[ ! -z "$SODIUM_BUILD_VERBOSE" ] && echo "System packaged libsodium is too old." 1>&2
|
2019-06-27 02:22:33 +02:00
|
|
|
export LIBSODIUM_INSTALL=1
|
|
|
|
fi
|
|
|
|
else
|
2021-06-01 19:13:28 +02:00
|
|
|
[ ! -z "$SODIUM_BUILD_VERBOSE" ] && echo "Missing libsodium system package." 1>&2
|
2019-06-27 02:22:33 +02:00
|
|
|
export LIBSODIUM_INSTALL=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$LIBSODIUM_INSTALL" = "1" ]; then
|
|
|
|
export LIBSODIUM_INSTALL_PATH="$LIBSODIUM_BUILD_DIR"/libsodium
|
|
|
|
export PKG_CONFIG_PATH="$LIBSODIUM_INSTALL_PATH"/lib/pkgconfig
|
|
|
|
fi
|