Skip to content

Commit

Permalink
sysutils/pftop: Update to 0.9 (support 15-CURRENT)
Browse files Browse the repository at this point in the history
All local patches have been upstreamed and upstream has been cleaned up
by removing support for outdated versions of FreeBSD.

The tool now depends on net/libpfctl, important work contributed
by kp@, which means that pftop will now work on 15-CURRENT
and its code could be simplified due to having an abstraction
for supporting multiple releases of FreeBSD.
  • Loading branch information
Michael Gmelin authored and Michael Gmelin committed Nov 4, 2023
1 parent a2e27bb commit 6ee5816
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 1,725 deletions.
56 changes: 10 additions & 46 deletions sysutils/pftop/Makefile
@@ -1,6 +1,5 @@
PORTNAME= pftop
PORTVERSION= 0.8
PORTREVISION= 4
PORTVERSION= 0.9
CATEGORIES= sysutils net

MAINTAINER= grembo@FreeBSD.org
Expand All @@ -9,68 +8,33 @@ WWW= https://github.com/grembo/pftop/

LICENSE= BSD2CLAUSE

LIB_DEPENDS= libpfctl.so:net/libpfctl

USE_GITHUB= yes
GH_ACCOUNT= grembo

CFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib -lpfctl

OPTIONS_DEFINE= ALTQ

ALTQ_DESC= ALTQ support for queue statistics

.include <bsd.port.options.mk>

EXTRA_PATCHES+= ${FILESDIR}/extra-patch-bpf_dump.c \
${FILESDIR}/extra-patch-sf-gencode.h

MAKE_ARGS= LOCALBASE="${PREFIX}" \

.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400090
MAKE_ARGS+= OSLEVEL=46
.else
MAKE_ARGS+= OSLEVEL=45
.endif
MAKE_ARGS= LOCALBASE="${PREFIX}"

CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 \
-DHAVE_FINE_GRAINED_LOCKING=1
CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1

.if ${PORT_OPTIONS:MALTQ}
CFLAGS+= -DHAVE_ALTQ=1
.endif

EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cache.c ${FILESDIR}/extra-patch-cache.h \
${FILESDIR}/extra-patch-config.h \
${FILESDIR}/extra-patch-pftop.c \
${FILESDIR}/extra-patch-sf-gencode.c

EXTRA_PATCHES+= ${FILESDIR}/extra-patch-engine.c

MAKE_ARGS+= CSTD=gnu89
MAKE_ENV+= __MAKE_CONF=/dev/null

PLIST_FILES= sbin/pftop \
man/man8/pftop.8.gz

post-patch:
@${ECHO_MSG} "===> Applying FairQ/Codel patches to ${PORTNAME}."
@${CAT} ${FILESDIR}/extra-patch-fairq_codel.diff | \
${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS}
@${REINPLACE_CMD} -e 's|<sys/queue.h>|"${FILESDIR}/queue.h"|g' \
${WRKSRC}/engine.c
@${REINPLACE_CMD} -e 's|__dead|__dead2|g' \
${WRKSRC}/sf-gencode.h
@${REINPLACE_CMD} -e 's|__dead|__dead2|g' \
${WRKSRC}/sf-gencode.c
@${REINPLACE_CMD} -e 's|#include <net/if_pflog.h>||g' \
${WRKSRC}/sf-gencode.c
@${REINPLACE_CMD} -e 's|altq/|net/&|' \
${WRKSRC}/pftop.c
@${REINPLACE_CMD} -e 's|#include .pcap-int.h.|#include <pcap/pcap.h>|g' \
${WRKSRC}/bpf_image.c \
${WRKSRC}/bpf_optimize.c \
${WRKSRC}/pcap-nametoaddr.c \
${WRKSRC}/sf-gencode.c \
${WRKSRC}/sf-gencode.h \
${WRKSRC}/sf-grammer.y \
${WRKSRC}/sf-scanner.l
PLIST_FILES= man/man8/pftop.8.gz \
sbin/pftop

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/pftop \
Expand Down
6 changes: 3 additions & 3 deletions sysutils/pftop/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1654618929
SHA256 (grembo-pftop-0.8_GH0.tar.gz) = 72b2ed39664771c22689ccb5ec7098792335717d926a8b87d987d8b628902d65
SIZE (grembo-pftop-0.8_GH0.tar.gz) = 59599
TIMESTAMP = 1699105116
SHA256 (grembo-pftop-0.9_GH0.tar.gz) = 9b2dd44dba66c228ae03a88d65e6424f42872d2d73be776e055c5005998731d9
SIZE (grembo-pftop-0.9_GH0.tar.gz) = 62612
15 changes: 0 additions & 15 deletions sysutils/pftop/files/extra-patch-bpf_dump.c

This file was deleted.

84 changes: 0 additions & 84 deletions sysutils/pftop/files/extra-patch-cache.c

This file was deleted.

29 changes: 0 additions & 29 deletions sysutils/pftop/files/extra-patch-cache.h

This file was deleted.

28 changes: 0 additions & 28 deletions sysutils/pftop/files/extra-patch-config.h

This file was deleted.

13 changes: 0 additions & 13 deletions sysutils/pftop/files/extra-patch-engine.c

This file was deleted.

102 changes: 0 additions & 102 deletions sysutils/pftop/files/extra-patch-fairq_codel.diff

This file was deleted.

0 comments on commit 6ee5816

Please sign in to comment.