Skip to content
Snippets Groups Projects
Commit cdcf47c8 authored by Damian Alvarez's avatar Damian Alvarez
Browse files

To add pc files to PKGCONFIG_PATH and to have those files also in

version-independent manner
parent 48c299a8
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ Ref: https://speakerdeck.com/ajdecon/introduction-to-the-cuda-toolkit-for-buildi ...@@ -35,6 +35,7 @@ Ref: https://speakerdeck.com/ajdecon/introduction-to-the-cuda-toolkit-for-buildi
@author: Robert Mijakovic (LuxProvide S.A.) @author: Robert Mijakovic (LuxProvide S.A.)
""" """
import os import os
import re
import stat import stat
from distutils.version import LooseVersion from distutils.version import LooseVersion
...@@ -43,8 +44,8 @@ from easybuild.easyblocks.generic.binary import Binary ...@@ -43,8 +44,8 @@ from easybuild.easyblocks.generic.binary import Binary
from easybuild.framework.easyconfig import CUSTOM from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.config import IGNORE from easybuild.tools.config import IGNORE
from easybuild.tools.filetools import adjust_permissions, copy_dir, patch_perl_script_autoflush from easybuild.tools.filetools import adjust_permissions, change_dir, copy_dir, expand_glob_paths
from easybuild.tools.filetools import remove_file, symlink, which, write_file 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.run import run_cmd, run_cmd_qa
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_shared_lib_ext from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_shared_lib_ext
import easybuild.tools.environment as env import easybuild.tools.environment as env
...@@ -198,11 +199,13 @@ class EB_CUDA(Binary): ...@@ -198,11 +199,13 @@ class EB_CUDA(Binary):
if len(self.src) > 1: if len(self.src) > 1:
for patch in self.src[1:]: for patch in self.src[1:]:
self.log.debug("Running patch %s", patch['name']) self.log.debug("Running patch %s", patch['name'])
run_cmd( run_cmd("/bin/sh " + patch['path'] + " --accept-eula --silent --installdir=" + self.installdir)
"/bin/sh " + patch['path'] + " --accept-eula --silent --installdir=" + self.installdir)
def post_install_step(self): 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): def create_wrapper(wrapper_name, wrapper_comp):
"""Create for a particular compiler, with a particular name""" """Create for a particular compiler, with a particular name"""
wrapper_f = os.path.join(self.installdir, 'bin', wrapper_name) wrapper_f = os.path.join(self.installdir, 'bin', wrapper_name)
...@@ -242,8 +245,18 @@ class EB_CUDA(Binary): ...@@ -242,8 +245,18 @@ class EB_CUDA(Binary):
new_stubs_dir = os.path.join(self.installdir, 'stubs') new_stubs_dir = os.path.join(self.installdir, 'stubs')
copy_dir(stubs_dir, os.path.join(new_stubs_dir, 'lib64')) copy_dir(stubs_dir, os.path.join(new_stubs_dir, 'lib64'))
# Also create the lib dir as a symlink # Also create the lib dir as a symlink
symlink('lib64', os.path.join(new_stubs_dir, 'lib'), symlink('lib64', os.path.join(new_stubs_dir, 'lib'), use_abspath_source=False)
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() super(EB_CUDA, self).post_install_step()
...@@ -315,6 +328,7 @@ class EB_CUDA(Binary): ...@@ -315,6 +328,7 @@ class EB_CUDA(Binary):
'LD_LIBRARY_PATH': lib_path, 'LD_LIBRARY_PATH': lib_path,
'LIBRARY_PATH': ['lib64', os.path.join('stubs', 'lib64')], 'LIBRARY_PATH': ['lib64', os.path.join('stubs', 'lib64')],
'CPATH': inc_path, 'CPATH': inc_path,
'PKG_CONFIG_PATH': ['pkgconfig'],
}) })
return guesses return guesses
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment