aboutsummaryrefslogtreecommitdiffstats
path: root/main/snort/APKBUILD
blob: 325a43e17f6e44ef652db271f0468453ff0d965f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Contributor: Michael Mason <ms13sp@gmail.com>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=snort
pkgver=2.9.4.6
pkgrel=0
pkgdesc="An open source network intrusion prevention and detection system"
url="http://www.snort.org/"
arch="all"
license="GPL"
depends=
makedepends="pcre-dev libpcap-dev libnet-dev libdnet-dev daq-dev
	autoconf automake libtool bison flex zlib-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-dev"
source="http://www.snort.org/dl/snort-current/snort-$pkgver.tar.gz
	automake.patch
        snort.initd
        snort.confd
	"
pkgusers="snort"
pkggroups="snort"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
        cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# fix parallel builds
	sed -i -e 's/^all-local:.*/all-local: $(LTLIBRARIES)/' \
		src/dynamic-preprocessors/*/Makefile.am || return 1
	# correct paths in default config file
	sed -i -e 's|/usr/local|/usr|' etc/snort.conf || return 1
	sed -i -e 's|\.\./|/var/lib/snort/|' etc/snort.conf || return 1
	
	libtoolize --force && aclocal -I m4 && autoconf \
		&& automake --add-missing || return 1

}

build() {
        cd "$_builddir"
        ./configure --prefix=/usr \
                --sysconfdir=/etc \
                --mandir=/usr/share/man \
                --infodir=/usr/share/info \
                --enable-ipv6 \
                --enable-gre
        make || return 1
}

package() {
        cd "$_builddir"
        make -j1 DESTDIR="$pkgdir" install
	rm "$pkgdir"/usr/lib/*/*.la \
		"$pkgdir"/usr/lib/snort/*/*.la || return 1

        install -D -m 755 ../snort.initd "$pkgdir"/etc/init.d/snort
        install -D -m 644 ../snort.confd "$pkgdir"/etc/conf.d/snort
        install -D -m 644 etc/snort.conf "$pkgdir"/etc/snort/snort.conf
        install -D -m 644 rpm/snort.logrotate "$pkgdir"/etc/logrotate.d/snort
	mkdir -p "$pkgdir"/usr/lib/snort_dynamicrules
	mkdir -p "$pkgdir"/var/lib/snort/rules
	mkdir -m 770 -p "$pkgdir"/var/log/snort && chown snort.snort "$pkgdir"/var/log/snort
	for file in classification.config reference.config threshold.conf \
		unicode.map
	do
		ln -s /var/lib/snort/etc/$file "$pkgdir"/etc/snort/$file
	done
	touch "$pkgdir"/var/lib/snort/rules/white_list.rules
	touch "$pkgdir"/var/lib/snort/rules/black_list.rules
}

md5sums="4111df01a4f21bd1d328a18b76d625bd  snort-2.9.4.6.tar.gz
6a8b6d9c00971d419f0c1ea036c76ea4  automake.patch
b65d10cce3e79f38aa6fb5e0aa494144  snort.initd
446f8d2b3435b8a6be738da978670605  snort.confd"
sha256sums="cfaa5390b1840aaaa68a6c05a7077dd92cb916e6186a014baa451d43cdb0b3bc  snort-2.9.4.6.tar.gz
b6d1b0affb4056f1eb6dbfc375dbbe52d943ca7f79228aa92c0bfac9ee84f025  automake.patch
6fc40466781dcae894f9ac1447feac9d33bc548a39cb78c19ee1dad2639a93b6  snort.initd
d504cb31ffcce9acc8fc7b68123a31a53b491444c52730339ea9a4e986521f71  snort.confd"
sha512sums="e35e22cab3b98bbd42ffb4b88c4c4cc9b1c11e35952a9f3f4f684c02c81ca8604b45d16f42b3d0a6c792eeab86a8e319d8ebdd7b1a5215f93ec0e70b6ef53f98  snort-2.9.4.6.tar.gz
2c60d48feebe5c8755aaad4ce6dc1b95ba1cec0d340506007bb489bb578bf1e24d5ade8492f9108efc5ea62be9d5fe6deffdafc88e607cf4386a8c6adf1868b1  automake.patch
0f796d826cbc736558783c6d31c2573343984c87480c6476db3723ba1a8d28f93e445f850febd67a0dbd11ea558ef1161121ad4a3145f73af7eb30d7702e0b6b  snort.initd
abc0846ea6e08029c772f24e213f211a39219701e6e2c8b3aa112632318479db7b21014c5f2c4987cb2981cafce0ea744549c3ce754e9145cba9ec5604ae66f3  snort.confd"