Ticket #13397: 13397_relocate_lib64.patch

File 13397_relocate_lib64.patch, 2.2 KB (added by jdemeyer, 10 years ago)
  • sage-location

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1345809705 -7200
    # Node ID 211835eeab9bae7beedab92b568f02dd234ecf51
    # Parent  3307bd986ce2e744c0fd656daf28d4def41b7931
    Handle lib32 and lib64 in sage-location
    
    diff --git a/sage-location b/sage-location
    a b  
    138138
    139139def update_library_files():
    140140    """
    141     Run ``ranlib`` on all static libraries (``*.a``) in the library directory,
    142     and manually change the paths in all of ``libtool``'s ``.la`` library files.
     141    Run ``ranlib`` on all static libraries (``*.a``) in the library
     142    directory, and manually change the paths in all of ``.la``
     143    libtool archives.
    143144    """
    144     LIB = os.path.join(os.path.abspath(SAGE_ROOT), 'local', 'lib')
    145     # The .a files should be re-ranlib'd:
    146     os.system('cd "%s"; ranlib *.a 1>/dev/null 2>/dev/null' % LIB)
     145    for libdir in ["lib", "lib32", "lib64"]:
     146        LIB = os.path.join(SAGE_ROOT, 'local', libdir)
     147        if not os.path.isdir(LIB):
     148            continue
    147149
    148     # The .la files hardcode path info, so we manually fix the path info:
    149     for F in os.listdir(LIB):
    150        if os.path.splitext(F)[1]==".la":
    151            G = open(os.path.join(LIB,F)).read()
    152            i = G.find('libdir=')
    153            j = i+8 + G[i+8:].find("'")
    154            z = G[i+8:j].strip().strip("'")
    155            i = z.rfind('local/')
    156            if i != -1:
    157                z = z[:i]
    158                H = G.replace(z, os.path.abspath(SAGE_ROOT) + '/')
    159                open(os.path.join(LIB, F),'w').write(H)
     150        # The .a files should be re-ranlib'd:
     151        os.system('cd "%s"; ranlib *.a 1>/dev/null 2>/dev/null' % LIB)
     152
     153        # The .la files hardcode path info, so we manually fix the path info:
     154        for F in os.listdir(LIB):
     155           if os.path.splitext(F)[-1] == ".la":
     156               G = open(os.path.join(LIB,F)).read()
     157               i = G.find('libdir=')
     158               j = i+8 + G[i+8:].find("'")
     159               z = G[i+8:j].strip().strip("'")
     160               i = z.rfind('local/')
     161               if i != -1:
     162                   z = z[:i]
     163                   H = G.replace(z, os.path.abspath(SAGE_ROOT) + '/')
     164                   open(os.path.join(LIB, F),'w').write(H)
    160165
    161166
    162167def initialize_pkgconfig_files():