Support lib64 dirs in rosboost-cfg (#2831)

This commit is contained in:
Josh Faust 2010-07-01 18:48:41 +00:00
parent 26abe0d111
commit bf49349a8e
1 changed files with 24 additions and 4 deletions

View File

@ -75,12 +75,13 @@ class BoostError(Exception):
return repr(self.value)
class Version(object):
def __init__(self, major, minor, patch, root, include_dir, is_default_search_location):
def __init__(self, major, minor, patch, root, include_dir, lib_dir, is_default_search_location):
self.major = major
self.minor = minor
self.patch = patch
self.root = root
self.include_dir = include_dir
self.lib_dir = lib_dir
self.is_default_search_location = is_default_search_location
self.is_system_install = os.path.split(self.include_dir)[0] == self.root
@ -105,6 +106,20 @@ class Version(object):
def __repr__(self):
return repr((self.major, self.minor, self.patch, self.root, self.include_dir, self.is_default_search_location, self.is_system_install))
def find_lib_dir(root_dir):
# prefer lib64 unless explicitly specified in the environment
if ('ROS_BOOST_LIB_DIR_NAME' in os.environ):
possible_dirs = [os.path.join(root_dir, os.environ['ROS_BOOST_LIB_DIR_NAME'])]
else:
possible_dirs = [os.path.join(root_dir, "lib64"), os.path.join(root_dir, "lib")]
for p in possible_dirs:
glob_files = glob("%s*"%(os.path.join(p, "libboost*")))
if (len(glob_files) > 0):
return p
return None
def extract_versions(dir, is_default_search_location):
version_paths = [os.path.join(dir, "version.hpp"),
os.path.join(dir, "boost", "version.hpp")]
@ -128,7 +143,9 @@ def extract_versions(dir, is_default_search_location):
minor = ver_int / 100 % 1000
major = ver_int / 100000
include_dir = os.path.split(os.path.split(p)[0])[0]
versions.append(Version(major, minor, patch, os.path.split(dir)[0], include_dir, is_default_search_location))
root_dir = os.path.split(dir)[0]
lib_dir = find_lib_dir(root_dir)
versions.append(Version(major, minor, patch, root_dir, include_dir, lib_dir, is_default_search_location))
return versions
@ -181,7 +198,7 @@ def search_paths(sysroot):
return search_paths
def lib_dir(ver):
return os.path.join(ver.root, "lib")
return ver.lib_dir
def find_lib(ver, name, full_lib = link_static):
global lib_suffix
@ -214,6 +231,9 @@ def find_lib(ver, name, full_lib = link_static):
search_paths = static_search_paths if link_static else dynamic_search_paths
dir = lib_dir(ver)
if (dir is None):
raise BoostError('Could not locate library [%s]'%(name))
for p in search_paths:
globstr = os.path.join(dir, p)
@ -224,7 +244,7 @@ def find_lib(ver, name, full_lib = link_static):
else:
return os.path.basename(libs[0])
raise BoostError('Could not locate library [%s]'%(name))
raise BoostError('Could not locate library [%s] in lib directory [%s]'%(name, dir))
def include_dirs(ver, prefix = ''):
if (ver.is_system_install or no_L_or_I):