~ubuntu-branches/ubuntu/saucy/dblatex/saucy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/make -f

# Use the debhelper command sequencer.
%:
	dh $@ --with python2

############################# Variable definitions #############################

# Some targets (e.g. get-orig-source) are not required to be started from the
# package's top level directory.
# Nevertheless they need to know the package's version.
# The version gets determined at runtime by dpkg-parsechangelog using the
# package's changefile.
# The changefile is located in this file's directory.
# Thus this file's directory needs to be determined, which will only work
# reliably when the make variable MAKEFILE_LIST contains exactly one value.
ifneq ($(words $(MAKEFILE_LIST)),1)
    $(error Unable to determine location of rules)
endif

debiandir := $(realpath $(dir $(strip $(MAKEFILE_LIST))))

PKG_VERS     := $(shell dpkg-parsechangelog -l$(debiandir)/changelog \
                | grep ^Version: | cut -d' ' -f2 | cut -d- -f1)
PKG_UPSTREAM := dblatex-$(PKG_VERS).tar.bz2
PKG_DEBIAN   := dblatex_$(PKG_VERS).orig.tar.bz2
DOWNLOAD_URL := http://prdownloads.sourceforge.net/dblatex

################################# dh overrides #################################

override_dh_clean:
	rm --force --recursive docs/examples/
	if [ -d docs/html ]; then mv docs/html docs/xhtml; fi
	rm --force --recursive dblatex.egg-info/
	dh_clean

override_dh_auto_build:
        # Nothing to be compiled

override_dh_auto_install:
        # Call upstream setup.py with additional parameters:
        # Choose an install layout suitable for Debian
	dh_auto_install -- --install-layout=deb

override_dh_installchangelogs:
	dh_installchangelogs docs/changes/changes.txt

override_dh_installdocs:
        # Don't follow upstream directory name change from docs/html/ to
        # docs/xhtml/, but keep well known name /usr/share/doc/dblatex/html/,
        # that is don't break existing bookmarks.
	if [ -d docs/xhtml ]; then mv docs/xhtml docs/html; fi
        # Prepare installation of dblatex examples.
	tar --directory=docs --extract --bzip2 \
            --file=examples/examples-src.tar.bz2
	rm --force docs/examples/COPYRIGHT
        # Finally install all documentation.
	dh_installdocs docs/manual.pdf docs/release-notes.pdf \
                       docs/html/ docs/examples/

############################## Additional targets ##############################

get-orig-source:
	wget $(DOWNLOAD_URL)/$(PKG_UPSTREAM)?download \
             --output-document=$(PKG_DEBIAN)
	wget $(DOWNLOAD_URL)/dblatex-examples.tar.bz2 \
             --output-document=dblatex_$(PKG_VERS).orig-examples.tar.bz2

.PHONY: get-orig-source