Skip to content

Commit

Permalink
Fix: Update how SASL-XOAUTH2 is build (without DOCS) to (re)enable mo…
Browse files Browse the repository at this point in the history
…re architectures
  • Loading branch information
bokysan committed Oct 27, 2023
1 parent 888ec87 commit 6964220
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 43 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ jobs:
boky/postfix:edge-alpine
# linux/s390x: "rsyslog (no such package)"
# Latest Alpine does not have all the packages for 386 anymore. :-(
# Pandoc, which is required for SASL build, cannot be found in these images: linux/arm/v6,linux/arm/v7,linux/ppc64le
platforms: "linux/amd64,linux/arm64"
platforms: "linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/amd64,linux/arm64"
cache-from: type=local,src=/tmp/.buildx-cache/alpine,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/alpine
build-args: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ jobs:
boky/postfix:${{ env.RELEASE_VERSION_NO_v }}-alpine
# linux/s390x: "rsyslog (no such package)"
# Latest Alpine does not have all packages for 386 any more :-(
# Pandoc, which is required for SASL build, cannot be found in these images: linux/arm/v6,linux/arm/v7,linux/ppc64le
platforms: "linux/amd64,linux/arm64"
platforms: "linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/amd64,linux/arm64"
cache-from: type=local,src=/tmp/.buildx-cache/alpine,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/alpine
build-args: |
Expand Down
46 changes: 7 additions & 39 deletions build-scripts/sasl-build.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,17 @@
#!/bin/sh
set -e

build_pandoc() {
if [ -f /etc/alpine-release ]; then
if apk add --upgrade pandoc; then
return
fi
else
if apt-get install -y --no-install-recommends pandoc; then
return
fi
fi

if [ -f /etc/alpine-release ]; then
apk add --upgrade cabal curl llvm
else
apt-get install -y --no-install-recommends cabal curl llvm
fi
mkdir pandoc
curl --retry 5 --max-time 300 --connect-timeout 10 -fsSL https://github.com/jgm/pandoc/archive/refs/tags/3.1.8.tar.gz | tar xvzf - --strip-components 1 -C pandoc
cd pandoc
cabal update
cabal install --only-dependencies --lib
cabal configure \
--enable-optimization=2 \
--disable-tests \
--disable-documentation \
--disable-benchmarks \
--disable-coverage \
--disable-library-stripping \
--disable-executable-stripping \
--disable-profiling \
--enable-static
cabal build
}

build_sasl2() {
git clone --depth 1 --branch ${SASL_XOAUTH2_GIT_REF} ${SASL_XOAUTH2_REPO_URL} /sasl-xoauth2
cd /sasl-xoauth2
mkdir build
cd build
# 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
if [ -f /etc/alpine-release ]; then
patch -p1 -d .. < /build-scripts/sasl-xoauth2.diff
patch -p1 -d .. < /build-scripts/sasl-xoauth2-02.patch
cmake -DCMAKE_INSTALL_PREFIX=/ ..
else
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
Expand All @@ -52,18 +22,16 @@ build_sasl2() {
update-ca-certificates
}

[ -f /etc/lsb-release ] && . /etc/lsb-release
[ -f /etc/os-release ] && . /etc/os-release
if [ -f /etc/alpine-release ]; then
apk add --upgrade --virtual .build-deps git cmake clang make gcc g++ libc-dev pkgconfig curl-dev jsoncpp-dev cyrus-sasl-dev patch
build_pandoc
build_sasl2
apk del .build-deps;
else
[ -f /etc/lsb-release ] && . /etc/lsb-release
[ -f /etc/os-release ] && . /etc/os-release
apt-get update -y -qq
LIBS="git build-essential cmake pkg-config libcurl4-openssl-dev libssl-dev libjsoncpp-dev libsasl2-dev"
apt-get install -y --no-install-recommends ${LIBS}
build_pandoc
build_sasl2
apt-get remove --purge -y ${LIBS}
apt-get autoremove --yes
Expand Down
12 changes: 12 additions & 0 deletions build-scripts/sasl-xoauth2-01.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da4dd69..3739e18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,6 @@ option(EnableTests "Enable tests." ON)
if(EnableTests)
enable_testing()
endif()
-add_subdirectory(docs)
add_subdirectory(scripts)
add_subdirectory(src)

File renamed without changes.

0 comments on commit 6964220

Please sign in to comment.