Skip to content

Commit 4826ede

Browse files
authored
[dpdk] Update to version v22.03 (#25374)
1 parent ad606d6 commit 4826ede

13 files changed

Lines changed: 360 additions & 179 deletions

ports/dpdk/CMakeLists.txt

Lines changed: 0 additions & 63 deletions
This file was deleted.

ports/dpdk/FindNuma.cmake

Lines changed: 0 additions & 26 deletions
This file was deleted.

ports/dpdk/dpdkConfig.cmake

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
diff --git a/drivers/meson.build b/drivers/meson.build
2+
index 1d8123b00c..2de654692d 100644
3+
--- a/drivers/meson.build
4+
+++ b/drivers/meson.build
5+
@@ -126,14 +126,15 @@ foreach subpath:subdirs
6+
if not build
7+
break
8+
endif
9+
- if not is_variable('shared_rte_' + d)
10+
+ if get_option('default_library') == 'static' and is_variable('static_rte_' + d)
11+
+ static_deps += [get_variable('static_rte_' + d)]
12+
+ elif get_option('default_library') == 'shared' and is_variable('shared_rte_' + d)
13+
+ shared_deps += [get_variable('shared_rte_' + d)]
14+
+ else
15+
build = false
16+
reason = 'missing internal dependency, "@0@"'.format(d)
17+
message('Disabling @1@ [@2@]: missing internal dependency "@0@"'
18+
.format(d, name, 'drivers/' + drv_path))
19+
- else
20+
- shared_deps += [get_variable('shared_rte_' + d)]
21+
- static_deps += [get_variable('static_rte_' + d)]
22+
endif
23+
endforeach
24+
endif
25+
@@ -158,6 +159,7 @@ foreach subpath:subdirs
26+
27+
install_headers(headers)
28+
29+
+ if get_option('default_library') == 'static'
30+
# generate pmdinfo sources by building a temporary
31+
# lib and then running pmdinfogen on the contents of
32+
# that lib. The final lib reuses the object files and
33+
@@ -220,6 +222,13 @@ foreach subpath:subdirs
34+
endif
35+
endif
36+
37+
+ static_dep = declare_dependency(
38+
+ include_directories: includes,
39+
+ dependencies: static_deps)
40+
+ dpdk_drivers += static_lib
41+
+ set_variable('static_@0@'.format(lib_name), static_dep)
42+
+
43+
+ else
44+
shared_lib = shared_library(lib_name, sources,
45+
objects: objs,
46+
include_directories: includes,
47+
@@ -237,14 +246,10 @@ foreach subpath:subdirs
48+
shared_dep = declare_dependency(link_with: shared_lib,
49+
include_directories: includes,
50+
dependencies: shared_deps)
51+
- static_dep = declare_dependency(
52+
- include_directories: includes,
53+
- dependencies: static_deps)
54+
+ set_variable('shared_@0@'.format(lib_name), shared_dep)
55+
56+
- dpdk_drivers += static_lib
57+
+ endif
58+
59+
- set_variable('shared_@0@'.format(lib_name), shared_dep)
60+
- set_variable('static_@0@'.format(lib_name), static_dep)
61+
dependency_name = ''.join(lib_name.split('rte_'))
62+
if developer_mode
63+
message('drivers/@0@: Defining dependency "@1@"'.format(
64+
diff --git a/drivers/net/octeontx/base/meson.build b/drivers/net/octeontx/base/meson.build
65+
index 8e5e8c1b55..39593cd8a6 100644
66+
--- a/drivers/net/octeontx/base/meson.build
67+
+++ b/drivers/net/octeontx/base/meson.build
68+
@@ -10,7 +10,7 @@ sources = [
69+
depends = ['ethdev', 'mempool_octeontx']
70+
static_objs = []
71+
foreach d: depends
72+
- if not is_variable('shared_rte_' + d)
73+
+ if get_option('default_library') == 'shared' and not is_variable('shared_rte_' + d)
74+
subdir_done()
75+
endif
76+
static_objs += get_variable('static_rte_' + d)
77+
diff --git a/lib/meson.build b/lib/meson.build
78+
index 24adbe44c9..e614ec57af 100644
79+
--- a/lib/meson.build
80+
+++ b/lib/meson.build
81+
@@ -146,14 +146,15 @@ foreach l:libraries
82+
if not build
83+
break
84+
endif
85+
- if not is_variable('shared_rte_' + d)
86+
+ if get_option('default_library') == 'static'
87+
+ static_deps += [get_variable('static_rte_' + d)]
88+
+ elif is_variable('shared_rte_' + d)
89+
+ shared_deps += [get_variable('shared_rte_' + d)]
90+
+ else
91+
build = false
92+
reason = 'missing internal dependency, "@0@"'.format(d)
93+
message('Disabling @1@ [@2@]: missing internal dependency "@0@"'
94+
.format(d, name, 'lib/' + l))
95+
- else
96+
- shared_deps += [get_variable('shared_rte_' + d)]
97+
- static_deps += [get_variable('static_rte_' + d)]
98+
endif
99+
endforeach
100+
101+
@@ -185,6 +186,7 @@ foreach l:libraries
102+
endif
103+
cflags += '-DRTE_LOG_DEFAULT_LOGTYPE=lib.' + l
104+
105+
+ if get_option('default_library') == 'static'
106+
# first build static lib
107+
static_lib = static_library(libname,
108+
sources,
109+
@@ -246,6 +248,10 @@ foreach l:libraries
110+
output: name + '.sym_chk')
111+
endif
112+
113+
+ dpdk_static_libraries = [static_lib] + dpdk_static_libraries
114+
+ set_variable('static_rte_' + name, static_dep)
115+
+
116+
+ else
117+
shared_lib = shared_library(libname,
118+
sources,
119+
objects: objs,
120+
@@ -262,10 +268,10 @@ foreach l:libraries
121+
dependencies: shared_deps)
122+
123+
dpdk_libraries = [shared_lib] + dpdk_libraries
124+
- dpdk_static_libraries = [static_lib] + dpdk_static_libraries
125+
-
126+
set_variable('shared_rte_' + name, shared_dep)
127+
- set_variable('static_rte_' + name, static_dep)
128+
+
129+
+ endif
130+
+
131+
if developer_mode
132+
message('lib/@0@: Defining dependency "@1@"'.format(l, name))
133+
endif

ports/dpdk/portfile.cmake

Lines changed: 86 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,86 @@
1-
IF (NOT VCPKG_CMAKE_SYSTEM_NAME OR NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
2-
MESSAGE(FATAL_ERROR "Intel dpdk currently only supports Linux/BSD platforms")
3-
ENDIF ()
4-
5-
VCPKG_FROM_GITHUB(
6-
OUT_SOURCE_PATH SOURCE_PATH
7-
REPO DPDK/dpdk
8-
REF v19.02
9-
SHA512 e0cc7081b163b4e264b65c1abb7e0f8aa29211539cecc5cf52986699b800eb4d4f2026377c3048c5c3bd2791e41f21645bb655797a3300740aa83633fb87626e
10-
HEAD_REF master
11-
)
12-
13-
FIND_PATH(NUMA_INCLUDE_DIR NAME numa.h
14-
PATHS ENV NUMA_ROOT
15-
HINTS $ENV{HOME}/local/include /opt/local/include /usr/local/include /usr/include
16-
)
17-
IF (NOT NUMA_INCLUDE_DIR)
18-
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
19-
ENDIF ()
20-
21-
VCPKG_CONFIGURE_CMAKE(
22-
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
23-
PREFER_NINJA
24-
OPTIONS
25-
-DSOURCE_PATH=${SOURCE_PATH}
26-
)
27-
28-
VCPKG_INSTALL_CMAKE()
29-
30-
# Headers are symbolic links here, gather all, resolve and copy real files
31-
FILE(GLOB_RECURSE HEADERS FOLLOW_SYMLINKS "${SOURCE_PATH}/build/include/*")
32-
SET(REAL_FILES "")
33-
FOREACH (HEADER ${HEADERS})
34-
GET_FILENAME_COMPONENT(REAL_FILE "${HEADER}" REALPATH)
35-
LIST(APPEND REAL_FILES "${REAL_FILE}")
36-
ENDFOREACH ()
37-
38-
FILE(INSTALL ${SOURCE_PATH}/Release/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
39-
FILE(INSTALL ${SOURCE_PATH}/Debug/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
40-
FILE(INSTALL ${REAL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
41-
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/dpdkConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
42-
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
43-
FILE(INSTALL ${SOURCE_PATH}/license/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
1+
if(VCPKG_TARGET_IS_LINUX)
2+
execute_process(
3+
COMMAND uname --kernel-release
4+
OUTPUT_VARIABLE KERNEL_VERSION
5+
OUTPUT_STRIP_TRAILING_WHITESPACE)
6+
if(KERNEL_VERSION VERSION_LESS 4.4)
7+
message(
8+
WARNING
9+
" Kernel version requires >= 4.4 on Linux (current version: ${KERNEL_VERSION})\n"
10+
" Building may fail or have functional defects. See\n"
11+
" https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#system-software"
12+
)
13+
endif()
14+
15+
execute_process(
16+
COMMAND sh -c "ldd --version | head -n1 | rev | cut -d' ' -f 1 | rev"
17+
OUTPUT_VARIABLE GLIBC_VERSION
18+
OUTPUT_STRIP_TRAILING_WHITESPACE)
19+
20+
if(GLIBC_VERSION VERSION_LESS 2.7)
21+
message(
22+
FATAL_ERROR
23+
"glibc version requires >= 2.7 (for features related to cpuset)")
24+
endif()
25+
endif()
26+
27+
set(PORT_VERSION 22.03)
28+
vcpkg_from_github(
29+
OUT_SOURCE_PATH SOURCE_PATH
30+
REPO DPDK/dpdk
31+
REF v${PORT_VERSION}
32+
SHA512 ff80a9f87e71cd743ea5e62f515849bc6746fe7496a0d4b63ecf2bfe0d88da74f0e6c0257c07838c1f9ff41abd81827932b97731fb0fce60d56a8bab7e32347c
33+
HEAD_REF main
34+
PATCHES
35+
enable-either-static-or-shared-build.patch
36+
remove-examples-src-from-datadir.patch
37+
stop-building-apps.patch)
38+
39+
macro(append_bool_option feature_name option_name)
40+
if("${feature_name}" IN_LIST FEATURES)
41+
list(APPEND DPDK_OPTIONS -D${option_name}=true)
42+
else()
43+
list(APPEND DPDK_OPTIONS -D${option_name}=false)
44+
endif()
45+
endmacro()
46+
47+
append_bool_option("docs" "enable_docs")
48+
append_bool_option("kmods" "enable_kmods")
49+
append_bool_option("tests" "tests")
50+
append_bool_option("trace" "enable_trace_fp")
51+
52+
list(APPEND PYTHON_PACKAGES pyelftools)
53+
if("docs" IN_LIST FEATURES)
54+
list(APPEND PYTHON_PACKAGES packaging sphinx)
55+
endif()
56+
x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES ${PYTHON_PACKAGES})
57+
58+
vcpkg_configure_meson(SOURCE_PATH ${SOURCE_PATH} OPTIONS
59+
-Ddisable_drivers=regex/cn9k -Dexamples= ${DPDK_OPTIONS})
60+
vcpkg_install_meson()
61+
62+
vcpkg_copy_tools(TOOL_NAMES dpdk-devbind.py dpdk-pmdinfo.py dpdk-telemetry.py
63+
dpdk-hugepages.py AUTO_CLEAN)
64+
65+
vcpkg_fixup_pkgconfig()
66+
67+
vcpkg_find_acquire_program(PKGCONFIG)
68+
configure_file(
69+
"${CMAKE_CURRENT_LIST_DIR}/unofficial-${PORT}-config.cmake.in"
70+
"${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config.cmake"
71+
@ONLY)
72+
73+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage"
74+
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
75+
76+
file(
77+
INSTALL "${SOURCE_PATH}/license/README"
78+
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
79+
RENAME copyright)
80+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
81+
82+
include(CMakePackageConfigHelpers)
83+
write_basic_package_version_file(
84+
"${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-${PORT}-config-version.cmake"
85+
VERSION ${PORT_VERSION}
86+
COMPATIBILITY AnyNewerVersion)

0 commit comments

Comments
 (0)