net/vde2: add vde2-devel subport

Add a vde2-devel subport for a recent upstream GitHub commit using
the CMake build system. Keep vde2 on the latest tagged release and fix
that release build by forcing C17, since the old sources do not build
as C23.

Patch the devel CMake build on Darwin to avoid malformed linker flags
for libvdehist.
This commit is contained in:
Perry E. Metzger
2026-05-19 18:21:54 -04:00
parent 1ba57cec77
commit bf9686ff76
2 changed files with 62 additions and 6 deletions
+48 -6
View File
@@ -21,20 +21,50 @@ checksums rmd160 257d008bd8ce5a56f1ab7086a7f69a01f639294c \
sha256 a7d2cc4c3d0c0ffe6aff7eb0029212f2b098313029126dcd12dc542723972379 \
size 234790
use_autoreconf yes
conflicts ${name}-devel
subport ${name}-devel {
PortGroup cmake 1.1
github.setup virtualsquare vde-2 6ad51c2fd557734011c140afc7b502d84cc5d3b0
version 20260323-[string range ${github.version} 0 7]
revision 0
conflicts ${name}
checksums rmd160 8a7d2823083e70408c9297b6870d3fde86c29585 \
sha256 81784c5618e9c7ec1e129a3b28d7a94d109671bbf85177aac4ce94d22594dd21 \
size 233059
# Fix malformed Darwin linker flags in upstream's CMake build.
patchfiles patch-src-lib-CMakeLists.txt.diff
}
default_variants +pcap
configure.args --disable-experimental \
if {${subport} eq "${name}-devel"} {
configure.args-append \
-DENABLE_EXPERIMENTAL=OFF \
-DENABLE_TUNTAP=OFF \
-DENABLE_PCAP=OFF \
-DENABLE_CRYPTCAB=OFF
} else {
use_autoreconf yes
# The release uses old-style empty function prototypes that fail as C23.
configure.cflags-append \
-std=gnu17
configure.args --disable-experimental \
--disable-tuntap \
--disable-pcap \
--disable-cryptcab
}
# See https://github.com/virtualsquare/vde-2/issues/6
use_parallel_build no
post-destroot {
set docdir ${destroot}${prefix}/share/doc/${name}
set docdir ${destroot}${prefix}/share/doc/${subport}
xinstall -d ${docdir}
xinstall -m 644 -W ${worksrcpath} \
COPYING \
@@ -55,14 +85,26 @@ post-destroot {
variant tuntap description {Enable support for TAP devices} {
depends_lib-append port:tuntaposx
configure.args-replace --disable-tuntap --enable-tuntap
if {${subport} eq "${name}-devel"} {
configure.args-replace -DENABLE_TUNTAP=OFF -DENABLE_TUNTAP=ON
} else {
configure.args-replace --disable-tuntap --enable-tuntap
}
}
variant pcap description {Enable support for packet capturing} {
depends_lib-append port:libpcap
configure.args-replace --disable-pcap --enable-pcap
if {${subport} eq "${name}-devel"} {
configure.args-replace -DENABLE_PCAP=OFF -DENABLE_PCAP=ON
} else {
configure.args-replace --disable-pcap --enable-pcap
}
}
variant experimental description {Enable support for experimental features} {
configure.args-replace --disable-experimental --enable-experimental
if {${subport} eq "${name}-devel"} {
configure.args-replace -DENABLE_EXPERIMENTAL=OFF -DENABLE_EXPERIMENTAL=ON
} else {
configure.args-replace --disable-experimental --enable-experimental
}
}
@@ -0,0 +1,14 @@
--- src/lib/CMakeLists.txt.orig
+++ src/lib/CMakeLists.txt
@@ -21,10 +21,9 @@ install(TARGETS vdesnmp
add_library(vdehist SHARED libvdehist.c)
target_link_libraries(vdehist PRIVATE vdecommon)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
- target_compile_options(vdehist PRIVATE -Wall -O2 -g -O2 -fno-common -DPIC)
- target_link_options(vdehist PRIVATE -Wl,-undefined -Wl,dynamic_lookup -Wl,-no_fixup_chains -Wl,-force_load -O2 -g -O2)
+ target_link_options(vdehist PRIVATE -Wl,-undefined,dynamic_lookup)
endif()
set_target_properties(vdehist PROPERTIES VERSION 0.0.1 SOVERSION 0)
configure_file(vdehist.pc.in ${CMAKE_CURRENT_BINARY_DIR}/vdehist.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vdehist.pc