gaussian-view/vmd: add deps on X11/GL libraries (#22322)
Both binary packages would otherwise require X11 and Mesa libraries to be installed on the host to run. Make sure they use the Spack-provided libraries by patching the `rpath` via `patchelf`.
This commit is contained in:
parent
dee030618f
commit
c6a08981a7
@ -44,6 +44,15 @@ class GaussianView(Package):
|
||||
|
||||
conflicts('+gaussian-src', when='@:6.0.99')
|
||||
|
||||
depends_on('libx11', type=('run', 'link'))
|
||||
depends_on('libxext', type=('run', 'link'))
|
||||
depends_on('gl@3:', type=('run', 'link'))
|
||||
depends_on('glu@1.3', type=('run', 'link'))
|
||||
depends_on('libxrender', type=('run', 'link'))
|
||||
depends_on('libsm', type=('run', 'link'))
|
||||
depends_on('libice', type=('run', 'link'))
|
||||
depends_on('patchelf', type='build')
|
||||
|
||||
def url_for_version(self, version):
|
||||
return "file://{0}/gv{1}-linux-x86_64.tbz".format(
|
||||
os.getcwd(),
|
||||
@ -52,6 +61,18 @@ def url_for_version(self, version):
|
||||
def install(self, spec, prefix):
|
||||
install_tree('.', prefix)
|
||||
|
||||
# make sure the executable finds and uses the Spack-provided
|
||||
# libraries, otherwise the executable may or may not run depending
|
||||
# on what is installed on the host
|
||||
# the $ORIGIN prefix is required for the executable to find its
|
||||
# own bundled shared libraries
|
||||
patchelf = which('patchelf')
|
||||
rpath = '$ORIGIN:$ORIGIN/lib' + ':'.join(
|
||||
self.spec[dep].libs.directories[0]
|
||||
for dep in ['libx11', 'libxext', 'libxrender', 'libice', 'libsm',
|
||||
'gl', 'glu'])
|
||||
patchelf('--set-rpath', rpath, join_path(self.prefix, 'gview.exe'))
|
||||
|
||||
@run_after('install')
|
||||
def caveats(self):
|
||||
perm_script = 'spack_perms_fix.sh'
|
||||
|
@ -18,3 +18,8 @@ class Libice(AutotoolsPackage, XorgPackage):
|
||||
depends_on('xtrans')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('util-macros', type='build')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libICE', self.prefix,
|
||||
shared=True, recursive=True)
|
||||
|
@ -22,3 +22,8 @@ class Libsm(AutotoolsPackage, XorgPackage):
|
||||
depends_on('xtrans')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('util-macros', type='build')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libSM', self.prefix,
|
||||
shared=True, recursive=True)
|
||||
|
@ -20,3 +20,8 @@ class Libxext(AutotoolsPackage, XorgPackage):
|
||||
depends_on('xextproto@7.1.99:')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('util-macros', type='build')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libXext', self.prefix,
|
||||
shared=True, recursive=True)
|
||||
|
@ -21,3 +21,8 @@ class Libxinerama(AutotoolsPackage, XorgPackage):
|
||||
depends_on('xineramaproto@1.1.99.1:')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('util-macros', type='build')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libXinerama', self.prefix,
|
||||
shared=True, recursive=True)
|
||||
|
@ -20,3 +20,8 @@ class Libxrender(AutotoolsPackage, XorgPackage):
|
||||
depends_on('renderproto@0.9:')
|
||||
depends_on('pkgconfig', type='build')
|
||||
depends_on('util-macros', type='build')
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
return find_libraries('libXrender', self.prefix,
|
||||
shared=True, recursive=True)
|
||||
|
@ -27,6 +27,12 @@ class Vmd(Package):
|
||||
|
||||
phases = ['configure', 'install']
|
||||
|
||||
depends_on('libx11', type=('run', 'link'))
|
||||
depends_on('libxi', type=('run', 'link'))
|
||||
depends_on('libxinerama', type=('run', 'link'))
|
||||
depends_on('gl@3:', type=('run', 'link'))
|
||||
depends_on('patchelf', type='build')
|
||||
|
||||
def setup_build_environment(self, env):
|
||||
env.set('VMDINSTALLBINDIR', self.prefix.bin)
|
||||
env.set('VMDINSTALLLIBRARYDIR', self.prefix.lib64)
|
||||
@ -39,5 +45,15 @@ def install(self, spec, prefix):
|
||||
with working_dir(join_path(self.stage.source_path, 'src')):
|
||||
make('install')
|
||||
|
||||
# make sure the executable finds and uses the Spack-provided
|
||||
# libraries, otherwise the executable may or may not run depending
|
||||
# on what is installed on the host
|
||||
patchelf = which('patchelf')
|
||||
rpath = ':'.join(
|
||||
self.spec[dep].libs.directories[0]
|
||||
for dep in ['libx11', 'libxi', 'libxinerama', 'gl'])
|
||||
patchelf('--set-rpath', rpath,
|
||||
join_path(self.prefix, 'lib64', 'vmd_LINUXAMD64'))
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
env.set('PLUGINDIR', self.spec.prefix.lib64.plugins)
|
||||
|
Loading…
Reference in New Issue
Block a user