app-cdr/cdemu-daemon: Bump to 3.2.1
[gentoo.git] / sys-freebsd / freebsd-pf / freebsd-pf-11.1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit bsdmk freebsd user
7
8 DESCRIPTION="FreeBSD's base system libraries"
9 SLOT="0"
10
11 IUSE=""
12
13 # Crypto is needed to have an internal OpenSSL header
14 if [[ ${PV} != *9999* ]]; then
15         KEYWORDS="~amd64-fbsd ~x86-fbsd"
16 fi
17
18 EXTRACTONLY="
19         usr.sbin/
20         sbin/
21         contrib/pf/
22         etc/
23 "
24
25 RDEPEND="net-libs/libpcap"
26 DEPEND="${RDEPEND}
27         dev-libs/libevent
28         =sys-freebsd/freebsd-mk-defs-${RV}*
29         =sys-freebsd/freebsd-sources-${RV}*"
30
31 S="${WORKDIR}"
32
33 SUBDIRS="usr.sbin/authpf sbin/pfctl sbin/pflogd usr.sbin/ftp-proxy"
34
35 pkg_setup() {
36         enewgroup authpf 63
37 }
38
39 src_prepare() {
40         # pcap-int.h redefines snprintf as pcap_snprintf
41         epatch "${FILESDIR}/${PN}-9.0-pcap_pollution.patch"
42         # Use system's libevent
43         epatch "${FILESDIR}/${PN}-11.1-libevent.patch"
44         epatch "${FILESDIR}/${PN}-11.1-pflogd.patch"
45         epatch "${FILESDIR}/${PN}-9.0-bpf.patch"
46         # Link in kernel sources
47         [[ ! -e "${WORKDIR}/sys" ]] && ln -s "/usr/src/sys" "${WORKDIR}/sys"
48 }
49
50 src_compile() {
51         for dir in ${SUBDIRS}; do
52                 einfo "Starting make in ${dir}"
53                 cd "${S}/${dir}" || die
54                 freebsd_src_compile || die "Make ${dir} failed"
55         done
56 }
57
58 src_install() {
59         for dir in ${SUBDIRS}; do
60                 einfo "Starting install in ${dir}"
61                 cd "${S}/${dir}" || die
62                 freebsd_src_install || die "Install ${dir} failed"
63         done
64
65         cd "${WORKDIR}"/etc
66         insinto /etc
67         doins pf.os
68         # pf.initd provided by openrc, but no pf.confd
69         newconfd "${FILESDIR}/pf.confd" pf
70 }