make-rules/setup.py.mk
changeset 1057 e04f97962a3d
parent 774 d0cbca26a17c
child 1293 98e5300bb391
child 2693 2aa48dc32866
--- a/make-rules/setup.py.mk	Wed Nov 14 14:29:54 2012 -0800
+++ b/make-rules/setup.py.mk	Wed Nov 14 14:29:58 2012 -0800
@@ -48,13 +48,21 @@
 $(BUILD_DIR)/%-2.6/.installed:	$(BUILD_DIR)/%-2.7/.installed
 endif
 
+# Create a distutils config file specific to the combination of build
+# characteristics (bittedness x Python version), and put it in its own
+# directory.  We can set $HOME to point distutils at it later, allowing
+# the install phase to find the temporary build directories.
+CFG=.pydistutils.cfg
+$(BUILD_DIR)/config-%/$(CFG):
+	$(MKDIR) $(@D)
+	echo "[build]\nbuild_base = $(BUILD_DIR)/$*" > [email protected]
+
 # build the configured source
-$(BUILD_DIR)/%/.built:	$(SOURCE_DIR)/.prep
+$(BUILD_DIR)/%/.built:	$(SOURCE_DIR)/.prep $(BUILD_DIR)/config-%/$(CFG)
 	$(RM) -r $(@D) ; $(MKDIR) $(@D)
 	$(COMPONENT_PRE_BUILD_ACTION)
-	(cd $(SOURCE_DIR) ; $(ENV) $(PYTHON_ENV) \
-		$(PYTHON.$(BITS)) ./setup.py build \
-			--build-temp $(@D:$(BUILD_DIR)/%=%))
+	(cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(PYTHON_ENV) \
+		$(PYTHON.$(BITS)) ./setup.py build)
 	$(COMPONENT_POST_BUILD_ACTION)
 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
 	-$(PARFAIT) $(SOURCE_DIR)/$(@D:$(BUILD_DIR)/%=%)
@@ -70,9 +78,9 @@
 COMPONENT_INSTALL_ARGS +=	--force
 
 # install the built source into a prototype area
-$(BUILD_DIR)/%/.installed:	$(BUILD_DIR)/%/.built
+$(BUILD_DIR)/%/.installed:	$(BUILD_DIR)/%/.built $(BUILD_DIR)/config-%/$(CFG)
 	$(COMPONENT_PRE_INSTALL_ACTION)
-	(cd $(SOURCE_DIR) ; $(ENV) $(COMPONENT_INSTALL_ENV) \
+	(cd $(SOURCE_DIR) ; $(ENV) HOME=$(BUILD_DIR)/config-$* $(COMPONENT_INSTALL_ENV) \
 		$(PYTHON.$(BITS)) ./setup.py install $(COMPONENT_INSTALL_ARGS))
 	$(COMPONENT_POST_INSTALL_ACTION)
 	$(TOUCH) [email protected]