Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 813fde02cb
Fetching contributors…

Cannot retrieve contributors at this time

145 lines (122 sloc) 7.411 kb
# Initial Version Copyright (C) 2010 eZuce, Inc., All Rights Reserved.
# Licensed to the User under the LGPL license.
MOCK_CONFIG_DIR = mak/mock
# avoids hit by *some* fedora 14 machines
SRPM_DEFS = --define "_source_filedigest_algorithm md5"
# variable not used here, but can be used in */.sipxecs files
# trick lets you create centos compatible repos from any other distro
CREATEREPO_COMPS = $(SRC)/mak/comps.xml
--configdir=$(MOCK_CONFIG_DIR) \
# Define sipx SRPMS and tarball files. Cannot define RPM files however as one specfile may generate many rpms
$(foreach P,$(sipx) $(app),$(eval $(P)_SRPM = $$(call lowercase,$(P))-$(PACKAGE_VERSION)-$$(PROJ_REVISION).src.rpm))
$(foreach P,$(sipx) $(app),$(eval $(P)_TAR = $(P)/$$(call lowercase,$(P))-$(PACKAGE_VERSION).tar.gz))
# pull in dependency make fragments
include $(SRC)/*/
# Allows to target other distros other than the default
help-values.{3} = Any of the available distros identifiers. Complete list: all @ALL_DISTROS@
help-values.{4} = Any rpm related target. Partial list : autoreconf dist rpm srpm rpm-check
help-values.{5} = Any repo related target. Partial list : repo repo-clean repo-chroot-init repo-check repo-create and more...
help.distro.{3}.{1|2}.{4} = Build or operate on a package or set of packages for another distro other than $(DISTRO).
help.distro.{3}.{5} = Build or operate on repository for another distro other than $(DISTRO).
distro.% : SUB_DISTRO=$(word 2,$(subst ., ,$@))
distro.all.% :
# split into separate bash commands so each command gets separate make environment.
# Use command && command && true to ensure a failure in one aborts the build
$(foreach D,@ALL_DISTROS@,$(MAKE) distro.$(D).$* &&) true
# NOTE: 'eval' because 'make a b' when makefile is
# a.% b.% :; x
# only makes x once. usually not what you want and not what we want here
$(foreach D,@ALL_DISTROS@, $(eval distro.$(D).% :; $$(MAKE) $$* $$(SUBMAKE_VARS)))
help.{1|2}.rpm = Build RPMs, you must have mock installed. See Experimental call to build rpms. See \
$(foreach T,$(all),$(T).rpm) : %.rpm : %.autoreconf %.configure %.dist %.srpm %.rpm-by-mock;
CopySourceFile = \
if [ -f $1 ]; then \
cp $1 $2; \
else \
if [ ! -f @DOWNLOAD_LIB_CACHE@/$(notdir $1) ]; then \
curl -f -o @DOWNLOAD_LIB_CACHE@/$(notdir $1) @DOWNLOAD_LIB_URL@/$(notdir $1); \
fi ;\
cp @DOWNLOAD_LIB_CACHE@/$(notdir $1) $2; \
fi; \
help.{1|2}.srpm = Called automatically as part of rpm process after srpm target. Uses rpmbuild command after dist target
%.srpm :
test -d $(MOCK_SRPM_DIR) || mkdir -p $(MOCK_SRPM_DIR)
if [ -n "$($(PROJ)_SPEC)" ]; then \
$(foreach S,$($(PROJ)_SOURCES),$(call CopySourceFile,$(S),@RPMBUILD_TOPDIR@/SOURCES)) \
rpmbuild -bs $(SRPM_DEFS) $($(PROJ)_SRPM_DEFS) --nodeps $($(PROJ)_SPEC); \
elif [ -n "$($(PROJ)_TAR)" ]; then \
rpmbuild -ts $(SRPM_DEFS) $($(PROJ)_SRPM_DEFS) --nodeps $($(PROJ)_TAR); \
else \
$(call CopySourceFile,$($(PROJ)_SRPM),@RPMBUILD_TOPDIR@/SRPMS/$($(PROJ)_SRPM)) \
help.{1|2}.rpm-by-mock = Called automatically as part of rpm process after srpm target. Uses mock program to build rpm
%.rpm-by-mock : repo-webserver
mock $(MOCK_OPTS) \
--no-clean \
--no-cleanup-after \
--rebuild \
find $(MOCK_RESULTS_DIR) -name '*.src.rpm' -exec rm {} \;
# generate repo AFTER build because then it's usable as a repo to feed to next build or other systems.
repo-comps : $(SRC)/mak/comps.xml
help.repo-chroot-init = Clear mock chroot for $(DISTRO). Requied before first build and useful when you suspect caching is the result of a build error.
repo-chroot-init : repo-create repo-webserver repo-comps repo-comps
mock $(MOCK_OPTS) --scrub=all
test -d $(MOCK_RESULTS_DIR) || mkdir -p $(MOCK_RESULTS_DIR)
mock $(MOCK_OPTS) --init
# these files get large, good time to reset them.
find $(MOCK_RESULTS_DIR) -name '*.log' -exec rm {} \;
help.{1|2}.check-rpm = Install the project rpm in the mock environment to test install. This does not install all rpms generated by a project, just the main one. You can install then pretty easily though with command 'mock -r $(MOCK_TARGET_PLATFORM) --install package-name'
%.check-rpm : repo-webserver
mock $(MOCK_OPTS) --install $(proj)
help.repo-clean = Delete all RPMs in $(MOCK_RESULTS_DIR) to ensure fresh build. Build knows how to delete previous build results but only if new RPM results exists.
repo-clean :
test ! -d $(MOCK_RESULTS_DIR) || \
find $(MOCK_RESULTS_DIR) -maxdepth 1 -name '*.rpm' -exec rm {} \;
# points a webserver at $(MOCK_RESULTS_DIR) with no caching headers to feed the results of build back into the
# chroot'ed system. future: explore mounting $(MOCK_RESULTS_DIR) from the chroot system. Possibly there is
# a yum plugin .
# Touching everyfile because squid download proxy will deliver cached files from localhost even when cache live time is zero
# if it has a file time that is newer then the file system. When building rpms from 2 different locations on the sames system
# this is problematic
repo-webserver :
-killall thttpd
find $(MOCK_RESULTS_DIR) -type f -exec touch {} \;
/usr/sbin/thttpd -d @RPM_DIST_DIR@ -p 40100 -M 0
help.repo-src = Assemble source rpms into @RPM_DIST_DIR@/$(DISTRO_RESULTS_DIR)/source
repo-src : repo-comps
for f in $(shell $(SRC)/mak/list-obsolete-rpms $(MOCK_SRPM_DIR)); do rm $$f; done
cd $(MOCK_SRPM_DIR); createrepo $(CREATEREPO_OPTS) .
help.repo-check = Installs sipXecs in chroot. Tip, run repo-chroot-init first for more thourugh test of all dependencies.
repo-check : repo-webserver
mock $(MOCK_OPTS) --install sipxecs
help.repo-remove-dups=If you have built RPMs multiple times between git updates, and therefore have older versions of a package, this will remove all older copies.
for f in $(shell $(SRC)/mak/list-obsolete-rpms $(MOCK_RESULTS_DIR)); do rm $$f; done
help.repo-create = run createrepo in $(MOCK_RESULTS_DIR)
repo-create: repo-comps
test -d $(MOCK_RESULTS_DIR) || mkdir -p $(MOCK_RESULTS_DIR)
help.repo-update = If you rebuild local rpms, repo will not automatically replace previously installed versions. This call will force up update to all packages at once.
repo-update :
mock $(MOCK_OPTS) --scrub=yum-cache
mock $(MOCK_OPTS) --update
help.repo = Prepares repository for $(DISTRO) for publishing or re-distributing in ISO by removing extra rpms and moving source rpms to separate directory.
repo: repo-src repo-remove-dups repo-create;
Jump to Line
Something went wrong with that request. Please try again.