summaryrefslogtreecommitdiff
path: root/debian/rules
blob: d2d01457a65aabf66810ca4f90872fb318961e04 (plain)
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
70
71
72
73
74
75
76
77
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

include /usr/share/cdbs/1/rules/debhelper.mk
# for earlier cdbs versions
DEB_PYTHON_MODULE_PACKAGE = python-mlpy
# for cdbs >= 0.4.54
DEB_PYTHON_MODULE_PACKAGES = python-mlpy python-mlpy-lib
include /usr/share/cdbs/1/class/python-distutils.mk

BUILD_SCRIPTS_DIR=build/scripts-$(cdbs_python_current_version)
BUILD_PYTHONPATH=$(CURDIR)/$(shell ls -d build/lib.*-*-$(cdbs_python_current_version))
MLPY_VERSION = $(shell awk -F\' '/version *=/{print $$2;}' setup.py)

doc: doc-stamp
doc-stamp: build/python-mlpy
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(BUILD_PYTHONPATH) $(MAKE) -C docs html latex
	PYTHONPATH=$(BUILD_PYTHONPATH) $(MAKE) -C docs/build/latex all-pdf
	touch $@
endif

# Build basic manpages
man: man-stamp
man-stamp: build/python-mlpy
	-rm -f $(BUILD_SCRIPTS_DIR)/*.1
	mkdir -p build/man
	for f in $(BUILD_SCRIPTS_DIR)/*; do \
		fn=$${f##*/}; \
		PYTHONPATH=$(BUILD_PYTHONPATH) help2man -N -S mlpy -s 1 \
		  -n "Command line interface to $${fn} in mlpy (version $(MLPY_VERSION))" \
		  --version-string=$(MLPY_VERSION) $$f >| build/man/$${fn}.1;\
    done
	touch $@

clean::
	-rm -rf build docs/build doc-stamp man-stamp

build/python-mlpy:: man
build/python-mlpy-doc:: doc

# use jquery from Debian package
# symlinked by debhelper
install/python-mlpy-doc::
	-rm docs/build/html/_static/jquery.js
	-rm doc/_build/html/_static/underscore.js

install/python-mlpy-lib::
	# move libraries into the python-mlpy-lib package
	for lib in $$(find debian/python-mlpy/usr -name '*.so'); do \
	   sdir=$$(dirname $$lib) ; \
	   tdir=debian/python-mlpy-lib/$${sdir#*python-mlpy/} ; \
	   mkdir -p $$tdir ; \
	   echo "Moving '$$lib' into '$$tdir'." ; \
	   mv $$lib $$tdir ; \
	done

binary-install/python-mlpy-lib::
	dh_numpy

# we need to move libraries away first, hence dependence on -lib
# Also without this step, movemodules from pysupport would not
# move arch-indep part of the module under pyshared
install/python-mlpy:: install/python-mlpy-lib

# install directly into package directory (despite multiple packages)
DEB_DESTDIR = $(CURDIR)/debian/python-mlpy
# immediately useable documentation
# and exemplar data (they are small excerpts anyways)
DEB_COMPRESS_EXCLUDE := .py .pdf .html .css .jpg .txt .js .json .rtc .par .bin .inv
# Man pages
DEB_INSTALL_MANPAGES_python-mlpy := build/man/*.1
# -doc package contents
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DEB_INSTALL_DOCS_python-mlpy-doc := docs/build/html docs/build/latex/mlpy.pdf
endif