Skip to content

Commit

Permalink
sysutils/pftop: build against native libpfctl #182
Browse files Browse the repository at this point in the history
So we have a "libpfctl" for abstraction but the base system
a particular "libpfctl" originates from does not provide the
libary so we need to jump through a couple of hoops to embed
the libary into the pftop build in order to retain compatibility
on stable/13?
  • Loading branch information
fichtner committed Nov 13, 2023
1 parent d7a9be1 commit 5808f51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
17 changes: 3 additions & 14 deletions sysutils/pftop/Makefile
Expand Up @@ -8,38 +8,27 @@ 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
LDFLAGS+= -lnv

OPTIONS_DEFINE= ALTQ

ALTQ_DESC= ALTQ support for queue statistics

.include <bsd.port.options.mk>

MAKE_ARGS= LOCALBASE="${PREFIX}"

CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1
CFLAGS+= -DHAVE_SNPRINTF=1 -DHAVE_VSNPRINTF=1 -I${SRC_BASE}/lib/libpfctl

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

MAKE_ARGS+= CSTD=gnu89
MAKE_ARGS+= SRC_BASE=${SRC_BASE}
MAKE_ENV+= __MAKE_CONF=/dev/null

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

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/pftop \
${STAGEDIR}${PREFIX}/sbin
${INSTALL_MAN} ${WRKSRC}/pftop.8 \
${STAGEDIR}${MANPREFIX}/man/man8

.include <bsd.port.mk>
23 changes: 23 additions & 0 deletions sysutils/pftop/files/patch-Makefile
@@ -0,0 +1,23 @@
--- Makefile.orig 2023-11-13 07:20:46 UTC
+++ Makefile
@@ -1,4 +1,5 @@
# $Id: Makefile,v 1.17 2007/10/01 02:27:13 canacar Exp $
+.PATH: ${SRC_BASE}/lib/libpfctl

# set OS level if not already defined
OSLEVEL?= ${OSrev}
@@ -8,12 +9,13 @@ PROG= pftop
SRCS= pftop.c cache.c engine.c
SRCS+= sf-gencode.c sf-grammer.y sf-scanner.l pcap-nametoaddr.c
SRCS+= bpf_optimize.c bpf_filter.c bpf_dump.c bpf_image.c
+SRCS+= libpfctl.c
MAN= pftop.8

CFLAGS+= -Wall -Wno-unneeded-internal-declaration -DOS_LEVEL=${OSLEVEL}
LDADD+= -lcurses

-MANDIR=${LOCALBASE}/man/cat
+MANDIR=${LOCALBASE}/man/man
BINDIR=${LOCALBASE}/sbin

.y.c:

0 comments on commit 5808f51

Please sign in to comment.