2022-04-13 15:57:46 +08:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2023-10-27 18:20:27 +08:00
|
|
|
build_sasl2() {
|
2022-04-13 15:57:46 +08:00
|
|
|
git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2
|
|
|
|
cd /sasl-xoauth2
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2023-10-27 19:47:37 +08:00
|
|
|
# Documentation build (now) requires pandoc, which is not available on multiple
|
|
|
|
# architectures. Since we're are building an image that we want it to be as slim as possible,
|
|
|
|
# we're removing the build of documentation instead of complicating things with pandoc.
|
|
|
|
patch -p1 -d .. < /build-scripts/sasl-xoauth2-01.patch
|
2022-08-29 21:46:55 +08:00
|
|
|
if [ -f /etc/alpine-release ]; then
|
2023-10-27 19:47:37 +08:00
|
|
|
patch -p1 -d .. < /build-scripts/sasl-xoauth2-02.patch
|
2022-08-29 21:46:55 +08:00
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/ ..
|
|
|
|
else
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
|
|
|
|
fi
|
2022-04-13 15:57:46 +08:00
|
|
|
make
|
|
|
|
make install
|
2022-08-29 21:46:55 +08:00
|
|
|
install ../scripts/postfix-sasl-xoauth2-update-ca-certs /etc/ca-certificates/update.d
|
|
|
|
update-ca-certificates
|
2022-04-13 15:57:46 +08:00
|
|
|
}
|
|
|
|
|
2023-10-27 19:47:37 +08:00
|
|
|
[ -f /etc/lsb-release ] && . /etc/lsb-release
|
|
|
|
[ -f /etc/os-release ] && . /etc/os-release
|
2022-04-13 15:57:46 +08:00
|
|
|
if [ -f /etc/alpine-release ]; then
|
2023-10-27 18:20:27 +08:00
|
|
|
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch
|
|
|
|
build_sasl2
|
2022-04-13 15:57:46 +08:00
|
|
|
apk del .build-deps;
|
2022-06-09 21:32:07 +08:00
|
|
|
else
|
2022-04-13 15:57:46 +08:00
|
|
|
apt-get update -y -qq
|
2023-10-27 18:20:27 +08:00
|
|
|
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev"
|
2022-04-13 15:57:46 +08:00
|
|
|
apt-get install -y --no-install-recommends ${LIBS}
|
2023-10-27 18:20:27 +08:00
|
|
|
build_sasl2
|
2022-04-13 15:57:46 +08:00
|
|
|
apt-get remove --purge -y ${LIBS}
|
|
|
|
apt-get autoremove --yes
|
|
|
|
apt-get clean autoclean
|
|
|
|
fi
|
|
|
|
|