[csw-devel] SF.net SVN: gar:[6088] csw/mgar/gar/v2-pbuild

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Sun Aug 23 18:13:45 CEST 2009


Revision: 6088
          http://gar.svn.sourceforge.net/gar/?rev=6088&view=rev
Author:   dmichelsen
Date:     2009-08-23 16:13:45 +0000 (Sun, 23 Aug 2009)

Log Message:
-----------
mGAR v2 pbuild: Intermediate commit

Modified Paths:
--------------
    csw/mgar/gar/v2-pbuild/gar.conf.mk
    csw/mgar/gar/v2-pbuild/gar.mk

Modified: csw/mgar/gar/v2-pbuild/gar.conf.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.conf.mk	2009-08-23 15:03:00 UTC (rev 6087)
+++ csw/mgar/gar/v2-pbuild/gar.conf.mk	2009-08-23 16:13:45 UTC (rev 6088)
@@ -135,7 +135,7 @@
 DESTROOT ?= $(HOME)
 
 # This is the directory from where the package is build from
-PKGROOT ?= $(abspath $(WORKROOTDIR)/pkgroot)
+PKGROOT ?= $(abspath $(WORKROOTDIR)/pkgroot-$(GARCH))
 
 # Each ISA has a separate installation directory inside the
 # working directory for that package. The files are copied
@@ -274,6 +274,26 @@
 # ISALIST_$(GARCOMPILER) contains all ISAs which are compilable with the selected compiler
 $(foreach C,$(GARCOMPILERS),$(eval ISALIST_$(C) ?= $(foreach I,$(ISALIST),$(if $(filter-out ERROR,$(ARCHFLAGS_$C_$I)),$I))))
 
+THISHOST := $(shell uname -n)
+
+# BUILDHOST_isa-$ISA is the name of the host where the compilation should take place
+# It defaults to the corresponding BUILD_(sparc|i386)-(32|64)
+# An empty string means "stay on the current host"
+define BUILDHOST
+$(strip
+  $(if $(filter $1,$(ISALIST_sparcv9),
+    $(if $(BUILDHOST_sparc-$(MEMORYMODEL_$1)),
+      $(if $(eq $(BUILDHOST_sparc-$(MEMORYMODEL_$1)),$(THISHOST)),,$(BUILDHOST_sparc-$(MEMORYMODEL_$1))),
+    ),
+    $(if $(filter $1,$(ISALIST_amd64),
+      $(if $(BUILDHOST_i386-$(MEMORYMODEL_$1)),
+        $(if $(eq $(BUILDHOST_i386-$(MEMORYMODEL_$1)),$(THISHOST)),,$(BUILDHOST_i386-$(MEMORYMODEL_$1))),
+      ),
+    ),
+  ),
+)
+endef
+
 # This is the memory model of the currently compiled architecture
 MEMORYMODEL = $(MEMORYMODEL_$(ISA))
 
@@ -648,6 +668,7 @@
 _modenv-modulated:
 	@echo;								\
 	echo "* Modulation $(MODULATION): $(foreach M,$(MODULATORS),$M=$($M))"; \
+	echo "     Build Host = $(call modulation2host)";		\
 	echo "           PATH = $(PATH)";				\
 	echo "PKG_CONFIG_PATH = $(PKG_CONFIG_PATH)";			\
 	echo "         CFLAGS = $(CFLAGS)";				\

Modified: csw/mgar/gar/v2-pbuild/gar.mk
===================================================================
--- csw/mgar/gar/v2-pbuild/gar.mk	2009-08-23 15:03:00 UTC (rev 6087)
+++ csw/mgar/gar/v2-pbuild/gar.mk	2009-08-23 16:13:45 UTC (rev 6088)
@@ -152,17 +152,43 @@
 
 endef
 
+define _modulate_merge
+merge-$(2): $(3)
+merge-$(2): BUILDHOST=$$$$(call modulation2host)
+merge-$(2):
+	echo modulation: $(2)
+	echo vars: $(3)
+	echo ISA: $(ISA)
+	echo BUILDHOST=$(BUILDHOST)
+	echo BUILDHOST=$(call modulation2host)
+	echo BUILDHOST=$$(call modulation2host)
+	echo BUILDHOST=$(eval $(call modulation2host))
+	echo BUILDHOST=$$(eval $(call modulation2host))
+	echo BUILDHOST=$$(eval $$(call modulation2host))
+	echo THISHOST=$(THISHOST)
+	echo "Building modulation on host '$(BUILDHOST)'"
+	$(if $(and $(BUILDHOST),$(filter-out $(THISHOST),$(BUILDHOST))),\
+		ssh $(BUILDHOST) "gmake -C $(CURDIR) MODULATION=$(2) $(3) merge-modulated",\
+		gmake MODULATION=$(2) $(3) merge-modulated\
+	)
+	@# The next line has intentionally been left blank to explicitly terminate this make rule
+
+endef
+
 define _modulate_do
 $(call _modulate_target,extract,$(2),$(4))
 $(call _modulate_target,patch,$(2),$(4))
 $(call _modulate_target,configure,$(2),$(4))
 $(call _modulate_target_nocookie,reset-configure,$(2),$(4))
 $(call _modulate_target,build,$(2),$(4))
+#$(call _modulate_build,,$(2),$(4))
 $(call _modulate_target_nocookie,reset-build,$(2),$(4))
 $(call _modulate_target,test,$(2),$(4))
 $(call _modulate_target,install,$(2),$(4))
+#$(call _modulate_install,,$(2),$(4))
 $(call _modulate_target_nocookie,reset-install,$(2),$(4))
-$(call _modulate_target,merge,$(2),$(4))
+#$(call _modulate_target,merge,$(2),$(4))
+$(call _modulate_merge,,$(2),$(4))
 $(call _modulate_target_nocookie,reset-merge,$(2),$(4))
 $(call _modulate_target_nocookie,clean,$(2),$(4))
 $(call _modulate_target_nocookie,_modenv,$(2),$(4))
@@ -607,13 +633,22 @@
 
 merge-parallel: _PIDFILE=$(WORKROOTDIR)/build-global-$(GARCH)/multitail.pid
 merge-parallel: merge-watch
-	$(_DBG_MERGE)$(foreach M,$(MODULATIONS),$(MAKE) merge-$M >$(WORKROOTDIR)/build-$M/build.log 2>&1 &) wait
-	$(_DBG_MERGE)if [ -f $(_PIDFILE) ]; then kill `cat $(_PIDFILE)` && stty sane; fi
+	$(_DBG_MERGE)trap "kill -9 `cat $(_PIDFILE) $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.pid) 2>/dev/null`;stty sane" INT;\
+		$(foreach M,$(MODULATIONS),($(MAKE) merge-$M >$(WORKROOTDIR)/build-$M/build.log 2>&1; echo $$? >$(WORKROOTDIR)/build-$M/build.ret) & echo $$! >$(WORKROOTDIR)/build-$M/build.pid; ) wait
+	$(_DBG_MERGE)if [ -f $(_PIDFILE) ]; then kill `cat $(_PIDFILE)`; stty sane; fi
+	$(foreach M,$(MODULATIONS),if [ "`cat $(WORKROOTDIR)/build-$M/build.ret`" -ne 0 ]; then \
+		echo "Build error in modulation $M. Please see"; \
+		echo "  $(WORKROOTDIR)/build-$M/build.log"; \
+		echo "for details:"; \
+		echo; \
+		tail -100 $(WORKROOTDIR)/build-$M/build.log; \
+		exit `cat $(WORKROOTDIR)/build-$M/build.ret`; \
+	fi;)
 
 merge-watch: _USEMULTITAIL=$(shell test -x $(MULTITAIL) && test -x $(TTY) && $(TTY) >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo yes; fi)
 merge-watch:
 	$(_DBG_MERGE)$(if $(_USEMULTITAIL),\
-		$(MULTITAIL) --retry-all $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.log) -J & echo $$! > $(WORKROOTDIR)/build-global-$(GARCH)/multitail.pid,\
+		$(MULTITAIL) --retry-all $(foreach M,$(MODULATIONS),$(WORKROOTDIR)/build-$M/build.log) -j & echo $$! > $(WORKROOTDIR)/build-global-$(GARCH)/multitail.pid,\
 		echo "Building all ISAs in parallel. Please see the individual logfiles for details:";$(foreach M,$(MODULATIONS),echo "- $(WORKROOTDIR)/build-$M/build.log";)\
 	)
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list