summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build_all.mk166
-rwxr-xr-xbuild_all.sh100
2 files changed, 0 insertions, 266 deletions
diff --git a/build_all.mk b/build_all.mk
deleted file mode 100644
index 9f213d0..0000000
--- a/build_all.mk
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/make
-# -- Makefile to build all ptxconfigs
-# -- Carsten Schlote <c.schlote@konzeptpark.de>
-
-# -- start this fragment with 'make -f build_all.mk' or the supplied wrapper script!
-SHELL=/bin/bash
-
-# -- Defines and Lists --------------------------------------------------------
-
-builddate = $(shell date +%y%m%d-%H%M)
-subversionrev = $(strip $(shell svnversion))
-
-configdir = ptxconfigs
-configfiles = $(wildcard $(configdir)/*.ptxconfig) $(wildcard $(configdir)/*/*.ptxconfig)
-configs = $(basename $(notdir $(configfiles)))
-
-gstatedir = gstate
-suffix_buildtime = .buildtag
-suffix_buildstatus = .status
-suffix_buildrevision = .svnrev
-gstatefiles = $(addprefix $(gstatedir)/,$(addsuffix $(suffix_buildtime),$(configs)))
-
-instdirs = $(foreach i,$(configfiles),$(shell . $i && echo $${PTXCONF_SYSROOT_CROSS} ))
-
-distdir = dists
-suffix_distarc = .tar.bz2
-distfiles = $(addprefix $(distdir)/,$(addsuffix $(suffix_distarc),$(configs)))
-
-statuspagefile = $(gstatedir)/OSELAS-BuildAll-Status.txt
-
-# -- Macros -------------------------------------------------------------------
-
-define PrintHeaderMsg
- @echo -en "\n\n---------------------------------------------------------------------\n"
- @echo -en "-- $(1)"
- @echo -en "\n---------------------------------------------------------------------\n\n"
-endef
-
-define UpdateStatusPage
- @echo -e "# OSELAS Toolchain Build All Status " > $(statuspagefile).tmp
- @echo -en "# Last build run was $(if $(shell cat $(gstatedir)/lastbuilddate),$(shell cat $(gstatedir)/lastbuilddate),$(builddate)) - " >> $(statuspagefile).tmp
- @echo -e "$(if $(shell cat $(gstatedir)/laststatus),$(shell cat $(gstatedir)/laststatus),$(builddate)) on SVN $(subversionrev)" >> $(statuspagefile).tmp
- @echo -e "# Status page updated : `date` " >> $(statuspagefile).tmp
- @if [ -e build_all.lock ]; then bldpid=$$(cat build_all.lock); if [ -n "$$bldpid" ]; then echo "# Build process running ($$bldpid)"; fi; fi >> $(statuspagefile).tmp
- @echo -e "# Build date\tSVNRev\tStatus\tToolchain" >> $(statuspagefile).tmp
- @for i in $(configs); do \
- if test -e $(gstatedir)/$$i$(suffix_buildtime); then cat $(gstatedir)/$$i$(suffix_buildtime); else echo -n "000000-0000"; fi; \
- echo -en "\t"; \
- if test -e $(gstatedir)/$$i$(suffix_buildrevision); then cat $(gstatedir)/$$i$(suffix_buildrevision); else echo -n "n.a."; fi; \
- echo -en "\t"; \
- if test -e $(gstatedir)/$$i$(suffix_buildstatus); then cat $(gstatedir)/$$i$(suffix_buildstatus); else echo -n "n.a."; fi; \
- echo -en "\t"; \
- echo "$$i"; \
- done >> $(statuspagefile).tmp
- @mv $(statuspagefile).tmp $(statuspagefile)
-endef
-
-define SetupInstallDirs
- @dirs=""; for i in $(instdirs); do \
- if [ ! -d "$$i" ]; then \
- echo "Creating install dir : $$i"; \
- sudo mkdir -p $$i; \
- sudo chown $(USER) $$i; \
- fi; \
- done
-endef
-
-define RemoveInstallDirs
- @dirs=""; for i in $(instdirs); do \
- if [ -d "$$i" ]; then \
- echo "Remove install dir contents : $$i"; \
- rm -rf $$i/*; \
- else \
- echo "Skipping non-existing install dir : $$i"; \
- fi; \
- done
-endef
-
-define BuildChain
- $(call PrintHeaderMsg, Rebuild toolchain $(1) )
- ptxdist distclean
- sed -e "s:\(PTXCONF_PREFIX\)=\"\(.*\)\":\1=\"\$\${PWD}/inst\2\":" $$< > selected_ptxconfig
-
- @instdir=source ./selected_ptxconfig && echo $${PTXCONF_SYSROOT_CROSS}; \
- if [ -d $$instdir ]; then \
- echo "Removing existing toolchain files in $$instdir"; echo rm -rf "$$instdir/*"; \
- fi;
-
-# -- Intentionally fix make target, we don't want to rebuild broken chains over and oover again
-# -- Update status output
- echo -n "$(builddate)" > $$@
- echo -n "?????" > $(gstatedir)/$(1)$(suffix_buildstatus)
- echo -n "$(subversionrev)" > $(gstatedir)/$(1)$(suffix_buildrevision)
-
- @echo "ptxdist go" ; \
- if ptxdist go; then echo -n "Success" > $(gstatedir)/$(1)$(suffix_buildstatus); \
- else echo -n "Failed" > $(gstatedir)/$(1)$(suffix_buildstatus); fi
-
- $(call PrintHeaderMsg, Saving logs for toolchain $(1))
- @if test -e logfile; then cp -v logfile $(distdir)/$(1)-logfile; else echo "No logfile?"; fi
- @if test -e deptree.ps; then cp -v deptree.ps $(distdir)/$(1)-deptree.ps; else echo "No deptree.ps?"; fi
-
- $(call PrintHeaderMsg, Create archive for toolchain $(1))
- @if test -L state/toolchain-install-dir; then \
- echo tar cjf $(distdir)/$(1).tar.bz2 -C `readlink state/toolchain-install-dir`; \
- else \
- echo "No symbolic link to install dir found - no archive created."; \
- fi
-endef
-
-
-# -- Targets ------------------------------------------------------------------
-
-.PHONY : all dist mkgstatedir mkdistdir updatestatpage updatestatpage_forced mkblddatetag clean distclean
-
-all : updatestatpage
-
-dist : $(distfiles)
-
-mkgstatedir :
- @mkdir -p $(gstatedir)
-
-mkdistdir :
- @mkdir -p $(distdir)
-
-mkinstdirs :
- $(call SetupInstallDirs)
-
-rminstdirs :
- $(call RemoveInstallDirs)
-
-$(gstatedir)/laststatus : $(gstatefiles) | mkblddatetag mkinstdirs mkgstatedir
- @echo "Toolchain Status Changed - Status Page updated"
- @date +%y%m%d-%H%M > $@
- $(call UpdateStatusPage)
-
-updatestatpage: $(gstatedir)/laststatus
-
-updatestatpage_forced: mkgstatedir
- $(call UpdateStatusPage)
-
-$(gstatedir)/lastbuilddate : $(configfiles) | mkgstatedir
- @echo -n "$(builddate)" > $(gstatedir)/lastbuilddate
-
-mkblddatetag: $(gstatedir)/lastbuilddate
-
-clean :
- -rm -rf $(gstatedir)
-
-distclean : clean
- -rm -rf $(distdir)
-
-# -- Rules --------------------------------------------------------------------
-
-define BuildChainRules
-$(gstatedir)/$(1).buildtag : $(configdir)/$(1).ptxconfig | mkgstatedir mkdistdir updatestatpage_forced
- $(call BuildChain,$(1))
-
-$(distdir)/$(1)$(suffix_distarc) : $(gstatedir)/$(1).buildtag
- @echo "BROKEN FIXME - needs some way to derive install location from ptxconfig"
-
-build_$(1) : $(gstatedir)/$(1).buildtag updatestatpage
-
-endef
-
-$(foreach CFG,$(configs),$(eval $(call BuildChainRules,$(CFG))))
diff --git a/build_all.sh b/build_all.sh
deleted file mode 100755
index e4cff38..0000000
--- a/build_all.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/bash
-# This is some wrapper to call the makefile fragment, which builds all toolchains
-# - might be a good place for common preparations and final postprocessing
-
-# Add some similiar line to your crontab (e.g. crontab -e)
-# 0,5,10,15,20,25,30,35,40,45,50,55 * * * * [ -f /home/csc/src/OSELAS.Toolchain-trunk/build_all.sh ] && \
-# ( cd /home/csc/src/OSELAS.Toolchain-trunk/ && ISCRON=yes bash build_all.sh )
-#
-# Modify sudoers file to allow mkdir and chown to be called without password,
-# unattented builds are possible for new configs
-
-builddate=`date +%y%m%d-%H%M`
-buildlogfile=build_all_logs/build_all.log-$builddate
-lockfile=build_all.lock
-
-set -e
-
-# -- Get options ---------------------------------------------------------------
-
-while getopts ":Bb:CIRuh" Option
-do
- case $Option in
- B ) makeoptions=-B ;;
- b ) maketargets=build_$OPTARG ;;
- I ) maketargets=mkinstdirs ;;
- R ) maketargets=rminstdirs ;;
- C ) make -f build_all.mk distclean; exit 0; ;;
- u ) make -f build_all.mk updatestatpage_forced; exit 0; ;;
- h )
- echo " -B Unconditionally build all";
- echo " -b config Build single config (without ptxconfig suffix)";
- echo " -I Create all install dirs at once";
- echo " -R Clean all install dirs at once";
- echo " -C Distclean autoclean system";
- echo " -u Update status page";
- ;;
- esac
-done
-shift $(($OPTIND - 1))
-
-#echo $makeoptions $maketargets
-#exit 0
-
-if [ -z "${ISCRON}" ]; then set -x;
-else
- # If ISCRON is not zero, setup some paths for ptxdist and other tools
- export PATH=/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin:$PATH
-fi
-
-# -- Get lockfile and process builds -------------------------------------------
-
-if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null;
-then
- trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
-
- # -- Update current SVN workcopy
- svn update -q
-
- # -- Start make, which check dependencies on the ptxconfig files stored in gstate
- # -- For each updated ptxconfig the toolchain is recompiled
- # -- Finaly a status file suitable for parsing is generated and stored in
- # -- gstate/OSELAS-BuildAll-Status.txt
- # -- The make process is started with via 'nice' to avoid high cpu-load on compile host
- mkdir -p build_all_logs
- if [ -n "${ISCRON}" ]; then
- nice -n 5 make -f build_all.mk $makeoptions $maketargets > $buildlogfile
- else
- nice -n 5 make -f build_all.mk $makeoptions $maketargets
- fi
-
- # -- Delete empty logfiles
- if [ -e $buildlogfile ]; then if test -z "$(cat $buildlogfile)"; then rm $buildlogfile; fi; fi
-
- # -- Remove lockfile
- rm -f $lockfile
- trap - INT TERM EXIT
-#else
- # -- Normally don't output things - causes mail flooding with cron. Debug stuff.
- #echo "Build script running - lockfile \"$lockfile\" held by process $(cat $lockfile)"
-fi
-
-# -- Dump status file info, save to be called outside critical section aboce
-make -f build_all.mk updatestatpage_forced
-
-
-# -- ToDo ---------------------------------------------------------------------
-# T=testing, X=done
-#
-# [X] Fix creation of new install dirs - create a script to setup them all at once
-# (sudo hack for mkdir and NOPASSWD: - seems to work, see man sudoers)
-# [ ] Checkout a new working copy of trunk for each chain, and do building in parallel
-# [ ] Create a nice HTML output for the status showing the actual status of each chain
-# [ ] Add checks to ensure consitency of ptxconfig files and install locations -
-# apply fixup-ptxconfigs.sh?
-# [X] Add code to create all install directory at once - so you have to enter the
-# sudo password only once, when this script started the first time.
-# [ ] Remove link to installation directory from cross-toolchain.make?
-# We need some way to determine the installation path from outside ptxdist...
-# [X] Add lock file for cron triggered operation
-