diff --git a/Custom_EasyBlocks/cuda.py b/Custom_EasyBlocks/cuda.py index 5449d5f0a7ae2cdbe5f4be8b11a004fd089ccf05..13a0ade875b996ec013a9fdfc44c4aa1e87cead4 100644 --- a/Custom_EasyBlocks/cuda.py +++ b/Custom_EasyBlocks/cuda.py @@ -35,6 +35,7 @@ Ref: https://speakerdeck.com/ajdecon/introduction-to-the-cuda-toolkit-for-buildi @author: Robert Mijakovic (LuxProvide S.A.) """ import os +import re import stat from distutils.version import LooseVersion @@ -43,8 +44,8 @@ from easybuild.easyblocks.generic.binary import Binary from easybuild.framework.easyconfig import CUSTOM from easybuild.tools.build_log import EasyBuildError from easybuild.tools.config import IGNORE -from easybuild.tools.filetools import adjust_permissions, copy_dir, patch_perl_script_autoflush -from easybuild.tools.filetools import remove_file, symlink, which, write_file +from easybuild.tools.filetools import adjust_permissions, change_dir, copy_dir, expand_glob_paths +from easybuild.tools.filetools import patch_perl_script_autoflush, remove_file, symlink, which, write_file from easybuild.tools.run import run_cmd, run_cmd_qa from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_shared_lib_ext import easybuild.tools.environment as env @@ -198,11 +199,13 @@ class EB_CUDA(Binary): if len(self.src) > 1: for patch in self.src[1:]: self.log.debug("Running patch %s", patch['name']) - run_cmd( - "/bin/sh " + patch['path'] + " --accept-eula --silent --installdir=" + self.installdir) + run_cmd("/bin/sh " + patch['path'] + " --accept-eula --silent --installdir=" + self.installdir) def post_install_step(self): - """Create wrappers for the specified host compilers and generate the appropriate stub symlinks""" + """ + Create wrappers for the specified host compilers, generate the appropriate stub symlinks and create version + independent pkgconfig files + """ def create_wrapper(wrapper_name, wrapper_comp): """Create for a particular compiler, with a particular name""" wrapper_f = os.path.join(self.installdir, 'bin', wrapper_name) @@ -242,8 +245,18 @@ class EB_CUDA(Binary): new_stubs_dir = os.path.join(self.installdir, 'stubs') copy_dir(stubs_dir, os.path.join(new_stubs_dir, 'lib64')) # Also create the lib dir as a symlink - symlink('lib64', os.path.join(new_stubs_dir, 'lib'), - use_abspath_source=False) + symlink('lib64', os.path.join(new_stubs_dir, 'lib'), use_abspath_source=False) + + # Packages like xpra look for version independent pc files. + # See e.g. https://github.com/Xpra-org/xpra/blob/master/setup.py#L206 + # Distros provide these files, so let's do it here too + pkgconfig_dir = os.path.join(self.installdir, 'pkgconfig') + pc_files = expand_glob_paths([os.path.join(pkgconfig_dir, '*.pc')]) + change_dir(pkgconfig_dir) + for f in pc_files: + f = os.path.basename(f) + l = re.sub('-[0-9]*.?[0-9]*(.[0-9]*)?.pc', '.pc', f) + symlink(f, l, use_abspath_source=False) super(EB_CUDA, self).post_install_step() @@ -315,6 +328,7 @@ class EB_CUDA(Binary): 'LD_LIBRARY_PATH': lib_path, 'LIBRARY_PATH': ['lib64', os.path.join('stubs', 'lib64')], 'CPATH': inc_path, + 'PKG_CONFIG_PATH': ['pkgconfig'], }) return guesses