Hi,
I’m trying to create an OpenWrt package for Wireshark.
I think I’m pretty close. However, I got stuck at lemon, which if I’m not wrong, should be compiled by my build machine’s compiler. From the source code, I found out it supports the LEMON_C_COMPILER variable, which I assigned with the build machine’s compiler, but after compiling, CMAKE used the target platform’s linking flags for linking, which apparently failed. I’m not very familiar with CMAKE, so would appreciate some help.
Cross-compiling has cropped up here a few times in the past decades, but the ones I managed to find are all pertaining to Wireshark’s autotools era, so they’re not particularly helpful, at least for my limited knowledge in this area.
Here is the OpenWrt package’s Makefile I have come up with so far:
include $(TOPDIR)/rules.mk
PKG_NAME:=wireshark
PKG_VERSION:=3.6.1
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://www.wireshark.org/download/src/
PKG_SOURCE:=wireshark-$(PKG_VERSION).tar.xz
PKG_HASH:=0434eda8fb6bf88e2b42a67eb5d1de254a67d505bec3bb51fee9d7cad7925a38
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/wireshark
SECTION:=net
CATEGORY:=Network
TITLE:=Network protocol analyzer
URL:=https://www.wireshark.org/
DEPENDS:=+libpcap +glib2 +libgcrypt +libcares
endef
define Package/wireshark/description
Network protocol analyzer
endef
CMAKE_OPTIONS += \
-DCMAKE_CROSSCOMPILING=1 \
-DHAVE_C99_VSNPRINTF=TRUE \
-DLEMON_C_COMPILER=$(CMAKE_HOST_C_COMPILER) \
-DBUILD_wireshark=OFF \
-DBUILD_androiddump=OFF \
-DBUILD_ciscodump=OFF \
-DBUILD_idl2wrs=OFF
define Package/wireshark/install
# figure out later
endef
$(eval $(call BuildPackage,wireshark))