# Maintainer: Valery Kartel # Contributor: Valery Kartel # Contributor: Nathan Angelacos pkgname=rspamd pkgver=1.4.3 pkgrel=1 pkgdesc="Fast, free and open-source spam filtering system" url="https://rspamd.com" arch="x86_64 x86 armhf" license="BSD" pkgusers="rspamd" pkggroups="rspamd" depends="" makedepends="cmake ragel perl lua-dev glib-dev pcre-dev gmime-dev libevent-dev sqlite-dev libressl-dev file-dev curl-dev" install="$pkgname.pre-install" subpackages="$pkgname-doc $pkgname-controller::noarch $pkgname-client $pkgname-fuzzy::noarch $pkgname-utils::noarch" source="https://rspamd.com/downloads/$pkgname-$pkgver.tar.xz $pkgname.logrotated $pkgname.initd $pkgname.confd config.patch cmakelists.patch " builddir="$srcdir/$pkgname-$pkgver" build() { cd "$builddir" cmake CMakeLists.txt \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCONFDIR=/etc/$pkgname \ -DRUNDIR=/run/$pkgname \ -DRSPAMD_USER=$pkgusers \ -DRSPAMD_GROUP=$pkggroups \ -DENABLE_DB=ON \ -DENABLE_SQLITE=ON \ -DENABLE_HIREDIS=ON \ -DENABLE_REDIRECTOR=ON \ -DENABLE_URL_INCLUDE=ON \ -DINSTALL_EXAMPLES=ON \ || return 1 make || return 1 } package() { cd "$builddir" make DESTDIR="$pkgdir" install || return 1 rm "$pkgdir"/etc/$pkgname/$pkgname.systemd.conf mv "$pkgdir"/etc/$pkgname/$pkgname.sysvinit.conf \ "$pkgdir"/etc/$pkgname/$pkgname.conf sed -ri -e 's~DBDIR(/rspamd.sock)~RUNDIR\1~' \ -e 's~rspamd_dynamic~dynamic~' \ "$pkgdir"/etc/$pkgname/options.inc mkdir -p "$pkgdir"/etc/$pkgname/local.d "$pkgdir"/etc/$pkgname/override.d install -Dm644 "$srcdir"/$pkgname.logrotated "$pkgdir"/etc/logrotate.d/$pkgname install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname install -dm750 -g $pkggroups "$pkgdir"/var/lib/$pkgname/dynamic install -dm750 -g $pkggroups "$pkgdir"/var/log/$pkgname chown $pkgusers "$pkgdir"/var/lib/$pkgname mkdir "$pkgdir"/usr/sbin find "$pkgdir"/usr/bin -type l -delete mv "$pkgdir"/usr/bin/rspamd-$pkgver "$pkgdir"/usr/sbin/rspamd mv "$pkgdir"/usr/bin/rspamadm-$pkgver "$pkgdir"/usr/bin/rspamadm mv "$pkgdir"/usr/share/examples "$pkgdir"/usr/share/doc mv "$pkgdir"/usr/share/$pkgname/www/README.md \ "$pkgdir"/usr/share/$pkgname/www/plugins.txt \ "$pkgdir"/usr/share/doc/$pkgname } controller() { license="MIT" depends="$pkgname" pkgdesc="$pkgdesc (controller web interface)" mkdir -p "$subpkgdir"/usr/share/$pkgname "$subpkgdir"/etc/$pkgname mv "$pkgdir"/usr/share/$pkgname/www "$subpkgdir"/usr/share/$pkgname/ mv "$pkgdir"/etc/$pkgname/worker-controller.* "$subpkgdir"/etc/$pkgname } client() { pkgdesc="$pkgdesc (console client)" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/rspamc-$pkgver "$subpkgdir"/usr/bin/rspamc } fuzzy() { depends="$pkgname" pkgdesc="$pkgdesc (local fuzzy storage)" mkdir -p "$subpkgdir"/etc/$pkgname/modules.d mv "$pkgdir"/etc/$pkgname/worker-fuzzy.* "$subpkgdir"/etc/$pkgname mv "$pkgdir"/etc/$pkgname/modules.d/fuzzy_* "$subpkgdir"/etc/$pkgname/modules.d } utils() { depends="perl" pkgdesc="$pkgdesc (utilities)" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/${pkgname}_stats "$subpkgdir"/usr/bin/${pkgname}-stats mv "$pkgdir"/usr/bin/${pkgname}-redirector "$subpkgdir"/usr/bin } md5sums="a64e00b906b7f3590e855be50106f99f rspamd-1.4.3.tar.xz c152c6a90f6ae9e5a7a1d137dfbc0305 rspamd.logrotated 0656acc12dcce7cba232857a848d0390 rspamd.initd ab12f33ad8e12a7437fb5ea4a9c92eef rspamd.confd ff0bf4f1b1447ca401865369f91418f1 config.patch 83f76787389649af63ea921f81cf35b3 cmakelists.patch" sha256sums="144cddc25ce8d8519b289d2c00d34b37c931f3c7293e2b0d16c408680021a1bf rspamd-1.4.3.tar.xz 6c5e79e9052d957f3d0d634b2ae7a56bbc0901a5d6946dc991c92f19a72fce97 rspamd.logrotated 5bcf68a72e0582859799cd335a14d48914e5291f4087327b3b42562ef64e2958 rspamd.initd fceba39a20755d48ef3838f7daa92ed9686a118c0a26f06bfe72cc7c15b2e384 rspamd.confd 7e0adb4a2e7e8f806fc5fdae0c37e6948ed56e9d46d4eed0c681806decb90e49 config.patch d4bc7851bb32b49be98e3964aa9195033b586da27f7f3afa5ce12dfbeadd96b0 cmakelists.patch" sha512sums="bae86953d881be446f049384cc8bf8451b04619b461a7e2d571407d5af5f2547af8bc9db578e84190e8c55d01f9e32ea1d29e998daa2bbb2fac431ed50df27ca rspamd-1.4.3.tar.xz 2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb rspamd.logrotated e240983c2fd91d8061b17e35e83a75c56ac2c3625dbe07b83a2e89e3dbf69b57c675d01772b93968aa6b22d150d54d366f2fb4a0c6551b3cfdedc77d82e28652 rspamd.initd 1320a752cbefe021079b3ed23e312231c39fc600baba7d8440c3e8bdd33ed673c8831b44a0c76788a8d905469e81088adf26cf245c09b4c2c4fdce7ff4219ee7 rspamd.confd 2089429e6f44f8204f31c87c565cdd7abcd51b3146397ba1b2fb23b1be6faf46fd8ec36718f194a3fc38ac1d38d7be9010a84ac4b49d7e1597706699538c607a config.patch 99593c10ffb04c71a4c83c7522b41f12465a9862283685bbc2fff464fd84fcf8b4bc4a892419d31332c01f805c69dd7730f537c60248b92fee35acdc6633a644 cmakelists.patch"