debian swirl logo

Back to the packages list maven-repo-helper

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/ant.mk

PACKAGE              := $(DEB_SOURCE_PACKAGE)
VERSION              := $(DEB_UPSTREAM_VERSION)
JAVA_HOME            := /usr/lib/jvm/default-java
DEB_JARS             := ant-junit stax-api xml-apis junit4 ant-junit4
DEB_ANT_BUILD_TARGET := package
DEB_ANT_BUILDFILE    := ./debian/build.xml
DEB_ANT_ARGS         := -Dpackage=$(PACKAGE) -Dversion=$(VERSION)
CLASSPATH            := /usr/share/java/ant-junit.jar:/usr/share/java/stax-api.jar:/usr/share/java/stax.jar:/usr/share/java/xml-apis.jar
JAVA_OPTIONS         := -Djavax.xml.stream.XMLOutputFactory=com.bea.xml.stream.XMLOutputFactoryBase

# Generation of man pages
SCRIPTS       := $(wildcard src/main/bin/mh_*)
MAN_PAGES     := $(addprefix debian/.mh/doc/,$(addsuffix .1, $(notdir $(SCRIPTS))))
mh_checkrepo_description = "Checks the Maven repository."
mh_clean_description = "Cleans the temporary files created by the other mh_* utilities."
mh_cleanpom_description = "Cleans a POM file."
mh_genrules_description = "Generates the debian/rules file with Maven support."
mh_install_description = "Installs the POM files and the artifacts into /usr/share/maven-repo."
mh_installjar_description = "Installs a jar into /usr/share/maven-repo."
mh_installpom_description = "Installs a POM file into /usr/share/maven-repo."
mh_installpoms_description = "Installs all POMs for the package into /usr/share/maven-repo."
mh_installsite_description = "Installs site.xml into /usr/share/maven-repo."
mh_linkjar_description = "Creates a link in /usr/share/maven-repo for an existing jar."
mh_linkjars_description = "Creates links in /usr/share/maven-repo for all jars."
mh_linkrepojar_description = "Creates a link from a jar already installed in /usr/share/maven-repo."
mh_lspoms_description = "Generates a list of POMs for the package."
mh_patchpom_description = "Patches one POM file using the Maven dependency rules."
mh_patchpoms_description = "Patches the POM files using the Maven dependency rules."
mh_unpatchpoms_description = "Undo the patches on the POM files."
debian/.mh/mh_lib.sh : src/main/share/mh_lib.sh
		mkdir -p debian/.mh
		cp src/main/share/mh_lib.sh debian/.mh/mh_lib.sh
debian/.mh/mh_% : src/main/bin/mh_% debian/.mh/mh_lib.sh
		mkdir -p debian/.mh
		cp $< $@
		perl -i -pe 's,\. /usr/share/maven-repo-helper/mh_lib.sh,\. debian/.mh/mh_lib.sh,' $@
		chmod +x $@
debian/.mh/doc:
		mkdir -p debian/.mh/doc
	rst2html --title= "Maven Repo Helper tutorial" --stylesheet-path=doc/style.css doc/tutorial.rst debian/.mh/doc/tutorial.html
		cat doc/reference.rst doc/ref/mh_cleanpom.rst doc/ref/mh_installpom.rst doc/ref/mh_installpoms.rst doc/ref/mh_patchpom.rst \
			doc/ref/mh_patchpoms.rst doc/ref/mh_unpatchpoms.rst doc/reference2.rst doc/ref/mh_installjar.rst \
			doc/ref/mh_linkjar.rst doc/ref/mh_linkjars.rst doc/reference3.rst doc/ref/mh_clean.rst doc/ref/mh_installsite.rst \
			doc/ref/mh_install.rst doc/reference4.rst doc/ref/mh_checkrepo.rst doc/reference5.rst \
                doc/ref/dh_with_maven_repo_helper.rst doc/ref/dh_with_jh_maven_repo_helper.rst > debian/.mh/doc/reference.rst
	rst2html --title= "Maven Repo Helper reference" --stylesheet-path=doc/style.css debian/.mh/doc/reference.rst debian/.mh/doc/reference.html
	rst2html --title= "Maven Repo Helper repository specification" --stylesheet-path=doc/style.css doc/repository.rst debian/.mh/doc/repository.html

debian/.mh/doc/mh_%.1 : debian/.mh/mh_% 
		help2man -N -n $(mh_$*_description) -o $@ $<
man-pages: debian/.mh/doc $(MAN_PAGES)

build/$(PACKAGE):: man-pages

binary-post-install/$(PACKAGE)::
		mv build/$(PACKAGE)-$(VERSION).jar build/$(PACKAGE)-debian.jar
		dh_install -p$(PACKAGE) build/$(PACKAGE)-debian.jar /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
		dh_install -p$(PACKAGE) src/main/bin/mh_* /usr/bin
		dh_install -p$(PACKAGE) src/main/share/mh_* /usr/share/$(PACKAGE)
		dh_install -p$(PACKAGE) src/main/share/*.pm /usr/share/perl5/Debian/Debhelper/Sequence
		dh_link -p$(PACKAGE) /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian/$(PACKAGE)-debian.jar /usr/share/java/$(PACKAGE).jar
		dh_installman $(MAN_PAGES)
		mkdir -p debian/.mh
	java -cp build/$(PACKAGE)-debian.jar:$(CLASSPATH) $(JAVA_OPTIONS) org.debian.maven.repo.POMCleaner --no-parent --has-package-version --rules= debian/maven.rules pom.xml \
			debian/.mh/$(PACKAGE)-debian.pom debian/.mh/pom.properties 
	dh_install -p$(PACKAGE) --sourcedir= debian/.mh $(PACKAGE)-debian.pom \
			usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
	dh_install -p$(PACKAGE) --sourcedir= debian/.mh/doc tutorial.html reference.html repository.html usr/share/doc/maven-repo-helper

clean::
		-rm -rf debian/.mh

Builds:

maven-repo-helper
helper tools for including maven metadata in debian packages