diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/dpdk | |
Diffstat (limited to 'vcpkg/ports/dpdk')
| -rw-r--r-- | vcpkg/ports/dpdk/0001-enable-either-static-or-shared-build.patch | 83 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/0002-fix-dependencies.patch | 42 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/0003-remove-examples-src-from-datadir.patch | 18 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/0004-stop-building-apps.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/0005-no-absolute-driver-path.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/portfile.cmake | 94 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/usage | 6 | ||||
| -rw-r--r-- | vcpkg/ports/dpdk/vcpkg.json | 42 |
8 files changed, 311 insertions, 0 deletions
diff --git a/vcpkg/ports/dpdk/0001-enable-either-static-or-shared-build.patch b/vcpkg/ports/dpdk/0001-enable-either-static-or-shared-build.patch new file mode 100644 index 0000000..902f230 --- /dev/null +++ b/vcpkg/ports/dpdk/0001-enable-either-static-or-shared-build.patch @@ -0,0 +1,83 @@ +diff --git a/config/meson.build b/config/meson.build +index b6b3558e11..34b85f10b5 100644 +--- a/config/meson.build ++++ b/config/meson.build +@@ -94,7 +94,9 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) + # driver .so files often depend upon the bus drivers for their connect bus, + # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need + # to be in the library path, so symlink the drivers from the main lib directory. +-if not is_windows ++if get_option('default_library') == 'static' ++ # skip ++elif not is_windows + # skip symlink-drivers-solibs.sh execution on no sub directory + if pmd_subdir_opt != '' and pmd_subdir_opt != '.' + meson.add_install_script('../buildtools/symlink-drivers-solibs.sh', +diff --git a/drivers/meson.build b/drivers/meson.build +index 495e21b54a..ff7b5983cb 100644 +--- a/drivers/meson.build ++++ b/drivers/meson.build +@@ -252,7 +252,7 @@ foreach subpath:subdirs + include_directories: includes, + dependencies: static_deps, + c_args: cflags, +- install: true) ++ install: get_option('default_library') == 'static') + + # now build the shared driver + version_map = '@0@/@1@/version.map'.format(meson.current_source_dir(), drv_path) +@@ -297,7 +297,7 @@ foreach subpath:subdirs + else + lk_args = ['-Wl,--version-script=' + version_map] + endif +- ++ if get_option('default_library') == 'shared' + shared_lib = shared_library(lib_name, sources, + objects: objs, + include_directories: includes, +@@ -315,10 +315,14 @@ foreach subpath:subdirs + shared_dep = declare_dependency(link_with: shared_lib, + include_directories: includes, + dependencies: shared_deps) ++ endif + static_dep = declare_dependency( + include_directories: includes, + dependencies: static_deps) + ++ if get_option('default_library') == 'static' ++ shared_dep = static_dep ++ endif + dpdk_drivers += static_lib + + set_variable('shared_@0@'.format(lib_name), shared_dep) +diff --git a/lib/meson.build b/lib/meson.build +index ce92cb5537..40880bbf02 100644 +--- a/lib/meson.build ++++ b/lib/meson.build +@@ -249,7 +249,7 @@ foreach l:libraries + c_args: cflags, + dependencies: static_deps, + include_directories: includes, +- install: true) ++ install: get_option('default_library') == 'static') + static_dep = declare_dependency( + include_directories: includes, + dependencies: static_deps) +@@ -305,6 +305,7 @@ foreach l:libraries + output: name + '.sym_chk') + endif + ++ if get_option('default_library') == 'shared' + shared_lib = shared_library(libname, + sources, + objects: objs, +@@ -321,6 +322,9 @@ foreach l:libraries + dependencies: shared_deps) + + dpdk_libraries = [shared_lib] + dpdk_libraries ++ else ++ shared_dep = static_dep ++ endif + dpdk_static_libraries = [static_lib] + dpdk_static_libraries + + set_variable('shared_rte_' + name, shared_dep) diff --git a/vcpkg/ports/dpdk/0002-fix-dependencies.patch b/vcpkg/ports/dpdk/0002-fix-dependencies.patch new file mode 100644 index 0000000..b3f78a5 --- /dev/null +++ b/vcpkg/ports/dpdk/0002-fix-dependencies.patch @@ -0,0 +1,42 @@ +diff --git a/config/meson.build b/config/meson.build +index 34b85f10b5..5ed4625d9e 100644 +--- a/config/meson.build ++++ b/config/meson.build +@@ -236,12 +236,10 @@ if meson.is_cross_build() and not meson.get_external_property('numa', true) + find_libnuma = false + endif + if find_libnuma +- numa_dep = cc.find_library('numa', required: false) +- if numa_dep.found() and cc.has_header('numaif.h') ++ numa_dep = dependency('numa', method: 'pkg-config') ++ if numa_dep.found() + dpdk_conf.set10('RTE_HAS_LIBNUMA', true) + has_libnuma = true +- add_project_link_arguments('-lnuma', language: 'c') +- dpdk_extra_ldflags += '-lnuma' + endif + endif + +diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build +index e99ebed256..672c70547b 100644 +--- a/lib/eal/linux/meson.build ++++ b/lib/eal/linux/meson.build +@@ -21,5 +21,6 @@ sources += files( + + deps += ['kvargs', 'telemetry'] + if has_libnuma ++ ext_deps += numa_dep + dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true) + endif +diff --git a/lib/vhost/meson.build b/lib/vhost/meson.build +index 51bcf17244..1099a0232f 100644 +--- a/lib/vhost/meson.build ++++ b/lib/vhost/meson.build +@@ -6,6 +6,7 @@ if not is_linux + reason = 'only supported on Linux' + endif + if has_libnuma ++ ext_deps += numa_dep + dpdk_conf.set10('RTE_LIBRTE_VHOST_NUMA', true) + endif + if (toolchain == 'gcc' and cc.version().version_compare('>=8.3.0')) diff --git a/vcpkg/ports/dpdk/0003-remove-examples-src-from-datadir.patch b/vcpkg/ports/dpdk/0003-remove-examples-src-from-datadir.patch new file mode 100644 index 0000000..12e22f7 --- /dev/null +++ b/vcpkg/ports/dpdk/0003-remove-examples-src-from-datadir.patch @@ -0,0 +1,18 @@ +diff --git a/meson.build b/meson.build +index 8436d1dff8..5e704e37d5 100644 +--- a/meson.build ++++ b/meson.build +@@ -89,13 +89,6 @@ subdir('app') + # build docs + subdir('doc') + +-# build any examples explicitly requested - useful for developers - and +-# install any example code into the appropriate install path +-subdir('examples') +-install_subdir('examples', +- install_dir: get_option('datadir') + '/dpdk', +- exclude_files: ex_file_excludes) +- + # build kernel modules + subdir('kernel') + diff --git a/vcpkg/ports/dpdk/0004-stop-building-apps.patch b/vcpkg/ports/dpdk/0004-stop-building-apps.patch new file mode 100644 index 0000000..ae149ca --- /dev/null +++ b/vcpkg/ports/dpdk/0004-stop-building-apps.patch @@ -0,0 +1,13 @@ +diff --git a/app/meson.build b/app/meson.build +index e2db888ae1..5e28824780 100644 +--- a/app/meson.build ++++ b/app/meson.build +@@ -52,7 +52,7 @@ endif + + foreach app:apps + name = app +- build = true ++ build = false + reason = '<unknown reason>' # set if build == false to explain + sources = [] + resources = [] diff --git a/vcpkg/ports/dpdk/0005-no-absolute-driver-path.patch b/vcpkg/ports/dpdk/0005-no-absolute-driver-path.patch new file mode 100644 index 0000000..25db196 --- /dev/null +++ b/vcpkg/ports/dpdk/0005-no-absolute-driver-path.patch @@ -0,0 +1,13 @@ +diff --git a/config/meson.build b/config/meson.build +index 5ed4625d9e..3f89fd0768 100644 +--- a/config/meson.build ++++ b/config/meson.build +@@ -445,7 +445,7 @@ Please install libnuma, or set 'max_numa_nodes' option to '1' to build without N + endif + + # set the install path for the drivers +-dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) ++dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', '') + + install_headers(['rte_config.h'], + subdir: get_option('include_subdir_arch')) diff --git a/vcpkg/ports/dpdk/portfile.cmake b/vcpkg/ports/dpdk/portfile.cmake new file mode 100644 index 0000000..3731661 --- /dev/null +++ b/vcpkg/ports/dpdk/portfile.cmake @@ -0,0 +1,94 @@ +if(VCPKG_TARGET_IS_LINUX) + execute_process( + COMMAND uname --kernel-release + OUTPUT_VARIABLE KERNEL_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(KERNEL_VERSION VERSION_LESS 4.4) + message( + WARNING + " Kernel version requires >= 4.4 on Linux (current version: ${KERNEL_VERSION})\n" + " Building may fail or have functional defects. See\n" + " https://doc.dpdk.org/guides/linux_gsg/sys_reqs.html#system-software" + ) + endif() + + execute_process( + COMMAND sh -c "ldd --version | head -n1 | rev | cut -d' ' -f 1 | rev" + OUTPUT_VARIABLE GLIBC_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(GLIBC_VERSION VERSION_LESS 2.7) + message( + FATAL_ERROR + "glibc version requires >= 2.7 (for features related to cpuset)") + endif() +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO DPDK/dpdk + REF "v${VERSION}" + SHA512 0d0ee4eb70e8021882a1d6548cf757972388c0a561ee71bb0e4b330be61f1463f4eaec55202d7a35eef8b392ecf0b3888713692ba8cd88f850e7b9072504733e + HEAD_REF main + PATCHES + 0001-enable-either-static-or-shared-build.patch + 0002-fix-dependencies.patch + 0003-remove-examples-src-from-datadir.patch + 0004-stop-building-apps.patch + 0005-no-absolute-driver-path.patch +) + +macro(append_bool_option feature_name option_name) + if("${feature_name}" IN_LIST FEATURES) + list(APPEND DPDK_OPTIONS -D${option_name}=true) + else() + list(APPEND DPDK_OPTIONS -D${option_name}=false) + endif() +endmacro() + +set(DPDK_OPTIONS "") +append_bool_option("docs" "enable_docs") +append_bool_option("kmods" "enable_kmods") +append_bool_option("tests" "tests") +append_bool_option("trace" "enable_trace_fp") +string(REPLACE "-Denable_docs=true" "-Denable_docs=false" DPDK_OPTIONS_DEBUG "${DPDK_OPTIONS}") + +list(APPEND PYTHON_PACKAGES pyelftools) +if("docs" IN_LIST FEATURES) + list(APPEND PYTHON_PACKAGES packaging sphinx) +endif() +x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES ${PYTHON_PACKAGES}) + +vcpkg_configure_meson(SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -Ddisable_drivers=regex/cn9k + -Dexamples= + OPTIONS_RELEASE + ${DPDK_OPTIONS} + OPTIONS_DEBUG + ${DPDK_OPTIONS_DEBUG} +) +vcpkg_install_meson() + +set(tools + dpdk-cmdline-gen.py + dpdk-devbind.py + dpdk-pmdinfo.py + dpdk-telemetry.py + dpdk-hugepages.py + dpdk-rss-flows.py + dpdk-telemetry-exporter.py +) +vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN) + +vcpkg_fixup_pkgconfig() + +if("docs" IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/dpdk") + file(RENAME "${CURRENT_PACKAGES_DIR}/share/doc/dpdk" "${CURRENT_PACKAGES_DIR}/share/dpdk/doc") +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/share/doc") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license/README") diff --git a/vcpkg/ports/dpdk/usage b/vcpkg/ports/dpdk/usage new file mode 100644 index 0000000..5e058c3 --- /dev/null +++ b/vcpkg/ports/dpdk/usage @@ -0,0 +1,6 @@ +The package dpdk can be imported via CMake FindPkgConfig module: + + find_package(PkgConfig) + pkg_check_modules(DPDK REQUIRED IMPORTED_TARGET libdpdk) + + target_link_libraries(main PRIVATE PkgConfig::DPDK) diff --git a/vcpkg/ports/dpdk/vcpkg.json b/vcpkg/ports/dpdk/vcpkg.json new file mode 100644 index 0000000..194a1f9 --- /dev/null +++ b/vcpkg/ports/dpdk/vcpkg.json @@ -0,0 +1,42 @@ +{ + "name": "dpdk", + "version-string": "24.11.3", + "description": "A set of libraries and drivers for fast packet processing", + "homepage": "https://www.dpdk.org/", + "documentation": "https://doc.dpdk.org/guides/index.html", + "license": "BSD-3-Clause", + "supports": "linux | freebsd", + "dependencies": [ + { + "name": "libarchive", + "default-features": false + }, + { + "name": "numactl", + "platform": "linux" + }, + "python3", + { + "name": "vcpkg-get-python-packages", + "host": true + }, + { + "name": "vcpkg-tool-meson", + "host": true + } + ], + "features": { + "docs": { + "description": "Build and install docs" + }, + "kmods": { + "description": "Build and install kernel modules" + }, + "tests": { + "description": "Build and install tests" + }, + "trace": { + "description": "Build with fast path traces enabled" + } + } +} |