Skip to content

Commit

Permalink
Consolidate dpdk dependency with 11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Aug 27, 2024
1 parent e838a80 commit 825c0ad
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 122 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ jobs:
sudo apt-get install -y python3-pyelftools libaio-dev
python -m pip install pyelftools
conan export import/sisl
conan export 3rd_party/dpdk
conan export 3rd_party/fio
conan export 3rd_party/dpdk dpdk/nbi.21.05@
conan export 3rd_party/fio fio/nbi.3.28@
conan export 3rd_party/grpc_internal
conan export 3rd_party/spdk
conan export 3rd_party/spdk spdk/nbi/21.07.y@
cached_pkgs=$(ls -1d ~/.conan/data/*/*/*/*/package | sed 's,.*data/,,' | cut -d'/' -f1,2 | paste -sd',' - -)
echo "::info:: Pre-cached: ${cached_pkgs}"
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}
Expand Down
8 changes: 8 additions & 0 deletions 3rd_party/dpdk/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
"nbi.21.05":
url: "https://github.com/spdk/dpdk/archive/bad3c0e51d7a34e3188d75d94f15a36c8f5e8301.zip"
sha256: "a0db10b41ab8cbfbc19acca517ee6ebb574885b964a02e649b16d084747ce2a6"
patches:
"nbi.21.05":
- patch_file: "numa.patch"
patch_type: "conan"
81 changes: 41 additions & 40 deletions 3rd_party/dpdk/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,65 +1,66 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conan import ConanFile
from conan.tools.meson import Meson, MesonToolchain
from conan.tools.files import patch, get

from conans import ConanFile, tools, Meson
from conans.tools import os_info, SystemPackageTool
import glob, os
from os.path import join

required_conan_version = ">=1.60.0"

class LibDPDKConan(ConanFile):
name = "dpdk"
version = "21.05"
description = "Data Plane Development Kit"
url = "https://github.corp.ebay.com/conan/dpdk"
homepage = "https://github.com/dpdk/dpdk"
license = "BSD-3"
generators = "pkg_config"

exports = ["LICENSE.md", "numa.patch"]
source_subfolder = "source_subfolder"
settings = "os", "compiler", "build_type", "arch"
options = {
"shared": [True, False],
"fPIC": [True, False],
"numa": [True, False],
"native_build": [True, False],
"shared": ['True', 'False'],
"fPIC": ['True', 'False'],
"numa": ['True', 'False'],
"native_build": ['True', 'False'],
}
default_options = {
"shared": False,
"fPIC": True,
"numa": False,
"native_build": False,
}
default_options = (
"shared=False",
"fPIC=True",
"numa=False",
"native_build=False",
)
scm = {"type" : "git",
"subfolder" : source_subfolder,
"url" : "https://github.com/spdk/dpdk.git",
"revision" : "bad3c0e51d7a34e3188d75d94f15a36c8f5e8301"}

build_requires = (
"meson/0.59.0",
)
exports_sources = ("LICENSE.md", "numa.patch")
no_copy_source=True

def build_requirements(self):
self.tool_requires("meson/0.59.3")

def configure(self):
del self.settings.compiler.libcxx

def source(self):
tools.patch(strip=0, base_path=self.source_subfolder, patch_file="numa.patch")
get(self, **self.conan_data["sources"][self.version], strip_root=True)
patch_file = os.path.join(self.export_sources_folder, "numa.patch")
patch(self, patch_file=patch_file)

def build(self):
meson = Meson(self)
meson_options = {
'machine': 'default',
'use_numa': 'false',
}
def generate(self):
tc = MesonToolchain(self)
tc.project_options["machine"] = "generic"
tc.preprocessor_definitions["use_numa"] = "false"
if self.options.native_build:
meson_options['machine'] = 'native'
tc.project_options['machine'] = 'native'
if self.options.numa:
meson_options['use_numa'] = 'true'
meson.configure(build_folder="build", defs=meson_options, source_folder="{}/{}".format(self.source_folder, self.source_subfolder))
tc.preprocessor_definitions['use_numa'] = 'true'
tc.generate()

def build(self):
meson = Meson(self)
meson.configure()
meson.build()

def package(self):
meson = Meson(self)
meson.install(build_dir="build")
meson.install()

removed_libs = glob.glob("{}/lib/*.a".format(self.package_folder), recursive=True)
if not self.options.shared:
Expand All @@ -71,7 +72,7 @@ def package(self):

def package_info(self):
self.cpp_info.libs = [
"-Wl,--whole-archive -lrte_eal",
"rte_eal",
"rte_timer",
"rte_power",
"rte_mempool",
Expand All @@ -83,12 +84,12 @@ def package_info(self):
"rte_pci",
"rte_kvargs",
"rte_net",
"-lrte_cryptodev",
"-lrte_ethdev",
"-lrte_rcu -Wl,--no-whole-archive"
"rte_cryptodev",
"rte_ethdev",
"rte_rcu"
]
if self.options.numa:
self.cpp_info.libs.append("numa")
if self.settings.os == "Linux":
self.cpp_info.libs.extend(["pthread", "dl"])
self.cpp_info.system_libs.extend(["pthread", "dl"])
self.env_info.RTE_SDK = self.package_folder
4 changes: 4 additions & 0 deletions 3rd_party/fio/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"nbi.3.28":
url: "https://github.com/axboe/fio/archive/fio-3.28.tar.gz"
sha256: "135a3455ab6e9251430bb1b12e97151daf4ff5d2d22e8472562c9998a753a04f"
49 changes: 22 additions & 27 deletions 3rd_party/fio/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conan import ConanFile
from conan.tools.gnu import Autotools, AutotoolsToolchain
from conan.tools.files import get, copy
from os.path import join

from conans import ConanFile, AutoToolsBuildEnvironment
from conans import tools
import os
required_conan_version = ">=1.60.0"

class LibFIOConan(ConanFile):
name = "fio"
version = "3.28"
description = "Flexible IO Kit"
url = "https://github.corp.ebay.com/conan/fio"
homepage = "https://github.com/axboe/fio"
license = "GPL-2"
exports = ["arch.patch", "rm_raw.patch"]
settings = "os", "arch", "compiler"
options = {
"native_build": [True, False],
"native_build": ['True', 'False'],
}
default_options = (
"native_build=False",
)
source_subfolder = "source_subfolder"
default_options = {
"native_build": False,
}

def configure(self):
del self.settings.compiler.libcxx

def source(self):
tools.get("{0}/archive/fio-{1}.tar.gz".format(self.homepage, self.version))
os.rename("%s-%s-%s" % (self.name, self.name, self.version), self.source_subfolder)
# tools.patch(strip=0, base_path=self.source_subfolder, patch_file="arch.patch")
# tools.patch(strip=0, base_path=self.source_subfolder, patch_file="rm_raw.patch")
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def build(self):
autotools = AutoToolsBuildEnvironment(self)
cargs = []
def generate(self):
tc = AutotoolsToolchain(self)
tc.configure_args = []
if not self.options.native_build:
cargs.append("--disable-native")
env_vars = autotools.vars
with tools.environment_append(env_vars):
with tools.chdir(self.source_subfolder):
autotools.configure(args=cargs)
autotools.make()
tc.configure_args.append("--disable-native")
tc.generate()

def build(self):
autotools = Autotools(self)
autotools.configure()
autotools.make()

def package(self):
self.copy("fio", dst="bin", src="{}/".format(self.source_subfolder), keep_path=False)
self.copy("*.h", dst="include/fio", src="{}/".format(self.source_subfolder), keep_path=True)
copy(self, "fio", self.build_folder, join(self.package_folder, "bin"), keep_path=False)
copy(self, "*.h", self.source_folder, dst=join(self.package_folder, "include/fio"), keep_path=True)

def deploy(self):
self.copy("fio", dst="/usr/local/bin/", src="bin")
8 changes: 8 additions & 0 deletions 3rd_party/spdk/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
"nbi.21.07.y":
url: "https://github.com/SPDK/spdk/archive/96a91684d39bb0f18729f132a24b778876d3e8fc.tar.gz"
sha256: "07876855efed94cd62150366bf6d97d218bc1432be33c87991c28cb52761ec90"
patches:
"nbi.21.07.y":
- patch_file: "patches/patch.diff"
patch_type: "conan"
Loading

0 comments on commit 825c0ad

Please sign in to comment.