summaryrefslogtreecommitdiffstats
path: root/linux_dpdk/ws_main.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-11-30 15:04:59 +0200
committerimarom <imarom@cisco.com>2016-11-30 15:04:59 +0200
commitb812770167d37125b3f3e1b0673517d8f83393ac (patch)
treeb99f73265f7f713995ed9ccdf5016e01c45b9ca9 /linux_dpdk/ws_main.py
parent5b4fcd558793cf7222cc260d8d5aead03cf1cb86 (diff)
parent3beb07058c3781d9f3ce888be636b6484f750c96 (diff)
merging with latest master
Signed-off-by: imarom <imarom@cisco.com> Conflicts: src/main_dpdk.cpp
Diffstat (limited to 'linux_dpdk/ws_main.py')
-rwxr-xr-xlinux_dpdk/ws_main.py49
1 files changed, 43 insertions, 6 deletions
diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py
index eccb4089..6c163fbf 100755
--- a/linux_dpdk/ws_main.py
+++ b/linux_dpdk/ws_main.py
@@ -12,6 +12,7 @@ import copy;
import re
import uuid
import subprocess
+import platform
# these variables are mandatory ('/' are converted automatically)
top = '../'
@@ -98,9 +99,42 @@ def options(opt):
opt.add_option('--pkg-file', '--pkg_file', dest='pkg_file', default=False, action='store', help="Destination filename for 'pkg' option.")
opt.add_option('--publish-commit', '--publish_commit', dest='publish_commit', default=False, action='store', help="Specify commit id for 'publish_both' option (Please make sure it's good!)")
+
+def check_ibverbs_deps(bld):
+ if 'LDD' not in bld.env or not len(bld.env['LDD']):
+ bld.fatal('Please run configure. Missing key LDD.')
+ cmd = '%s %s/external_libs/ibverbs/libibverbs.so' % (bld.env['LDD'][0], top)
+ ret, out = getstatusoutput(cmd)
+ if ret or not out:
+ bld.fatal("Command of checking libraries '%s' failed.\nReturn status: %s\nOutput: %s" % (cmd, ret, out))
+ if '=> not found' in out:
+ dumy_libs_path = os.path.abspath(top + 'scripts/dumy_libs')
+ print('Adding rpath %s' % dumy_libs_path)
+ rpath_linkage.append(dumy_libs_path)
+
+
+def missing_pkg_msg(fedora, ubuntu):
+ msg = 'not found\n'
+ fedora_install = 'Fedora install:\nsudo yum install %s\n' % fedora
+ ubuntu_install = 'Ubuntu install:\nsudo apt install %s\n' % ubuntu
+ try:
+ if platform.linux_distribution()[0].capitalize() == 'Ubuntu':
+ msg += ubuntu_install
+ elif platform.linux_distribution()[0].capitalize() == 'Fedora':
+ msg += fedora_install
+ else:
+ raise
+ except:
+ msg += 'Could not determine Linux distribution.\n%s\n%s' % (ubuntu_install, fedora_install)
+ return msg
+
+
def configure(conf):
conf.load('g++')
conf.load('gcc')
+ conf.find_program('ldd')
+ conf.check_cxx(lib = 'z', errmsg = missing_pkg_msg(fedora = 'zlib-devel', ubuntu = 'zlib1g-dev'))
+
def getstatusoutput(cmd):
""" Return (status, output) of executing cmd in a shell. Taken from Python3 subprocess.getstatusoutput"""
@@ -618,6 +652,7 @@ client_external_libs = [
'texttable-0.8.4',
]
+rpath_linkage = []
RELEASE_ = "release"
DEBUG_ = "debug"
@@ -751,12 +786,6 @@ build_types = [
def build_prog (bld, build_obj):
- zmq_lib_path='external_libs/zmq/'
- bld.read_shlib( name='zmq' , paths=[top+zmq_lib_path] )
-
- ibverbs_lib_path='external_libs/ibverbs/'
- bld.read_shlib( name='ibverbs' , paths=[top+ibverbs_lib_path] )
-
#rte_libs =[
# 'dpdk'];
@@ -787,6 +816,7 @@ def build_prog (bld, build_obj):
lib=['pthread','dl', 'z'],
use =[build_obj.get_dpdk_target(),'zmq','ibverbs'],
source = bp.file_list(top) + debug_file_list,
+ rpath = rpath_linkage,
target = build_obj.get_target())
@@ -804,6 +834,13 @@ def post_build(bld):
def build(bld):
bld.add_pre_fun(pre_build)
bld.add_post_fun(post_build);
+ check_ibverbs_deps(bld)
+
+ zmq_lib_path='external_libs/zmq/'
+ bld.read_shlib( name='zmq' , paths=[top+zmq_lib_path] )
+ ibverbs_lib_path='external_libs/ibverbs/'
+ bld.read_shlib( name='ibverbs' , paths=[top+ibverbs_lib_path] )
+
for obj in build_types:
build_type(bld,obj);