python: workaround distutils issue with binary extensions
authorPeter Korsgaard <jacmet@sunsite.dk>
Tue, 14 Feb 2012 09:32:30 +0000 (10:32 +0100)
committerPeter Korsgaard <jacmet@sunsite.dk>
Tue, 14 Feb 2012 09:32:30 +0000 (10:32 +0100)
distutils adds -L$LIBDIR (/usr/lib), breaking build of binary extensions.
Seen with netifaces, but other extensions may be affected as well.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/python/python.mk

index 78895d412d86cfe9f34719aee1d54b89f7eadbe6..28e215c5850f736aff4893cbc332ddf22f9b0d2a 100644 (file)
@@ -131,6 +131,15 @@ PYTHON_MAKE_ENV = \
        PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \
        PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib"
 
+# python distutils adds -L$LIBDIR when linking binary extensions, causing
+# trouble for cross compilation
+define PYTHON_FIXUP_LIBDIR
+       $(SED) 's|^LIBDIR=.*|LIBDIR= $(STAGING_DIR)/usr/lib|' \
+          $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config/Makefile
+endef
+
+PYTHON_POST_INSTALL_STAGING_HOOKS += PYTHON_FIXUP_LIBDIR
+
 #
 # Development files removal
 #