app-admin/ulogd: ppc stable wrt bug #581258
[gentoo.git] / app-admin / ulogd / ulogd-2.0.5_p20160205.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 AUTOTOOLS_AUTORECONF=1
8 COMMIT_ID="a82d9cfe03679b82ab4d9586c93ad377e9e27149"
9
10 inherit autotools-utils eutils flag-o-matic linux-info readme.gentoo-r1 systemd user vcs-snapshot
11
12 DESCRIPTION="A userspace logging daemon for netfilter/iptables related logging"
13 HOMEPAGE="https://netfilter.org/projects/ulogd/index.html"
14 SRC_URI="https://git.netfilter.org/${PN}2/snapshot/${COMMIT_ID}.tar.gz -> ${P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="amd64 ~ia64 ppc x86"
19 IUSE="dbi doc json mysql nfacct +nfct +nflog pcap postgres sqlite -ulog"
20
21 RDEPEND="
22         || ( net-firewall/iptables net-firewall/nftables )
23         >=net-libs/libnfnetlink-1.0.1
24         dbi? ( dev-db/libdbi )
25         json? ( dev-libs/jansson )
26         nfacct? (
27                 >=net-libs/libmnl-1.0.3
28                 >=net-libs/libnetfilter_acct-1.0.1
29         )
30         nfct? ( >=net-libs/libnetfilter_conntrack-1.0.2 )
31         nflog? ( >=net-libs/libnetfilter_log-1.0.0 )
32         mysql? ( virtual/mysql )
33         pcap? ( net-libs/libpcap )
34         postgres? ( dev-db/postgresql:= )
35         sqlite? ( dev-db/sqlite:3 )
36 "
37 DEPEND="${RDEPEND}
38         doc? (
39                 app-text/linuxdoc-tools
40                 app-text/texlive-core
41                 dev-texlive/texlive-fontsrecommended
42                 virtual/latex-base
43         )
44 "
45
46 DOCS=( AUTHORS README TODO )
47
48 DOC_CONTENTS="
49         You must have at least one logging stack enabled to make ulogd work.
50         Please edit the example configuration located at /etc/ulogd.conf.
51 "
52
53 pkg_setup() {
54         enewgroup ulogd
55         enewuser ulogd -1 -1 /var/log/ulogd ulogd
56
57         linux-info_pkg_setup
58
59         if kernel_is lt 2 6 14; then
60                 die "${PN} requires a kernel >= 2.6.14."
61         fi
62
63         if use nfacct && kernel_is lt 3 3 0; then
64                 ewarn "NFACCT input plugin requires a kernel >= 3.3."
65         fi
66
67         if use ulog && kernel_is ge 3 17 0; then
68                 ewarn "ULOG target has been removed in the 3.17 kernel release."
69                 ewarn "Consider enabling NFACCT, NFCT, or NFLOG support instead."
70         fi
71 }
72
73 src_prepare() {
74         # - make all logs to be kept in a single dir /var/log/ulogd
75         # - place sockets in /run instead of /tmp
76         sed -i \
77                 -e "s%var/log%var/log/${PN}%g" \
78                 -e 's%tmp%run%g' \
79                 ulogd.conf.in || die
80
81         append-lfs-flags
82         autotools-utils_src_prepare
83 }
84
85 src_configure() {
86         local myeconfargs=(
87                 $(use_with dbi)
88                 $(use_with json jansson)
89                 $(use_enable nfacct)
90                 $(use_enable nfct)
91                 $(use_enable nflog)
92                 $(use_with mysql)
93                 $(use_with pcap)
94                 $(use_with postgres pgsql)
95                 $(use_with sqlite)
96                 $(use_enable ulog)
97         )
98         autotools-utils_src_configure
99 }
100
101 src_compile() {
102         autotools-utils_src_compile
103
104         if use doc; then
105                 # Prevent access violations from bitmap font files generation
106                 export VARTEXFONTS="${T}"/fonts
107                 emake -C doc
108         fi
109 }
110
111 src_install() {
112         autotools-utils_src_install
113         prune_libtool_files --modules
114         readme.gentoo_create_doc
115
116         if use doc; then
117                 dohtml doc/${PN}.html
118                 dodoc doc/${PN}.{dvi,ps,txt}
119         fi
120
121         use mysql && dodoc doc/mysql-*.sql
122         use postgres && dodoc doc/pgsql-*.sql
123         use sqlite && dodoc doc/sqlite3.table
124
125         doman ${PN}.8
126
127         insinto /etc
128         doins "${BUILD_DIR}/${PN}.conf"
129         fowners root:ulogd /etc/${PN}.conf
130         fperms 640 /etc/${PN}.conf
131
132         newinitd "${FILESDIR}/${PN}.init" ${PN}
133         systemd_dounit "${FILESDIR}/${PN}.service"
134
135         insinto /etc/logrotate.d
136         newins "${FILESDIR}/${PN}.logrotate" ${PN}
137
138         diropts -o ulogd -g ulogd
139         keepdir /var/log/ulogd
140 }
141
142 pkg_postinst() {
143         readme.gentoo_print_elog
144 }