aboutsummaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 616e79291451d32db4eb01fc5cf79d978f814d7e (plain) (blame)
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
#!/usr/bin/make -f
# -*- makefile -*-

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

UVERSION := $(shell dpkg-parsechangelog | sed -n -e's/^Version: \(.*\)-[^-]\+/\1/p' | cut -d ":" -f 2)
PACKAGE_NAME := $(shell dpkg-parsechangelog | sed -n -e's/^Source: \(.*\)\+/\1/p')
export PYBUILD_NAME=$(PACKAGE_NAME)
export ROOT_PATH=$(CURDIR)

%:
	dh $@ --with python2,bash-completion --buildsystem=pybuild

override_dh_clean:
	dh_clean
	rm -rf cache
	rm -f .doit.db
	rm -f _nikola_zsh
	rm -f _nikola_bash
	rm -rf debian/dpackaging_site
	rm -f debian/source/include-binaries

override_dh_bash-completion:
	./debian/nikola.sh init -q debian/dpackaging_site
	cd debian/dpackaging_site/ && ../nikola.sh tabcompletion --shell bash --hardcode-tasks > ../../_nikola_bash
	cd debian/dpackaging_site/ && ../nikola.sh tabcompletion --shell zsh --hardcode-tasks > ../../_nikola_zsh
	dh_bash-completion
	cp _nikola_zsh debian/nikola/usr/share/zsh/functions/Completion/Linux/_nikola

override_dh_auto_install:
	dh_auto_install
	# Remove copy of licenses
	find debian/nikola/usr/lib -name "MIT-LICENSE.txt" -type f -exec rm {} +
	find debian/nikola -name "LICENSE.txt" -type f -exec rm {} +
	# Drop wrong permission
	find debian/nikola/usr/lib -perm /a+x -type f -exec chmod -x {} +

override_dh_installdocs:
	rst2html docs/manual.txt debian/nikola/usr/share/doc/nikola/manual.html
	rst2html docs/theming.txt debian/nikola/usr/share/doc/nikola/theming.html
	rst2html docs/creating-a-theme.txt debian/nikola/usr/share/doc/nikola/creating-a-theme.html
	rst2html docs/extending.txt debian/nikola/usr/share/doc/nikola/extending.html
	dh_installdocs

override_dh_auto_test:

get-orig-source:
	@if [ ! -d "debian" ] ; then \
		echo 'Run this from the top directory of the Debian source' >&2; \
		exit 1; \
	fi
	mkdir -p ../tmp/nikola_$(UVERSION)
	wget https://github.com/getnikola/nikola/archive/v$(UVERSION).tar.gz \
		-O ../tmp/nikola_$(UVERSION).tar.gz;
	tar xf ../tmp/nikola_$(UVERSION).tar.gz \
		-C ../tmp/nikola_$(UVERSION) \
		'--exclude=*min.*' \
		'--exclude=*bootstrap3*' \
		'--exclude=*bootstrap.js' \
		'--exclude=*bootstrap.css' \
		'--exclude=*bootstrap-responsive.css' \
		'--exclude=*glyphicons-halflings*.png';
	tar -C ../tmp/nikola_$(UVERSION) nikola-$(UVERSION) -c --xz -f ../nikola_$(UVERSION).orig.tar.xz