예제 #1
0
    def install_step(self):
        """Custom install step, to add extra symlinks"""
        if self.toolchain.is_system_toolchain():
            silent_cfg_names_map = None
            silent_cfg_extras = None

            if LooseVersion(self.version) < LooseVersion('4.2'):
                silent_cfg_names_map = {
                    'activation_name': ACTIVATION_NAME_2012,
                    'license_file_name': LICENSE_FILE_NAME_2012,
                }

            elif LooseVersion(self.version) < LooseVersion('4.4'):
                silent_cfg_names_map = {
                    'install_mode_name': INSTALL_MODE_NAME_2015,
                    'install_mode': INSTALL_MODE_2015,
                }

            # In case of TBB 4.4.x and newer we have to specify ARCH_SELECTED in silent.cfg
            if LooseVersion(self.version) >= LooseVersion('4.4'):
                silent_cfg_extras = {
                    'ARCH_SELECTED': self.arch.upper()
                }

            IntelBase.install_step(self, silent_cfg_names_map=silent_cfg_names_map, silent_cfg_extras=silent_cfg_extras)

            # determine libdir
            os.chdir(self.installdir)
            if LooseVersion(self.version) < LooseVersion('4.1.0'):
                libglob = 'tbb/lib/intel64/cc*libc*_kernel*'
                libs = sorted(glob.glob(libglob), key=LooseVersion)
                if len(libs):
                    # take the last one, should be ordered by cc version
                    # we're only interested in the last bit
                    libdir = libs[-1].split('/')[-1]
                else:
                    raise EasyBuildError("No libs found using %s in %s", libglob, self.installdir)
            else:
                libdir = get_tbb_gccprefix()

            self.libpath = os.path.join('tbb', 'libs', 'intel64', libdir)
            self.log.debug("self.libpath: %s" % self.libpath)
            # applications go looking into tbb/lib so we move what's in there to libs
            # and symlink the right lib from /tbb/libs/intel64/... to lib
            install_libpath = os.path.join(self.installdir, 'tbb', 'lib')
            shutil.move(install_libpath, os.path.join(self.installdir, 'tbb', 'libs'))
            os.symlink(os.path.join(self.installdir, self.libpath), install_libpath)
        else:
            # no custom install step when building from source (building is done in install directory)
            cand_lib_paths = glob.glob(os.path.join(self.installdir, 'build', '*_release'))
            if len(cand_lib_paths) == 1:
                self.libpath = os.path.join('build', os.path.basename(cand_lib_paths[0]))
            else:
                raise EasyBuildError("Failed to isolate location of libraries: %s", cand_lib_paths)
예제 #2
0
    def install_step(self):
        """Custom install step, to add extra symlinks"""
        if self.toolchain.name == DUMMY_TOOLCHAIN_NAME:
            silent_cfg_names_map = None
            silent_cfg_extras = None

            if LooseVersion(self.version) < LooseVersion('4.2'):
                silent_cfg_names_map = {
                    'activation_name': ACTIVATION_NAME_2012,
                    'license_file_name': LICENSE_FILE_NAME_2012,
                }

            elif LooseVersion(self.version) < LooseVersion('4.4'):
                silent_cfg_names_map = {
                    'install_mode_name': INSTALL_MODE_NAME_2015,
                    'install_mode': INSTALL_MODE_2015,
                }

            # In case of TBB 4.4.x and newer we have to specify ARCH_SELECTED in silent.cfg
            if LooseVersion(self.version) >= LooseVersion('4.4'):
                silent_cfg_extras = {
                    'ARCH_SELECTED': self.arch.upper()
                }

            IntelBase.install_step(self, silent_cfg_names_map=silent_cfg_names_map, silent_cfg_extras=silent_cfg_extras)

            # determine libdir
            os.chdir(self.installdir)
            if LooseVersion(self.version) < LooseVersion('4.1.0'):
                libglob = 'tbb/lib/intel64/cc*libc*_kernel*'
                libs = sorted(glob.glob(libglob), key=LooseVersion)
                if len(libs):
                    # take the last one, should be ordered by cc version
                    # we're only interested in the last bit
                    libdir = libs[-1].split('/')[-1]
                else:
                    raise EasyBuildError("No libs found using %s in %s", libglob, self.installdir)
            else:
                libdir = get_tbb_gccprefix()

            self.libpath = os.path.join('tbb', 'libs', 'intel64', libdir)
            self.log.debug("self.libpath: %s" % self.libpath)
            # applications go looking into tbb/lib so we move what's in there to libs
            # and symlink the right lib from /tbb/libs/intel64/... to lib
            install_libpath = os.path.join(self.installdir, 'tbb', 'lib')
            shutil.move(install_libpath, os.path.join(self.installdir, 'tbb', 'libs'))
            os.symlink(os.path.join(self.installdir, self.libpath), install_libpath)
        else:
            # no custom install step when building from source (building is done in install directory)
            cand_lib_paths = glob.glob(os.path.join(self.installdir, 'build', '*_release'))
            if len(cand_lib_paths) == 1:
                self.libpath = os.path.join('build', os.path.basename(cand_lib_paths[0]))
            else:
                raise EasyBuildError("Failed to isolate location of libraries: %s", cand_lib_paths)
예제 #3
0
    def install_step(self):
        """Custom install step, to add extra symlinks"""
        install_tbb_lib_path = os.path.join(self.installdir, 'tbb', 'lib')

        if self.toolchain.is_system_toolchain():
            silent_cfg_names_map = None
            silent_cfg_extras = None

            if LooseVersion(self.version) < LooseVersion('4.2'):
                silent_cfg_names_map = {
                    'activation_name': ACTIVATION_NAME_2012,
                    'license_file_name': LICENSE_FILE_NAME_2012,
                }

            elif LooseVersion(self.version) < LooseVersion('4.4'):
                silent_cfg_names_map = {
                    'install_mode_name': INSTALL_MODE_NAME_2015,
                    'install_mode': INSTALL_MODE_2015,
                }

            # In case of TBB 4.4.x and newer we have to specify ARCH_SELECTED in silent.cfg
            if LooseVersion(self.version) >= LooseVersion('4.4'):
                silent_cfg_extras = {'ARCH_SELECTED': self.arch.upper()}

            IntelBase.install_step(self,
                                   silent_cfg_names_map=silent_cfg_names_map,
                                   silent_cfg_extras=silent_cfg_extras)

            # determine libdir
            os.chdir(self.installdir)
            libpath = os.path.join('tbb', 'libs', 'intel64')
            if LooseVersion(self.version) < LooseVersion('4.1.0'):
                libglob = 'tbb/lib/intel64/cc*libc*_kernel*'
                libs = sorted(glob.glob(libglob), key=LooseVersion)
                if libs:
                    # take the last one, should be ordered by cc version
                    # we're only interested in the last bit
                    libdir = os.path.basename(libs[-1])
                else:
                    raise EasyBuildError("No libs found using %s in %s",
                                         libglob, self.installdir)
            else:
                libdir = get_tbb_gccprefix(libpath)

            libpath = os.path.join(libpath, libdir)
            # applications go looking into tbb/lib so we move what's in there to tbb/libs
            shutil.move(install_tbb_lib_path,
                        os.path.join(self.installdir, 'tbb', 'libs'))
            # And add a symlink of the library folder to tbb/lib
            symlink(os.path.join(self.installdir, libpath),
                    install_tbb_lib_path)
        else:
            # no custom install step when building from source (building is done in install directory)
            cand_lib_paths = glob.glob(
                os.path.join(self.installdir, 'build', '*_release'))
            if len(cand_lib_paths) == 1:
                libpath = os.path.join('build',
                                       os.path.basename(cand_lib_paths[0]))
            else:
                raise EasyBuildError(
                    "Failed to isolate location of libraries: %s",
                    cand_lib_paths)

        self.log.debug("libpath: %s" % libpath)
        # applications usually look into /lib, so we move the folder there and symlink the original one to it
        # This is also important so that /lib and /lib64 are actually on the same level
        root_lib_path = os.path.join(self.installdir, 'lib')
        move_file(libpath, root_lib_path)
        symlink(os.path.relpath(root_lib_path, os.path.join(libpath)),
                libpath,
                use_abspath_source=False)

        # Install CMake config files if possible
        if self._has_cmake() and LooseVersion(
                self.version) >= LooseVersion('2020.0'):
            cmake_install_dir = os.path.join(root_lib_path, 'cmake', 'TBB')
            cmd = [
                'cmake',
                '-DINSTALL_DIR=' + cmake_install_dir,
                '-DSYSTEM_NAME=Linux',
                '-P tbb_config_installer.cmake',
            ]
            run_cmd(' '.join(cmd), path=os.path.join(self.builddir, 'cmake'))