aboutsummaryrefslogblamecommitdiffstats
path: root/community/rspamd/APKBUILD
blob: a358f2385c4706beddbf9fafc94c52925cfab3af (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                      
                                                        
                                   
                                               
                                                   
              
          
        
                                                          
                         
          
                                                                                    
                               




                  




                    
                     
                   
                 



                  
                       
                                                    


                       
                     




                                   
                    
         
                                                                                        

                           
                      


                                   
         
 

                   
                                                                    

                            
                
                                                                    

                             
          


                                                     

    
         


                                                                                          
                        
                                         
                                             
                                         
                                        
                                         
                                           

                                         
                                   
                                           
                                         

                                               
                                    
                     

 
         
                                 
 
 
           
                                               
 
                    







                                                    
                           
                                   
 


                                             
 


                                                                              
 

                                       

                                             
                                
                                             
                                

                                             

                                      

 

                                           
 
                            

 


                                      


                                   
         
                                      

                      

                                         

 
         
                                                
                            

                          

                                            

 
              
                                                     

                          
 

                                              

 
         
                                           
                            

                          
                                         

 
                                                                                                                                                               
                                                                                                                                                   
                                                                                                                                              
                                                                                                                                              

                                                                                                                                                             
                                                                                                                                                          
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Nathan Angelacos <nangel@alpinelinux.org>
# Contributor: TBK <alpine@jjtc.eu>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Duncan Bellamy <dunk@denkimushi.com>
pkgname=rspamd
pkgver=2.7
pkgrel=3
pkgdesc="Fast, free and open-source spam filtering system"
url="https://rspamd.com/"
arch="all"
license="Apache-2.0 BSD-1-Clause BSD-2-Clause BSD-3-Clause CC0-1.0 LGPL-2.1-or-later
	LGPL-3.0-only MIT Zlib"
pkgusers="rspamd"
pkggroups="rspamd"
makedepends="
	cmake
	curl-dev
	file-dev
	gd-dev
	glib-dev
	icu-dev
	libevent-dev
	libsodium-dev
	openssl-dev
	pcre2-dev
	perl
	ragel
	sqlite-dev
	"
checkdepends="luarocks"
install="$pkgname.pre-install $pkgname.post-upgrade"
subpackages="
	$pkgname-doc
	$pkgname-client
	$pkgname-libs
	$pkgname-utils::noarch
	$pkgname-controller::noarch
	$pkgname-fuzzy::noarch
	$pkgname-proxy::noarch
	$pkgname-openrc
	$pkgname-dbg
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/rspamd/rspamd/archive/$pkgver.tar.gz
	$pkgname.logrotated
	$pkgname.initd
	$pkgname.confd
	30-conf-split-workers.patch
	20-default-configs.patch
	10-control_socket.patch
	"

case "$CARCH" in
	x86|x86_64)
		makedepends="$makedepends luajit-dev vectorscan-dev"
		_hm="ON"
		_jit="ON" ;;
	aarch64)
		makedepends="$makedepends lua5.3-dev vectorscan-dev"
		_hm="ON"
		_jit="OFF" ;;
	*)
		makedepends="$makedepends lua5.3-dev"
		_hm="OFF"
		_jit="OFF" ;;
esac

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCONFDIR=/etc/$pkgname \
		-DRUNDIR=/run/$pkgname \
		-DRSPAMD_USER=$pkgusers \
		-DRSPAMD_GROUP=$pkggroups \
		-DENABLE_REDIRECTOR=ON \
		-DENABLE_URL_INCLUDE=ON \
		-DENABLE_PCRE2=ON \
		-DENABLE_HYPERSCAN="$_hm" \
		-DENABLE_LUAJIT="$_jit" \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		"$CMAKE_CROSSOPTS" .
	make -C build
}

check() {
	make -C build rspamd-test
}

package() {
	make -C build DESTDIR="$pkgdir" install

	cd "$pkgdir"
	local path=usr/bin
	for b in rspamd rspamc rspamadm;
	do
		rm "$path"/$b
		mv "$path"/$b-$pkgver "$path"/$b
	done

	mv "$path"/rspamd_stats "$path"/rspamd-stats
	mkdir -p ./usr/sbin
	mv usr/bin/rspamd usr/sbin/

	mkdir -p usr/share/doc/$pkgname
	mv usr/share/$pkgname/www/README.md \
		usr/share/doc/$pkgname/

	install -Dm 644 "$srcdir"/$pkgname.logrotated etc/logrotate.d/$pkgname
	install -Dm 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname
	install -Dm 644 "$srcdir"/$pkgname.confd etc/conf.d/$pkgname

	mkdir -p etc/$pkgname/local.d \
		etc/$pkgname/override.d

	install -dm 750 -o rspamd -g rspamd \
		var/lib/$pkgname
	install -dm 750 -o rspamd -g rspamd \
		var/log/$pkgname
	install -dm 755 -o rspamd -g rspamd \
		etc/$pkgname/local.d/maps.d

	rm etc/rspamd/options.inc.orig
}

client() {
	pkgdesc="$pkgdesc (console client)"

	amove usr/bin/rspamc
}

libs() {
	pkgdesc="$pkgdesc (libraries)"

	amove usr/lib/$pkgname/*.so
}

utils() {
	pkgdesc="$pkgdesc (utilities)"
	depends="perl"

	amove usr/bin/"$pkgname"-stats
	amove usr/bin/$pkgname-redirector
}

fuzzy() {
	pkgdesc="$pkgdesc (local fuzzy storage)"
	license="Apache-2.0"
	depends="$pkgname"

	amove etc/$pkgname/worker-fuzzy.*
	amove etc/$pkgname/modules.d/fuzzy_*
}

controller() {
	pkgdesc="$pkgdesc (controller web interface)"
	license="MIT"
	depends="$pkgname"

	amove usr/share/$pkgname/www
	amove etc/$pkgname/worker-controller.*
}

proxy() {
	pkgdesc="$pkgdesc (milter support)"
	license="Apache-2.0"
	depends="$pkgname"

	amove etc/$pkgname/worker-proxy.*
}

sha512sums="8779771baf85ef6ca1d7d2180429072ab1547ab834b073ee9222dcc6494efdd0a23f5e7ac52a777c23fd89296769f5b6f182593e714097c6f11ca7c9165e4ba7  rspamd-2.7.tar.gz
2efe28575c40d1fba84b189bb872860e744400db80dce2f6330be6c6287fb3f46e6511284729b957488bf40bcb9b0952e26df9934f5f138334bd2766075c45cb  rspamd.logrotated
782e1126d32e450a1db0ac822c127b9a763f903093f200bdf603a6a0610a853671b94c89b0bb2d8ebdfb065e0cf62be51c1c7f451e8da34e25f252a276c2b0f3  rspamd.initd
a2003ef0c9d64a44480f59302864a2dfedcbe3a0047fcbb655408bc8aae9014b6ad0ddc6b64d4abeeb21bea0f86678afd30589ac8eed83e07ad7f87710e93702  rspamd.confd
a8aefee649bf6630339d1d3f2bb20c25ca70b21a8eaa92951e926d0fd4525f1d4ac4cc7ea66ac2b15323cf02c93c759ddf7181502f0d71b21384ced9d88c008e  30-conf-split-workers.patch
8801e3af59886847c25c87ca2f231cd9ededf35f376f9920967e72696fb017b1a4312f3a49017b52f65556bfe5c9f74a80405643afa32bb2906c38d39c5e1818  20-default-configs.patch
6f828601ce460f2fd3b1c430974b719e36b0aa5600bd7074683fd646d99a4e76da35840b54c50416a9ae6d87babe39c5d463fc2ec05814e164a96d16f5da18b7  10-control_socket.patch"