1DESCRIPTION = "wireshark - a popular network protocol analyzer"
2HOMEPAGE = "http://www.wireshark.org"
3SECTION = "net"
4LICENSE = "GPL-2.0-only"
5LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
6
7DEPENDS = "pcre2 expat glib-2.0 glib-2.0-native libgcrypt libgpg-error libxml2 bison-native c-ares speexdsp"
8
9DEPENDS:append:class-target = " wireshark-native chrpath-replacement-native "
10
11SRC_URI = "https://1.eu.dl.wireshark.org/src/wireshark-${PV}.tar.xz \
12           file://0001-wireshark-src-improve-reproducibility.patch \
13           file://0002-flex-Remove-line-directives.patch \
14           file://0004-lemon-Remove-line-directives.patch \
15           file://0001-UseLemon.cmake-do-not-use-lemon-data-from-the-host.patch \
16           "
17
18UPSTREAM_CHECK_URI = "https://1.as.dl.wireshark.org/src"
19
20SRC_URI[sha256sum] = "55e793ab87a9a73aac44336235c92cb76c52180c469b362ed3a54f26fbb1261f"
21
22PE = "1"
23
24inherit cmake pkgconfig python3native python3targetconfig perlnative upstream-version-is-even mime mime-xdg
25
26PACKAGECONFIG ?= "libpcap gnutls libnl libcap sbc"
27
28PACKAGECONFIG:class-native = "libpcap gnutls ssl libssh"
29
30PACKAGECONFIG[libcap] = "-DENABLE_CAP=ON,-DENABLE_CAP=OFF -DENABLE_PCAP_NG_DEFAULT=ON, libcap"
31PACKAGECONFIG[libpcap] = "-DENABLE_PCAP=ON,-DENABLE_PCAP=OFF -DENABLE_PCAP_NG_DEFAULT=ON , libpcap"
32PACKAGECONFIG[libsmi] = "-DENABLE_SMI=ON,-DENABLE_SMI=OFF,libsmi"
33PACKAGECONFIG[libnl] = ",,libnl"
34PACKAGECONFIG[portaudio] = "-DENABLE_PORTAUDIO=ON,-DENABLE_PORTAUDIO=OFF, portaudio-v19"
35PACKAGECONFIG[gnutls] = "-DENABLE_GNUTLS=ON,-DENABLE_GNUTLS=OFF, gnutls"
36PACKAGECONFIG[ssl] = ",,openssl"
37PACKAGECONFIG[krb5] = "-DENABLE_KRB5=ON,-DENABLE_KRB5=OFF, krb5"
38PACKAGECONFIG[lua] = "-DENABLE_LUA=ON,-DENABLE_LUA=OFF, lua"
39PACKAGECONFIG[zlib] = "-DENABLE_ZLIB=ON,-DENABLE_ZLIB=OFF, zlib"
40PACKAGECONFIG[geoip] = ",, geoip"
41PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
42PACKAGECONFIG[sbc] = "-DENABLE_SBC=ON,-DENABLE_SBC=OFF, sbc"
43PACKAGECONFIG[libssh] = "-DENABLE_LIBSSH=ON,-DENABLE_LIBSSH=OFF, libssh2"
44PACKAGECONFIG[lz4] = "-DENABLE_LZ4=ON,-DENABLE_LZ4=OFF, lz4"
45PACKAGECONFIG[zstd] = "-DENABLE_STTD=ON,-DENABLE_ZSTD=OFF, zstd"
46PACKAGECONFIG[nghttp2] = "-DENABLE_NGHTTP2=ON,-DENABLE_NGHTTP2=OFF, nghttp2"
47
48# these next two options require addional layers
49PACKAGECONFIG[qt5] = "-DENABLE_QT5=ON -DBUILD_wireshark=ON, -DENABLE_QT5=OFF -DBUILD_wireshark=OFF, qttools-native qtmultimedia qtsvg"
50
51inherit ${@bb.utils.contains('PACKAGECONFIG', 'qt5', 'cmake_qt5', '', d)}
52
53EXTRA_OECMAKE += "-DENABLE_NETLINK=ON \
54                  -DBUILD_mmdbresolve=OFF \
55                  -DBUILD_randpktdump=OFF \
56                  -DBUILD_androiddump=OFF \
57                  -DBUILD_dcerpcidl2wrs=OFF \
58                  -DM_INCLUDE_DIR=${includedir} \
59                  -DM_LIBRARY=${libdir} \
60                 "
61CFLAGS:append = " -lm"
62
63do_compile:append:class-target() {
64    # Fix TMPDIR, these are in the comments section
65    sed -i -e "s:** source file.*::g"  ${B}/wiretap/ascend_parser.c
66    sed -i -e "s:** source file.*::g"  ${B}/wiretap/candump_parser.c
67    sed -i -e "s:** source file.*::g"  ${B}/wiretap/busmaster_parser.c
68    sed -i -e "s:** source file.*::g"  ${B}/epan/protobuf_lang_parser.c
69    sed -i -e "s:** source file.*::g"  ${B}/epan/dtd_grammar.c
70    sed -i -e "s:** source file.*::g"  ${B}/epan/dfilter/grammar.c
71}
72
73do_install:append:class-native() {
74	install -d ${D}${bindir}
75	for f in lemon
76	do
77		install -m 0755 ${B}/run/$f ${D}${bindir}
78	done
79}
80
81do_install:append:class-target() {
82	for f in `find ${D}${libdir} ${D}${bindir} -type f -executable`
83	do
84		chrpath --delete $f
85	done
86
87    # We don't need the cmake files installed
88    rm -fr ${D}${usrlib}/${BPN}/cmake
89}
90
91PACKAGE_BEFORE_PN += "tshark"
92
93FILES:tshark = "${bindir}/tshark ${mandir}/man1/tshark.*"
94
95FILES:${PN} += "${datadir}*"
96
97RDEPENDS:tshark = "wireshark"
98
99BBCLASSEXTEND = "native"
100