From 7bb7ed201f33e94137d7e032f4627158141411a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Tue, 4 Oct 2022 17:24:30 +0200 Subject: [PATCH] net-analyzer/sslsplit: use pkgconfig to detect libnet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SSLsplit uses custom localization of libnet library which does not work correctly in multilib environment. This commit fixes the issue by restoring pkgconfig detection from upstream commit 46a55de8040a ("Refactor location of packages, improve libnet detection"). Similar patch is also needed for tests, where libcrypto is also searched with pkgconfig. Closes: https://bugs.gentoo.org/731190 Closes: https://bugs.gentoo.org/874075 Signed-off-by: Petr Vaněk Closes: https://github.com/gentoo/gentoo/pull/27631 Signed-off-by: Sam James --- .../sslsplit-0.5.5-libcrypto-pkgconfig.patch | 23 +++++++++++ .../sslsplit-0.5.5-libnet-pkgconfig.patch | 40 +++++++++++++++++++ net-analyzer/sslsplit/sslsplit-0.5.5.ebuild | 6 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 net-analyzer/sslsplit/files/sslsplit-0.5.5-libcrypto-pkgconfig.patch create mode 100644 net-analyzer/sslsplit/files/sslsplit-0.5.5-libnet-pkgconfig.patch diff --git a/net-analyzer/sslsplit/files/sslsplit-0.5.5-libcrypto-pkgconfig.patch b/net-analyzer/sslsplit/files/sslsplit-0.5.5-libcrypto-pkgconfig.patch new file mode 100644 index 0000000000000..dd6ae812efb6f --- /dev/null +++ b/net-analyzer/sslsplit/files/sslsplit-0.5.5-libcrypto-pkgconfig.patch @@ -0,0 +1,23 @@ +Use pkgconfig for localization of libcrypto. This is needed for tests in +multilib systems. + +diff --git a/extra/engine/GNUmakefile b/extra/engine/GNUmakefile +index b50717b..3712ad6 100644 +--- a/extra/engine/GNUmakefile ++++ b/extra/engine/GNUmakefile +@@ -16,9 +16,9 @@ else + SUFFIX:= so + endif + +-CFLAGS+= -fPIC -I$(OPENSSL_BASE)/include +-LDFLAGS+= -L$(OPENSSL_BASE)/lib +-LIBS+= -lcrypto ++CFLAGS+= -fPIC $(shell pkg-config --cflags libcrypto) ++LDFLAGS+= $(shell pkg-config --libs-only-L libcrypto) ++LIBS+= $(shell pkg-config --libs-only-l libcrypto) + + TARGET= dummy-engine + +-- +2.35.1 + diff --git a/net-analyzer/sslsplit/files/sslsplit-0.5.5-libnet-pkgconfig.patch b/net-analyzer/sslsplit/files/sslsplit-0.5.5-libnet-pkgconfig.patch new file mode 100644 index 0000000000000..5eebf8d4deafe --- /dev/null +++ b/net-analyzer/sslsplit/files/sslsplit-0.5.5-libnet-pkgconfig.patch @@ -0,0 +1,40 @@ +Subject: [PATCH] locate libnet with pkgconfig + +This is partially reverted from upstream commit 46a55de8040a ("Refactor +location of packages, improve libnet detection") + +diff --git a/GNUmakefile b/GNUmakefile +index cc7197e..2343272 100644 +--- a/GNUmakefile ++++ b/GNUmakefile +@@ -277,6 +277,10 @@ PKGS+= $(shell $(PKGCONFIG) $(PCFLAGS) --exists libevent_openssl \ + PKGS+= $(shell $(PKGCONFIG) $(PCFLAGS) --exists libevent_pthreads \ + && echo libevent_pthreads) + endif ++ifndef LIBNET_BASE ++PKGS+= $(shell $(PKGCONFIG) $(PCFLAGS) --exists libnet \ ++ && echo libnet) ++endif + ifneq ($(filter -DWITHOUT_MIRROR,$(FEATURES)),-DWITHOUT_MIRROR) + ifndef LIBPCAP_BASE + PKGS+= $(shell $(PKGCONFIG) $(PCFLAGS) --exists libpcap \ +@@ -333,7 +337,7 @@ CHECK_MISSING:= 1 + endif + endif + +-# Always search filesystem for libnet because libnet-config is unreliable ++ifeq (,$(filter libnet,$(PKGS))) + ifneq ($(filter -DWITHOUT_MIRROR,$(FEATURES)),-DWITHOUT_MIRROR) + LIBNET_FOUND:= $(call locate,libnet,include/libnet-1.1/libnet.h,$(LIBNET_BASE)) + ifdef LIBNET_FOUND +@@ -347,6 +351,7 @@ $(error dependency 'libnet' not found; \ + install it or point LIBNET_BASE to base path) + endif + endif ++endif + + ifdef OPENSSL_FOUND + PKG_CPPFLAGS+= -I$(OPENSSL_FOUND)/include +-- +2.35.1 + diff --git a/net-analyzer/sslsplit/sslsplit-0.5.5.ebuild b/net-analyzer/sslsplit/sslsplit-0.5.5.ebuild index c3100f34cf6c3..9295120f10b32 100644 --- a/net-analyzer/sslsplit/sslsplit-0.5.5.ebuild +++ b/net-analyzer/sslsplit/sslsplit-0.5.5.ebuild @@ -35,7 +35,11 @@ DEPEND="${RDEPEND} test? ( dev-libs/check )" BDEPEND="virtual/pkgconfig" -PATCHES=( "${FILESDIR}/${P}-openssl3.patch" ) +PATCHES=( + "${FILESDIR}/${P}-openssl3.patch" + "${FILESDIR}/${P}-libnet-pkgconfig.patch" + "${FILESDIR}/${P}-libcrypto-pkgconfig.patch" +) src_prepare() { default