git: 5257c025737e - main - net-mgmt/pmacct: fix build on big-endian architectures

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Thu, 24 Sep 2026 12:54:10 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5257c025737e60e5c251ebf63c27caf9a2c9c655

commit 5257c025737e60e5c251ebf63c27caf9a2c9c655
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-09-16 07:08:49 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-09-24 12:53:31 +0000

    net-mgmt/pmacct: fix build on big-endian architectures
    
    1. pmacct.h redefines the system byte-order macros, which fails
    because of -Werror=macro-redefined.
    2. POWER passes configure's unaligned test, but then Assign16(a,b) a=b
    truncates a 16-bit ethertype into a 1-byte lvalue. Force byte-copy
    Assign macros to fix it.
---
 net-mgmt/pmacct/Makefile                 |  4 ++++
 net-mgmt/pmacct/files/patch-src_pmacct.h | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/net-mgmt/pmacct/Makefile b/net-mgmt/pmacct/Makefile
index ddfe7b8b521e..926075275e45 100644
--- a/net-mgmt/pmacct/Makefile
+++ b/net-mgmt/pmacct/Makefile
@@ -69,6 +69,10 @@ GEOIP2_CONFIGURE_ENABLE=	geoipv2
 
 .if ${ARCH} == "i386"
 EXTRA_PATCHES+=	${FILESDIR}/extra-patch-i386
+# powerpc: force the byte-copy Assign macros; the simple ones truncate 16/32-bit
+# values into u_char packet fields (fails -Werror on BE, wrong ethertype).
+.elif ${ARCH:Mpowerpc*}
+CFLAGS+=	-DNEED_ALIGN
 .endif
 
 PLIST_SUB+=	SQLDOC=${SQLDOC}
diff --git a/net-mgmt/pmacct/files/patch-src_pmacct.h b/net-mgmt/pmacct/files/patch-src_pmacct.h
new file mode 100644
index 000000000000..6592e4d35b87
--- /dev/null
+++ b/net-mgmt/pmacct/files/patch-src_pmacct.h
@@ -0,0 +1,16 @@
+--- src/pmacct.h.orig	2026-09-16 06:48:00 UTC
++++ src/pmacct.h
+@@ -106,9 +106,13 @@
+ #endif
+ 
+ #if defined IM_BIG_ENDIAN
++#undef ntohs
+ #define ntohs(x) (x)
++#undef ntohl
+ #define ntohl(x) (x)
++#undef htons
+ #define htons(x) (x)
++#undef htonl
+ #define htonl(x) (x)
+ #endif
+