Fix up bzip2 install

This commit is contained in:
Todd Gamblin 2014-12-25 17:55:19 -08:00
parent d98e475361
commit 0bc861db6e
3 changed files with 25 additions and 1 deletions

View File

@ -30,6 +30,7 @@
import sys
import re
import shutil
import stat
import errno
import getpass
from contextlib import contextmanager, closing
@ -145,6 +146,13 @@ def install(src, dest):
shutil.copy(src, dest)
set_install_permissions(dest)
src_mode = os.stat(src).st_mode
dest_mode = os.stat(dest).st_mode
if src_mode | stat.S_IXUSR: dest_mode |= stat.S_IXUSR
if src_mode | stat.S_IXGRP: dest_mode |= stat.S_IXGRP
if src_mode | stat.S_IXOTH: dest_mode |= stat.S_IXOTH
os.chmod(dest, dest_mode)
def expand_user(path):
"""Find instances of '%u' in a path and replace with the current user's

View File

@ -190,6 +190,7 @@ def set_module_variables_for_package(pkg):
m.makedirs = os.makedirs
m.remove = os.remove
m.removedirs = os.removedirs
m.symlink = os.symlink
m.mkdirp = mkdirp
m.install = install

View File

@ -1,4 +1,5 @@
from spack import *
from glob import glob
class Bzip2(Package):
"""bzip2 is a freely available, patent free high-quality data
@ -15,5 +16,19 @@ def install(self, spec, prefix):
# No configure system -- have to filter the makefile for this package.
filter_file(r'CC=gcc', 'CC=cc', 'Makefile', string=True)
make()
make('-f', 'Makefile-libbz2_so')
make('clean')
make("install", "PREFIX=%s" % prefix)
bzip2_exe = join_path(prefix.bin, 'bzip2')
install('bzip2-shared', bzip2_exe)
for libfile in glob('libbz2.so*'):
install(libfile, prefix.lib)
bunzip2 = join_path(prefix.bin, 'bunzip2')
remove(bunzip2)
symlink(bzip2_exe, bunzip2)
bzcat = join_path(prefix.bin, 'bzcat')
remove(bzcat)
symlink(bzip2_exe, bzcat)