diff --git a/srcpkgs/stalwart-cli/template b/srcpkgs/stalwart-cli/template new file mode 100644 index 00000000000000..806e1c76208b3d --- /dev/null +++ b/srcpkgs/stalwart-cli/template @@ -0,0 +1,15 @@ +# Template file for 'stalwart-cli' +pkgname=stalwart-cli +version=2.0.1 +revision=1 +build_style=cargo +short_desc="Stalwart Command Line Interface" +maintainer="John " +license="AGPL-3.0-only" +homepage="https://stalw.art" +distfiles="https://github.com/stalwartlabs/cli/archive/refs/tags/v${version}.tar.gz" +checksum=4471e99d2ef2ad87155c80a1261c20eaa06f71e2a58fdff5804bea8af5caaaa9 + +post_install() { + vlicense LICENSES/AGPL-3.0-only.txt +} diff --git a/srcpkgs/stalwart-webui/template b/srcpkgs/stalwart-webui/template new file mode 100644 index 00000000000000..abdc0f755583cf --- /dev/null +++ b/srcpkgs/stalwart-webui/template @@ -0,0 +1,26 @@ +# Template file for 'stalwart-webui' +pkgname=stalwart-webui +version=2.1.3 +revision=1 +hostmakedepends="nodejs" +short_desc="Stalwart WebUI" +maintainer="John " +license="AGPL-3.0-only" +homepage="https://stalw.art" +distfiles="https://github.com/stalwartlabs/webui/archive/refs/tags/v${version}.tar.gz" +checksum=d72c2bc49387bf958285240b0aa76d99277205efeff0707f947700053f53fd87 + +do_configure() { + npm ci +} + +do_build() { + npm run build + bsdtar -a -cf webui.zip -C./dist . +} + +do_install() { + vmkdir usr/share/stalwart + vinstall webui.zip 644 usr/share/stalwart + vlicense LICENSES/AGPL-3.0-only.txt +} diff --git a/srcpkgs/stalwart/create-archive.sh b/srcpkgs/stalwart/create-archive.sh new file mode 100755 index 00000000000000..c7509606d7723e --- /dev/null +++ b/srcpkgs/stalwart/create-archive.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# create-archive GIT-DIR VERSION +DIR="${1?no directory given}" +VER="${2?no version given}" + +chdir "${1}" +git checkout "v${2}" +python3 resources/scripts/ossify.py crates +git add . +git commit -m "Remove non oss code" +git archive --format=tar "--prefix=stalwart-v${version}/" HEAD | zstd > "stalwart-v${version}.tar.zst" diff --git a/srcpkgs/stalwart/files/config.json b/srcpkgs/stalwart/files/config.json new file mode 100644 index 00000000000000..e530361b7ebc7a --- /dev/null +++ b/srcpkgs/stalwart/files/config.json @@ -0,0 +1,4 @@ +{ + "@type": "RocksDb", + "path": "/var/lib/stalwart/" +} diff --git a/srcpkgs/stalwart/files/stalwart/run b/srcpkgs/stalwart/files/stalwart/run new file mode 100755 index 00000000000000..da921e8d66497a --- /dev/null +++ b/srcpkgs/stalwart/files/stalwart/run @@ -0,0 +1,9 @@ +#!/bin/sh +[ -r conf ] && . ./conf + +exec 2>&1 +exec setpriv --reuid _stalwart --regid _stalwart --clear-groups \ + --ambient-caps -all,+net_bind_service \ + --inh-caps -all,+net_bind_service \ + --bounding-set -all,+net_bind_service \ + --no-new-privs -- /usr/bin/stalwart -c /etc/stalwart.json diff --git a/srcpkgs/stalwart/patches/sonic-simd-i686.patch b/srcpkgs/stalwart/patches/sonic-simd-i686.patch new file mode 100644 index 00000000000000..3b9a2f63d18062 --- /dev/null +++ b/srcpkgs/stalwart/patches/sonic-simd-i686.patch @@ -0,0 +1,12 @@ +Upstream: nop +Reason: last sonic-simd release does not compile on i686, future releases will pick this up + +diff --git a/Cargo.toml b/Cargo.toml +index 6392a66c1..f1a0cadd4 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -144,3 +144,4 @@ hickory-net = { git = "https://github.com/stalwartlabs/hickory-dns", branch = "s + hickory-resolver = { git = "https://github.com/stalwartlabs/hickory-dns", branch = "stalwart/0.26" } + librocksdb-sys = { git = "https://github.com/stalwartlabs/rust-rocksdb", branch = "stalwart/0.25" } + rxing = { git = "https://github.com/stalwartlabs/rxing", branch = "finder-candidate-cap-0.9.4" } ++sonic-simd = { git = "https://github.com/cloudwego/sonic-rs", rev = "3b829600ca347bcaa182155794871385222bc2ba" } diff --git a/srcpkgs/stalwart/patches/use-local-webui.patch b/srcpkgs/stalwart/patches/use-local-webui.patch new file mode 100644 index 00000000000000..499c97e1698472 --- /dev/null +++ b/srcpkgs/stalwart/patches/use-local-webui.patch @@ -0,0 +1,16 @@ +source: https://gitlab.archlinux.org/archlinux/packaging/packages/stalwart/-/raw/main/use-local-webui-archive.patch +upstream: no + +--- a/crates/common/src/manager/defaults.rs ++++ b/crates/common/src/manager/defaults.rs +@@ -62,9 +62,7 @@ async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> { + description: "Stalwart Web Interface".to_string(), + enable: true, + #[cfg(not(feature = "dev_mode"))] +- resource_url: +- "https://github.com/stalwartlabs/webui/releases/download/v2/webui.zip" +- .into(), ++ resource_url: "file:///usr/share/stalwart/webui.zip".into(), + #[cfg(feature = "dev_mode")] + resource_url: "file://../webui/.ignore/webui.zip".into(), + url_prefix: Map::new(vec!["/admin".into(), "/account".into()]), diff --git a/srcpkgs/stalwart/template b/srcpkgs/stalwart/template new file mode 100644 index 00000000000000..035e1a0176b26b --- /dev/null +++ b/srcpkgs/stalwart/template @@ -0,0 +1,38 @@ +# Template file for 'stalwart' +pkgname=stalwart +version=1.2.3 +revision=1 +build_style=cargo +configure_args="--no-default-features --features sqlite,postgres,mysql,rocks,s3,redis,keep,azure,nats,exchange" +make_build_args="-p stalwart" +make_install_args="--path crates/main" +hostmakedepends="pkg-config libzstd-devel clang23-devel" +makedepends="libzstd-devel clang23-devel sqlite-devel rocksdb-devel" +depends="stalwart-webui" +short_desc="Mail & Collaboration server (IMAP, JMAP, SMTP, CalDAV, CardDAV, WebDAV)" +maintainer="John " +license="AGPL-3.0-only AND MIT AND Unlicense" +homepage="https://stalw.art/" +# The default archive contains source code we aren't allowed to distribute +distfiles="https://void.johnnynator.dev/distfiles/stalwart-v${version}.tar.zst" +checksum=f5a39b0a1d36c020e98f5aff204b405f7063c100fdaaeddd3ab0b755c8078ac7 +conf_files="/etc/stalwart.json" +system_accounts="_stalwart" + +make_dirs="/var/lib/stalwart 0750 ${system_accounts} ${system_accounts} + /var/lib/stalwart 0755 ${system_accounts} ${system_accounts}" + +export CARGO_PROFILE_RELEASE_LTO=thin +export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 +export ROCKSDB_LIB_DIR="${XBPS_CROSS_BASE}/usr/lib" +export HOST_PKG_CONFIG_PATH=/usr/bin/pkg-config + +post_patch() { + cargo metadata > /dev/null +} + +post_install() { + vsv stalwart + vconf "${FILESDIR}/config.json" stalwart.json + vlicense LICENSES/AGPL-3.0-only.txt +}