git: 7075bf819e7c - main - net/libpcap: Fix build

From: Renato Botelho <garga_at_FreeBSD.org>
Date: Wed, 22 Dec 2021 16:07:04 UTC
The branch main has been updated by garga:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7075bf819e7c5c63fe08db41a406d89a25dac7d3

commit 7075bf819e7c5c63fe08db41a406d89a25dac7d3
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-12-22 16:04:17 +0000
Commit:     Renato Botelho <garga@FreeBSD.org>
CommitDate: 2021-12-22 16:06:50 +0000

    net/libpcap: Fix build
    
    Fix build issues since if_pflog.h added a net/bpf.h include
    
    Obtained from:  https://github.com/the-tcpdump-group/libpcap/pull/1074
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 net/libpcap/Makefile               |  1 +
 net/libpcap/files/patch-gencode.c  | 20 ++++++++++++++++++++
 net/libpcap/files/patch-pcap_bpf.h | 13 +++++++++++++
 3 files changed, 34 insertions(+)

diff --git a/net/libpcap/Makefile b/net/libpcap/Makefile
index c04ddbff131f..5be5227c71b5 100644
--- a/net/libpcap/Makefile
+++ b/net/libpcap/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	libpcap
 PORTVERSION=	1.10.1
+PORTREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	http://www.tcpdump.org/release/
 
diff --git a/net/libpcap/files/patch-gencode.c b/net/libpcap/files/patch-gencode.c
new file mode 100644
index 000000000000..5f626d26ab32
--- /dev/null
+++ b/net/libpcap/files/patch-gencode.c
@@ -0,0 +1,20 @@
+--- gencode.c.orig	2021-06-07 20:21:35 UTC
++++ gencode.c
+@@ -59,10 +59,16 @@
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #include <net/pfvar.h>
+-#include <net/if_pflog.h>
+ #endif /* HAVE_NET_PFVAR_H */
+ 
+ #include "pcap-int.h"
++
++#ifdef HAVE_NET_PFVAR_H
++/* FreeBSD includes <net/bpf.h> from <net/if_pflog.h>, and indirectly includes
++ * <net/dlt.h>. The FreeBSD version lacks DLT_IEEE802_15_4_TAP, so we really
++ * want to use our own version. */
++#include <net/if_pflog.h>
++#endif /* HAVE_NET_PFVAR_H */
+ 
+ #include "extract.h"
+ 
diff --git a/net/libpcap/files/patch-pcap_bpf.h b/net/libpcap/files/patch-pcap_bpf.h
new file mode 100644
index 000000000000..96679e5d5727
--- /dev/null
+++ b/net/libpcap/files/patch-pcap_bpf.h
@@ -0,0 +1,13 @@
+--- pcap/bpf.h.orig	2021-06-07 20:21:35 UTC
++++ pcap/bpf.h
+@@ -78,6 +78,10 @@
+  */
+ #if !defined(_NET_BPF_H_) && !defined(_NET_BPF_H_INCLUDED) && !defined(_BPF_H_) && !defined(_H_BPF) && !defined(lib_pcap_bpf_h)
+ #define lib_pcap_bpf_h
++#define _NET_BPF_H_
++#define _NET_BPF_H_INCLUDED
++#define _BPF_H_
++#define _H_BPF
+ 
+ #include <pcap/funcattrs.h>
+