1. kill rpath 2. fix-up issues with /usr/local 3. support /usr/lib64 4. correct the version diff --git a/setup.py b/setup.py index c57e1cd..6184084 100644 --- a/setup.py +++ b/setup.py @@ -43,12 +43,23 @@ except ImportError: from setuptools import Extension from setuptools.command.install import install as _install +# XXX Using the compile time platform to guide the compilation target, +# including the location of the libraries, is wrong if even a mild +# cross-compilation is involved (such as building i686 on x86_64). platform_str = platform.platform() +platform_arch = platform.architecture() default_python_incdir = get_python_inc() default_python_libdir = get_python_lib() -default_library_paths = [default_python_libdir, - ('%s/usr/local/lib' % _exec_prefix), - '/lib', '/usr/lib', '/usr/local/lib'] +if platform_arch[0].startswith('64') and os.path.exists('/usr/lib64'): + default_library_paths = [ + default_python_libdir, + ('%s/lib64' % _exec_prefix), + '/usr/lib64', '/usr/local/lib64'] +else: + default_library_paths = [ + default_python_libdir, + ('%s/lib' % _exec_prefix), + '/lib', '/usr/lib', '/usr/local/lib'] # utility routine def _read_file_as_str(name): @@ -124,13 +135,9 @@ class install(_install): elif prefix is not None: installroot = prefix else: - installroot = "/" + installroot = "/usr/local" - # exception is "/usr" - if installroot.startswith("/usr"): - installroot = "/" - - default_library_paths.insert(0, "%s/usr/local/lib" % installroot) + default_library_paths.insert(0, "%s/lib" % installroot) _install.run(self) # Another Mac-ism... If the libraries are installed @@ -143,14 +150,13 @@ class install(_install): print("***************************************************") print("** ") print("** PyECLib libraries have been installed to: ") - print("** %susr/local/lib" % installroot) + print("** %s" % installroot) print("** ") print("** Any user using this library must update: ") print("** %s" % ldpath_str) print("** ") print("** Run 'ldconfig' or place this line: ") - print("** export %s=%s" % (ldpath_str, "%susr/local/lib" - % installroot)) + print("** export %s=%s" % (ldpath_str, "%s/lib" % installroot)) print("** ") print("** into .bashrc, .profile, or the appropriate shell") print("** start-up script! Also look at ldconfig(8) man ") @@ -169,16 +175,13 @@ module = Extension('pyeclib_c', 'src/c/pyeclib_c', '/usr/local/include'], library_dirs=default_library_paths, - runtime_library_dirs=default_library_paths, libraries=['erasurecode'], # The extra arguments are for debugging # extra_compile_args=['-g', '-O0'], - extra_link_args=['-Wl,-rpath,%s' % - l for l in default_library_paths], sources=['src/c/pyeclib_c/pyeclib_c.c']) setup(name='PyECLib', - version='1.0.5m', + version='1.0.7', author='Kevin Greenan', author_email='kmgreen2@gmail.com', maintainer='Kevin Greenan and Tushar Gohad',