aboutsummaryrefslogtreecommitdiffstats
path: root/net/openbgpd/Makefile
blob: b9e3f249e4204d130d303336d7c4c5d681e6a93f (plain) (blame)
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
90
91
92
93
94
95
96
# New ports collection makefile for:    openbgpd
# Date created:             May 10 2005
# Whom:                 Florent Thoumie <flz@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME?=  openbgpd
PORTVERSION?=   4.0
PORTREVISION?=  0
CATEGORIES= net
MASTER_SITES=   ftp://ftp.openbsd.org/pub/OpenBSD/OpenBGPD/:openbsd \
        ${MASTER_SITE_LOCAL:S/$/:freebsd/g}
MASTER_SITE_SUBDIR= flz/openbgpd/:freebsd
DISTFILES?= ${PORTNAME}-${PORTVERSION}.tgz:openbsd,freebsd
DISTFILES+= if_media.h:freebsd hash.h:freebsd strtonum.c:freebsd
DIST_SUBDIR=    openbgpd
EXTRACT_ONLY=   ${PORTNAME}-${PORTVERSION}.tgz

MAINTAINER= farrokhi@FreeBSD.org
COMMENT=    Free implementation of the Border Gateway Protocol, Version 4

CONFLICTS=  zebra-0* quagga-0*

WRKSRC=     ${WRKDIR}
MANCOMPRESSED=  yes
USE_RC_SUBR=    openbgpd.sh
MAKE_ENV=   BINDIR="${PREFIX}/sbin" \
        MANDIR="${PREFIX}/man/man"
COPTS+=     -DRTA_LABEL=0

PLIST_FILES=    sbin/bgpctl \
        sbin/bgpd

SUB_FILES=  pkg-message

MAN5=       bgpd.conf.5
MAN8=       bgpctl.8    \
        bgpd.8

SUBDIRS=    bgpd \
        bgpctl

.include <bsd.port.pre.mk>

.if ${OSVERSION} < 600000
IGNORE=     requires strtonum in libc
.endif

.if ${OSVERSION} < 500037
IGNORE=     requires macros present in <sys/tree.h>
.endif

post-extract:
    @${CP} ${DISTDIR}/${DIST_SUBDIR}/if_media.h ${WRKSRC}/bgpctl/
    @${CP} ${DISTDIR}/${DIST_SUBDIR}/hash.h ${WRKSRC}/bgpd/

post-patch:
    @${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" \
        ${WRKSRC}/bgpd/Makefile         \
        ${WRKSRC}/bgpd/bgpd.8           \
        ${WRKSRC}/bgpd/bgpd.h           \
        ${WRKSRC}/bgpd/bgpd.conf.5      \
        ${WRKSRC}/bgpctl/Makefile       \
        ${WRKSRC}/bgpctl/bgpctl.8
    @${REINPLACE_CMD} -e "/__dead2/d"       \
        ${WRKSRC}/bgpd/bgpd.h
    @${REINPLACE_CMD} -e "s|__dead||"       \
        ${WRKSRC}/bgpd/bgpd.c       \
        ${WRKSRC}/bgpd/bgpd.h       \
        ${WRKSRC}/bgpctl/bgpctl.c
    @${REINPLACE_CMD} -e "s|SIMPLEQ|STAILQ|" ${WRKSRC}/bgpd/*.[chy]
    @${REINPLACE_CMD} -e "s|<net/if_media.h>|\"if_media.h\"|" ${WRKSRC}/bgpctl/bgpctl.c
    @${REINPLACE_CMD} -e "s|pfkey.c|pfkey_compat.c|" ${WRKSRC}/bgpd/Makefile
    @${REINPLACE_CMD} -e "s|sys/hash.h|hash.h|" \
        ${WRKSRC}/bgpd/rde_attr.c       \
        ${WRKSRC}/bgpd/rde_rib.c        \
        ${WRKSRC}/bgpd/rde_update.c
    @${REINPLACE_CMD} -e "s|rtm_fmask|rtm_use|" ${WRKSRC}/bgpd/kroute.c
    @${REINPLACE_CMD} -e "s|RTLABEL_LEN|PFTABLE_LEN|" ${WRKSRC}/bgpd/bgpd.h

do-build:
.for i in ${SUBDIRS}
    cd ${WRKSRC}/$i; make COPTS="${COPTS}"
.endfor

do-install:
.for i in ${SUBDIRS}
    cd ${WRKSRC}/$i; make install ${MAKE_ENV}
.endfor

post-install:
    @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>