From 558bd4d9c5e52be09fce5771f86ca407dc2966db Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 18 Jun 2021 09:28:46 +0300 Subject: Do not add default RPATH On Fedora Rawhide (future F35), a distribution policy asks to avoid adding standard library paths to RPATH. The way paths currently added in mod_wsgi, PYTHON_LIBDIR is always added to the RPATH, causing breakage on Fedora. Signed-off-by: Alexander Bokovoy --- configure.ac | 9 +++++++-- setup.py | 14 +++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 9d4f779..37a0f86 100644 --- a/configure.ac +++ b/configure.ac @@ -44,6 +44,7 @@ XCODE_BIN_PATTERN="${XCODE_PREFIX}.*/usr/bin/" if test -x "${APXS}"; then APXS_CC=`${APXS} -q CC` APXS_LIBTOOL=`${APXS} -q LIBTOOL | sed -e "s/ .*$//"` + APXS_LIBDIR=`${APXS} -q LIBDIR | sed -e "s/ .*$//"` case ${APXS_CC} in ${XCODE_PREFIX}*) if test ! -x ${XCODE_CC}; then @@ -159,8 +160,12 @@ fi if test "${PYTHONFRAMEWORKDIR}" = "no-framework" -o \ "${ENABLE_FRAMEWORK}" != "yes"; then - LDFLAGS1="-L${PYTHONLIBDIR}" - LDFLAGS2="-L${PYTHONCFGDIR}" + if test "${PYTHONLIBDIR}" != "${APXS_LIBDIR}" ; then + LDFLAGS1="-L${PYTHONLIBDIR}" + fi + if test "${PYTHONCFGDIR}" != "${APXS_LIBDIR}" ; then + LDFLAGS2="-L${PYTHONCFGDIR}" + fi LDLIBS1="-lpython${PYTHON_LDVERSION}" diff --git a/setup.py b/setup.py index 49f948f..4bd8eba 100644 --- a/setup.py +++ b/setup.py @@ -445,6 +445,7 @@ else: PYTHON_LDVERSION = get_python_config('LDVERSION') or PYTHON_VERSION PYTHON_LIBDIR = get_python_config('LIBDIR') + APXS_LIBDIR = get_apxs_config('LIBDIR') PYTHON_CFGDIR = get_python_lib(plat_specific=1, standard_lib=1) + '/config' if PYTHON_LDVERSION and PYTHON_LDVERSION != PYTHON_VERSION: @@ -452,7 +453,10 @@ else: if not os.path.exists(PYTHON_CFGDIR): PYTHON_CFGDIR = '%s-%s' % (PYTHON_CFGDIR, sys.platform) - PYTHON_LDFLAGS = ['-L%s' % PYTHON_LIBDIR, '-L%s' % PYTHON_CFGDIR] + PYTHON_LDFLAGS = ['-L%s' % PYTHON_CFGDIR] + if PYTHON_LIBDIR != APXS_LIBDIR: + PYTHON_LDFLAGS.insert(0, '-L%s' % PYTHON_LIBDIR) + PYTHON_LDLIBS = ['-lpython%s' % PYTHON_LDVERSION] if os.path.exists(os.path.join(PYTHON_LIBDIR, @@ -472,9 +476,13 @@ EXTRA_LINK_ARGS = PYTHON_LDFLAGS + PYTHON_LDLIBS # Force adding of LD_RUN_PATH for platforms that may need it. +LD_RUN_PATHS = [] if os.name != 'nt': LD_RUN_PATH = os.environ.get('LD_RUN_PATH', '') - LD_RUN_PATH += ':%s:%s' % (PYTHON_LIBDIR, PYTHON_CFGDIR) + LD_RUN_PATHS = [PYTHON_CFGDIR] + if PYTHON_LIBDIR != APXS_LIBDIR: + LD_RUN_PATHS.insert(0, PYTHON_LIBDIR) + LD_RUN_PATH += ':' + ':'.join(LD_RUN_PATHS) LD_RUN_PATH = LD_RUN_PATH.lstrip(':') os.environ['LD_RUN_PATH'] = LD_RUN_PATH @@ -507,7 +515,7 @@ else: extension = Extension(extension_name, source_files, include_dirs=INCLUDE_DIRS, extra_compile_args=EXTRA_COMPILE_FLAGS, - extra_link_args=EXTRA_LINK_ARGS) + extra_link_args=EXTRA_LINK_ARGS, runtime_library_dirs=LD_RUN_PATHS) def _documentation(): result = [] -- cgit v1.2.1