debian swirl logo

Back to the packages list lucene2

#!/usr/bin/make -f
# -*- makefile -*-

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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_INSTALL_CHANGELOGS_liblucene2-java := CHANGES.txt

JAVA_HOME := /usr/lib/jvm/default-java

DEB_ANT_BUILD_TARGET := javacc jar-core build-contrib war-demo javadocs
DEB_ANT_CHECK_TARGET := test
DEB_ANT_CLEAN_TARGET := clean clean-javacc

# Needed for running javacc and the unit tests
DEB_JARS = ant-nodeps ant-contrib ant-junit junit

# Upstream Lucene name
UPSTREAM_VERSION := $(shell echo $(DEB_UPSTREAM_VERSION) | grep -o "^[^+]*" | sed -e "s/~/-/" )
UPSTREAM_BASENAME := lucene-$(UPSTREAM_VERSION)
CHANGESFILE = ../lucene2_$(DEB_VERSION)_$(DEB_BUILD_ARCH).changes

clean::
	# 'ant test' in contrib/db leaves some stuff behind...
		rm -rf $(CURDIR)/contrib/db/bdb/index
	# Same for 'ant test' in contrib/benchmark
		rm -rf $(CURDIR)/contrib/benchmark/temp/*
		rm -rf $(CURDIR)/contrib/benchmark/work/index
		rm -rf $(CURDIR)/contrib/benchmark/work/reuters
		rm -rf $(CURDIR)/contrib/benchmark/work/reuters-out
	# Tags for backward compatibility testing
		rm -rf $(CURDIR)/tags
	# remove keyring, since it is a binary file
		rm -f debian/lucene-keyring.gpg
		rm -f debian/KEYS
	# remove all javacc-generated files from src and contrib, except those
	# that are not regenerated properly 
	# Now done in build.xml target clean-javacc
	#fgrep -Rl "Generated By:JavaCC:" $(CURDIR)/src/ $(CURDIR)/contrib/ | grep -v analysis/standard/ParseException.java\\\|precedence\\\|surround | xargs rm -f

install/liblucene2-java::
	# Install the libraries into the liblucene2-java package
		
	# Install the core library
		install -m 0644 build/lucene-core-$(UPSTREAM_VERSION).jar $(CURDIR)/debian/liblucene2-java/usr/share/java
		ln -s lucene-core-$(UPSTREAM_VERSION).jar $(CURDIR)/debian/liblucene2-java/usr/share/java/lucene-core.jar
		
	# Install contrib libraries
	CONTRIB_JARS= `find build/contrib/ -name \*-$(UPSTREAM_VERSION).jar` ; \
		for jarfile in $$CONTRIB_JARS; do \
		    install -m 0644 "$$jarfile" $(CURDIR)/debian/liblucene2-java/usr/share/java ; \
	    CONTRIB= `echo $$jarfile | sed "s/.*\\/lucene-\\([-a-z]*\\)-.*\\.jar/\\1/"` ; \
		    ln -s lucene-$$CONTRIB-$(UPSTREAM_VERSION).jar $(CURDIR)/debian/liblucene2-java/usr/share/java/lucene-$$CONTRIB.jar ; \
		done
		install -d $(CURDIR)/debian/liblucene2-java/usr/lib/liblucene2-java
		install contrib/lucli/run.sh $(CURDIR)/debian/liblucene2-java/usr/lib/liblucene2-java/lucli
		gzip $(CURDIR)/debian/liblucene2-java/usr/lib/liblucene2-java/lucli.1.gz

install/liblucene2-java-doc::
	# Install the documentation into the liblucene2-java-doc package
		
		mkdir -p  $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/
		cp -r docs $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/
		cp -r build/docs/* $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/docs/
	# Remove empty directories
		rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/docs/skin/css
		rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/docs/skin/scripts
		rmdir --ignore-fail-on-non-empty $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/docs/skin/translations
	# Remove unused embedded prototype library
		rm -f $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/docs/skin/prototype.js
		install -d $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/demo
		install -m 644 build/lucene-demos-$(UPSTREAM_VERSION).jar $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/demo/
		install -m 644 build/luceneweb.war $(CURDIR)/debian/liblucene2-java-doc/usr/share/doc/liblucene2-java-doc/demo/

remove-source:
		rm -f build.xml
		rm -f common-build.xml
		rm -f *.txt
		rm -f *stamp
		rm -f *pom.xml.template
		rm -rf debian/patched
		rm -rf build dist docs example lib src contrib

restore-from-source: remove-source
		tar xzf ../lucene2_$(DEB_UPSTREAM_VERSION).orig.tar.gz
		mv $(UPSTREAM_BASENAME)/* .
		rmdir $(UPSTREAM_BASENAME)

get-orig-source:
		debian/get-orig-source.sh

check:
		lintian -i $(CHANGESFILE)
	zgrep "^---" ../lucene2_$(DEB_VERSION).diff.gz | grep -v debian ; [ $$? != 0 ]
		( for p in $(DEB_ALL_PACKAGES); do \
		      dpkg --contents ../$${p}_$(DEB_VERSION)_all.deb ; \
		  done ) | less

upload:
		dupload -t mentors $(CHANGESFILE)

.PHONY: patched build clean binary-indep binary-arch binary install install-indep install-arch configure

Builds:

liblucene2-java-doc
documentation for lucene
liblucene2-java
full-text search engine library for java(tm)