gunnar: server/make-helper openpkg-patched.mk, NONE, 1.1 package.mk, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Thu Dec 10 00:08:09 CET 2009


Author: gunnar

Update of /kolabrepository/server/make-helper
In directory doto:/tmp/cvs-serv21324/make-helper

Added Files:
	openpkg-patched.mk package.mk 
Log Message:
Reduce a first Makefile to its essential information while moving the functions duplicated in many of the other makefiles into a central helper that can be included. While this makes it less obvious how a single makefile works we only have three or four different package build types. Maintaining these at only one location rather than at twenty different ones seems useful. Especially if we should ever consider switching our base distribution.

--- NEW FILE: openpkg-patched.mk ---
# Target for preparing the source area and building the package
$(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec: Makefile $(EXTRA) $(KOLABRPMSRC)/$(PACKAGE)/$(SOURCE_0)
	cp $(EXTRA) $(KOLABRPMSRC)/$(PACKAGE)

# Target for fetching the original openpkg package
$(PACKAGE)-$(DOWNLOAD_VERSION)-$(OPENPKG_RELEASE).src.rpm:
	wget -c $(OPENPKGURI)/$(PACKAGE)-$(DOWNLOAD_VERSION)-$(OPENPKG_RELEASE).src.rpm

# Target for the src rpm directory.
$(KOLABRPMSRC)/$(PACKAGE): $(PACKAGE)-$(DOWNLOAD_VERSION)-$(OPENPKG_RELEASE).src.rpm
	$(RPM) -ihv $(PACKAGE)-$(DOWNLOAD_VERSION)-$(OPENPKG_RELEASE).src.rpm

# Target for patching the spec file
$(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec.patched: $(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec
	cd $(KOLABRPMSRC)/$(PACKAGE) && patch < kolab.patch
	touch $(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec.patched

# Target for building the source package
$(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm: $(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec.patched
	cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -bs $(PACKAGE).spec

# Target for building the binary package
$(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm: $(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE).spec.patched
	cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -ba $(PACKAGE).spec $(BUILD_OPTIONS)


--- NEW FILE: package.mk ---
# Default target to generate the source rpm package
.PHONY: all
all: $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm

# Target for placing the source rpm in the staging area. This target
# includes building the binary package which is an additional check for
# the final release. Thus it is the default target.
.PHONY: dist
dist: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm all
	test -d $(STAGING) || mkdir $(STAGING)
	cp $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm $(STAGING)

# Target for placing the source rpm in the staging area. This is the soft
# variant that is quicker and omits the binary package.
.PHONY: sdist
sdist: all
	test -d $(STAGING) || mkdir $(STAGING)
	cp $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm $(STAGING)

# Target for installing the binary rpm package in our current Kolab
# server installation
.PHONY: install
install: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
	$(RPM) -Uhv --force $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm

# Target for cleaning up the files that can be generated with this Makefile
.PHONY: clean
clean:
	rm -rf $(KOLABRPMSRC)/$(PACKAGE)
	rm -rf $(KOLABRPMTMP)/$(PACKAGE)*
	rm -f $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
	rm -f $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
	rm -f $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
	rm -f *.tar.gz
	rm -f *~
	rm -f package.patch

# Target for fetching the source rpm into the current directory
$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
	cp -p $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm .

# Target for the source file in the src rpm directory.
$(KOLABRPMSRC)/$(PACKAGE)/$(SOURCE_0): $(KOLABRPMSRC)/$(PACKAGE) $(SOURCE_0)
	cp $(SOURCE_0) $(KOLABRPMSRC)/$(PACKAGE)/

# Target for retrieving the source package
$(SOURCE_0):
	wget -c "$(SOURCE_URL)/$(SOURCE_0)"

# Prepare the patch for the package.
package.patch: $(PATCHES)
	echo > package.patch
	for PATCH in $(PATCHES);        \
	do                              \
	  cat $$PATCH >> package.patch; \
	done





More information about the commits mailing list