#################### (fedora) distributions
#
# (*) as of nov. 2007, myplc-devel is deprecated
-# (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-fc6-devel.lst)
+# (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-devel.lst)
# (*) the build uses the current fedora version as a target for the produced images
# (*) so you simply need to create a fedora 8 build image for building fedora-8 images
#
# the complete path where this module lies;
# you can specify the trunk or a given tag with this variable
#
-# OR if the module is managed under cvs
+# OR if the module is managed under cvs (will be obsoleted)
#
# (*) module-CVSROOT
# (*) module-TAG
#all : codebases
#all : rpms
#all : srpms
-# mention $(ALL) here rather than rpms
-# this is because the inter-package dependencies are expressed like
-# util-vserver: util-python
-all: $(ALL)
+all: rpms
all: srpms
endif
endif
define target_spec
$($(1)_specpath):
mkdir -p SPECS
- echo "%define pldistro $(PLDISTRO)" > $($(1)_specpath)
+ (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $($(1)_specpath)
+ echo "%define distroname $(DISTRO)" >> $($(1)_specpath)
+ echo "%define distrorelease $(RELEASE)" >> $($(1)_specpath)
+ echo "%define pldistro $(PLDISTRO)" >> $($(1)_specpath)
$(if $($(1)_hasdate),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1)_specpath),)
+ echo "# included from codebase specfile" >> $($(1)_specpath)
$(if $($(1)-SPECVARS), \
$(foreach line,$($(1)-SPECVARS), \
echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1)_specpath) ;))
$(CC) -g -Wall $< -o $@ -lrpm -lrpmbuild
# Base rpmbuild in the current directory
-export HOME := $(shell pwd)
+# trying a longer topdir
+# http://forums.fedoraforum.org/showthread.php?t=39625
+# and more specifically post#6
+# hard-wired for now
+export HOME := /building
.rpmmacros:
- echo "%_topdir $(HOME)" > $@
+ rm -f /building ; ln -s /build /building
+ rm -f $@
+ echo "%_topdir $(HOME)" >> $@
echo "%_tmppath $(HOME)/tmp" >> $@
+ echo "%_netsharedpath /proc:/dev/pts" >> $@
+ echo "%_install_langs C:de:en:es:fr" >> $@
### run spec2make on the spec file and include the result
# usage: spec2make package
SOURCES/%.tgz: SOURCES/%
tar chpzf $@ -C SOURCES $*
+##
+URLS/%: url=$(subst @colon@,:,$(subst @slash@,/,$(notdir $@)))
+URLS/%: basename=$(notdir $(url))
+URLS/%:
+ echo curl $(url) -o SOURCES/$(basename)
+ touch $@
+
### the directory SOURCES/<package>-<version> is made
# with a copy -rl from CODEBASES/<package>
# the former is $(package-SOURCE) and the latter is $(package-CODEBASE)
### rpmbuild invokation
ALLRPMS:=$(foreach package,$(ALL),$($(package)-RPM))
-# same as above, mention $(ALL) and not $(ALLRPMS)
-rpms: $(ALL)
+rpms: $(ALLRPMS)
@echo $(words $(ALLRPMS)) binary rpms OK
.PHONY: rpms
@echo $(words $(ALLSRPMS)) source rpms OK
.PHONY: srpms
-# usage: build_source_rpm package
+# usage: target_source_rpm package
+# select upon the package name, whether it contains srpm or not
define target_source_rpm
-$($(1)-SRPM): $($(1)_specpath) $($(1)-TARBALL) .rpmmacros
+ifeq "$(subst srpm,,$(1))" "$(1)"
+$($(1)-SRPM): $($(1)_specpath) .rpmmacros $($(1)-TARBALL)
mkdir -p BUILD SRPMS tmp
@(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) " ; date)
$(if $($(1)-RPMBUILD),\
$($(1)-RPMBUILD) $($(1)-RPMFLAGS) -bs $($(1)_specpath),
$(RPMBUILD) $($(1)-RPMFLAGS) -bs $($(1)_specpath))
@(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
+else
+$($(1)-SRPM): $($(1)_specpath) .rpmmacros $($(1)-CODEBASE)
+ mkdir -p BUILD SRPMS tmp
+ @(echo -n "XXXXXXXXXXXXXXX -- BEG SRPM $(1) (using make srpm) " ; date)
+ make -C $($(1)-CODEBASE) srpm && \
+ rm -f SRPMS/$(notdir $($(1)-SRPM)) && \
+ ln $($(1)-CODEBASE)/$(notdir $($(1)-SRPM)) SRPMS/$(notdir $($(1)-SRPM))
+ @(echo -n "XXXXXXXXXXXXXXX -- END SRPM $(1) " ; date)
+endif
endef
$(foreach package,$(ALL),$(eval $(call target_source_rpm,$(package))))