commit:     d156b7d32c7ba53453c2610039a17c68ad21a02f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  6 06:02:33 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan  6 06:04:46 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d156b7d3

net-vpn/openvpn: add 2.6.17

To handle the LTO test failure (analysed in detail in bug #877741 and
the linked binutils bug), build one test with -fno-lto to avoid -Wl,--wrap
interacting badly with LTO.

This needs lto-guarantee-fat so -ffat-lto-objects is used when building
with LTO. This is done unconditionally (not based on whether we're going
to build tests) so we have an identical build with and without tests.

Bug: https://bugs.gentoo.org/968432
Closes: https://bugs.gentoo.org/877741
Closes: https://bugs.gentoo.org/968408
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-vpn/openvpn/Manifest                                |  1 +
 net-vpn/openvpn/files/openvpn-2.6.17-tests-no-lto.patch | 17 +++++++++++++++++
 .../{openvpn-9999.ebuild => openvpn-2.6.17.ebuild}      | 12 ++++++++++--
 net-vpn/openvpn/openvpn-9999.ebuild                     | 12 ++++++++++--
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/net-vpn/openvpn/Manifest b/net-vpn/openvpn/Manifest
index c468836317b4..ab7d38b99579 100644
--- a/net-vpn/openvpn/Manifest
+++ b/net-vpn/openvpn/Manifest
@@ -1,2 +1,3 @@
 DIST openvpn-2.6.12.tar.gz 1912400 BLAKE2B 
5e40c61cb4aea3db27eff8ae7f49dafaa6e47c8a19fee5fa8802956fc976be490e9b558397741bc2e4447129f174176f9fbbfce16478d96b27a39ecb08a9da86
 SHA512 
92f548186d9375d6ae47b1387dd191241b8a45aed82294523b3771bdd5e699b94265e1a3bbf3ef2638da0d54c19c783f54c456cbd755c846849bf67913cad6db
 DIST openvpn-2.6.14.tar.gz 1926343 BLAKE2B 
15376d0a1600abfbf8541614282c622bbc09bf4402730a20eb6606bf1debdda0836e069fd45068bda1d71deb72df052c68425771693592d3c72d680a16c87d6d
 SHA512 
c94b45ef5b455a15d7841e6bf5e5f441906d641f699ac84c5987b2fc9f1159f38fc5a5af4b22c0f531ce424b18301cfdf08bb496afd1bdbca78e37238bd28fbc
+DIST openvpn-2.6.17.tar.gz 1934219 BLAKE2B 
a5cff9bf4de85b647bd0cef808586b2cd29694ad0134ae6e4b3f74251c2ce0908cf86cbc041768f7fbc495e3ad5c5dbb9c491fe351b99da330dd2390142b353e
 SHA512 
c76e9dd6305b04143e382870a110b5781e8ef934e10d01c13a3b49eecacbe37fd19ca178056fd50848c2c6b07dd8ec27123bb8b3d1c0bab8e1dc85b563a579e0

diff --git a/net-vpn/openvpn/files/openvpn-2.6.17-tests-no-lto.patch 
b/net-vpn/openvpn/files/openvpn-2.6.17-tests-no-lto.patch
new file mode 100644
index 000000000000..8f10d3bc37a1
--- /dev/null
+++ b/net-vpn/openvpn/files/openvpn-2.6.17-tests-no-lto.patch
@@ -0,0 +1,17 @@
+Avoid building one test with LTO because it doesn't play well with -Wl,--wrap. 
To
+do this, we also have to build with -ffat-lto-objects in the ebuild.
+
+See https://bugs.gentoo.org/877741#c9 specifically.
+--- a/tests/unit_tests/openvpn/Makefile.am
++++ b/tests/unit_tests/openvpn/Makefile.am
+@@ -97,8 +97,9 @@ pkt_testdriver_SOURCES = test_pkt.c mock_msg.c mock_msg.h 
mock_win32_execve.c \
+ 
+ if !WIN32
+ tls_crypt_testdriver_CFLAGS  = @TEST_CFLAGS@ \
+-      -I$(top_srcdir)/include -I$(top_srcdir)/src/compat 
-I$(top_srcdir)/src/openvpn
++      -I$(top_srcdir)/include -I$(top_srcdir)/src/compat 
-I$(top_srcdir)/src/openvpn -fno-lto
+ tls_crypt_testdriver_LDFLAGS = @TEST_LDFLAGS@ \
++      -fno-lto \
+       -Wl,--wrap=buffer_read_from_file \
+       -Wl,--wrap=buffer_write_file \
+       -Wl,--wrap=parse_line \

diff --git a/net-vpn/openvpn/openvpn-9999.ebuild 
b/net-vpn/openvpn/openvpn-2.6.17.ebuild
similarity index 94%
copy from net-vpn/openvpn/openvpn-9999.ebuild
copy to net-vpn/openvpn/openvpn-2.6.17.ebuild
index 1ae2e1d0357d..2bd4fcbe294f 100644
--- a/net-vpn/openvpn/openvpn-9999.ebuild
+++ b/net-vpn/openvpn/openvpn-2.6.17.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit autotools systemd linux-info tmpfiles
+inherit autotools dot-a systemd linux-info tmpfiles
 
 DESCRIPTION="Robust and highly flexible tunneling application compatible with 
many OSes"
 HOMEPAGE="https://openvpn.net";
@@ -65,6 +65,10 @@ if [[ ${PV} = "9999" ]]; then
        BDEPEND+=" dev-python/docutils"
 fi
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.6.17-tests-no-lto.patch
+)
+
 pkg_setup() {
        local CONFIG_CHECK="~TUN"
        linux-info_pkg_setup
@@ -79,6 +83,10 @@ src_prepare() {
 src_configure() {
        local -a myeconfargs
 
+       # See tests-no-lto.patch (done unconditionally to not have the build
+       # vary with and without tests)
+       lto-guarantee-fat
+
        if ! use mbedtls; then
                myeconfargs+=(
                        $(use_enable pkcs11)

diff --git a/net-vpn/openvpn/openvpn-9999.ebuild 
b/net-vpn/openvpn/openvpn-9999.ebuild
index 1ae2e1d0357d..2bd4fcbe294f 100644
--- a/net-vpn/openvpn/openvpn-9999.ebuild
+++ b/net-vpn/openvpn/openvpn-9999.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-inherit autotools systemd linux-info tmpfiles
+inherit autotools dot-a systemd linux-info tmpfiles
 
 DESCRIPTION="Robust and highly flexible tunneling application compatible with 
many OSes"
 HOMEPAGE="https://openvpn.net";
@@ -65,6 +65,10 @@ if [[ ${PV} = "9999" ]]; then
        BDEPEND+=" dev-python/docutils"
 fi
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.6.17-tests-no-lto.patch
+)
+
 pkg_setup() {
        local CONFIG_CHECK="~TUN"
        linux-info_pkg_setup
@@ -79,6 +83,10 @@ src_prepare() {
 src_configure() {
        local -a myeconfargs
 
+       # See tests-no-lto.patch (done unconditionally to not have the build
+       # vary with and without tests)
+       lto-guarantee-fat
+
        if ! use mbedtls; then
                myeconfargs+=(
                        $(use_enable pkcs11)

Reply via email to