rspamd - steps to build rspamd from source

amd64 platform not working from custom repository
This commit is contained in:
2022-12-07 15:31:44 +01:00
parent 9388cf86a8
commit ee340cfc8c

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
readonly toolName=rspamd
readonly knownVersion="3.4"
readonly toolGit="https://github.com/vstakhov/rspamd.git"
# Already defined by sequencer.sh, but may be overwritten
#readonly seq_configName="${sq_scriptName:?}.cfg"
@@ -237,6 +239,99 @@ step_50() {
NOTES_END
}
step_60_info() { echoinfoArgs "[VERSION]"; echo "Build and install from source"; }
step_60_alias() { echo "buildlocal"; }
step_60() {
shift
local version="${1:-"${knownVersion}"}"
local buildHome="${HOME}/build"
local cloneDir="${buildHome}/rspamd"
local buildDir="${buildHome}/rspamd.build"
info "Building version ${version} in ${buildDir}"
exe mkdir -p "${buildHome}"
exe cd "${buildHome}"
exe git clone --recursive "${toolGit}"
info "Checkout version ${version}"
exe cd "${cloneDir}"
exe git checkout tags/${version} # check for latest tag
exe ./setVersion.sh "${version}" # check for latest tag
confirm -f -y -n "remove arm64 from ENABLE_LUAJIT ifneq"
exe editor debian/rules
confirm -f -y -n "enable WANT_SYSTEMD_UNITS, disable ENABLE_LUAJIT"
exe editor CMakeLists.txt
exe mkdir -p "${buildDir}"
exe cd "${buildDir}"
exe cmake "${cloneDir}" -DENABLE_HYPERSCAN=OFF
exe make
exe make install
exe install -g _rspamd -m 770 -d '/var/log/rspamd'
info "Change pathes in systemd file"
info -a "systemctl edit --full rspamd.service"
info
info "config: ${rbuild_confDir}"
}
readonly rbuild_confDir="/usr/local/etc/rspamd"
step_62_info() { echo "Uninstall local build (revert make install)"; }
step_62_alias() { echo "uninstall"; }
step_62() {
confirm "Are you sure to remove ${toolName}?" || return 1
if confirm "Backup config directory" ; then
info "Backing up ..."
exe cd "$(dirname -- "${rbuild_confDir}")"
exe tar czf "${HOME}/rspamd_config_build.tar.gz" "$(basename -- "${rbuild_confDir}")"
fi
info "Removing files and folder..."
exep systemctl stop rspamd \>/dev/null
exe rm -rf "${rbuild_confDir}"
exe rm -rf "/usr/local/share/rspamd"
exe rm -rf "/usr/local/lib/rspamd"
exe rm -rf "/usr/local/lib/systemd/system/rspamd.service"
exe rm -rf "/usr/local/share/man"/man*/rspam[dca]*.*
# rspamadm, rspamc, rspamd
exe rm -rf "/usr/local/bin/rspam"[adc]*
exe systemctl daemon-reload
}
step_64_info() { echoinfoArgs "[VERSION]"; echo "Install build dependencies for .deb build"; }
step_64_alias() { echo "builddeb"; }
step_64() {
exe apt install cmake ragel pkg-config libglib2.0-dev libsqlite3-dev libicu-dev libmagic-dev libssl-dev libsodium-dev redis libjemalloc-dev libcurl4-openssl-dev liblua5.1-0-dev libunwind-dev liblua5.1-0-dev
}
step_65_info() { echoinfoArgs "[VERSION]"; echo "Build .deb from source"; }
step_65() {
shift
local version="${1:-"${knownVersion}"}"
local buildHome="${HOME}/build"
local cloneDir="${buildHome}/rspamd"
local buildDir="${buildHome}/rspamd.dist"
local distDir="${buildDir}/rspamd.deb"
local tarball="rspamd.deb.tar.xz"
info "Building version ${version} in ${buildDir}"
exe mkdir -p "${buildHome}"
exe cd "${buildHome}"
exe git clone --recursive "${toolGit}"
info "Checkout version ${version}"
exe cd "${cloneDir}"
exe git checkout tags/${version} # check for latest tag
exe ./dist.sh "${buildDir}/${tarball}"
exe cd "${buildDir}"
exe tar xf "${tarball}"
exe cd "${distDir}"
exe ./setVersion.sh "${version}" # check for latest tag
exe editor debian/rules # remove arm64 from ENABLE_LUAJIT ifneq
# dpkg-source: -i[regex], --diff-ignore[=regex]
# dpkg-buildpackage: -b Equivalent to --build=binary or --build=any,all.
exe debuild -i --unsigned-source --unsigned-changes -b
}
# shellcheck disable=SC2034 # Appears unused
readonly sqr_minVersion=16
# shellcheck disable=SC1091 # Don't follow this source