chiark / gitweb /
octave4.4
[nlopt.git] / debian / rules
1 #!/usr/bin/make -f
2
3 BUILDDIR = $(CURDIR)/debian/build
4
5 PYVERS := $(shell pyversions -vr debian/control)
6
7 # The directories below are versioned.  We only support the packages for the
8 # stable version of Octave
9 mpath = $(shell octave-config -p LOCALFCNFILEDIR)/nlopt
10 bpath = $(shell octave-config -p LOCALOCTFILEDIR)/nlopt
11
12 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
13
14 %:
15         dh $@  --buildsystem=autoconf --builddirectory=$(BUILDDIR) --with python2
16
17 override_dh_auto_configure:
18         for v in $(PYVERS); do \
19            dh_auto_configure --builddirectory=$(BUILDDIR)$$v \
20                 -- $(extra_flags) \
21                 --prefix=/usr \
22                 --srcdir=$(CURDIR) \
23                 --enable-shared \
24                 PYTHON=/usr/bin/python$$v \
25                 OCT_INSTALL_DIR=$(bpath) M_INSTALL_DIR=$(mpath) \
26                 GUILE=guile GUILE_CONFIG=guile-config; \
27         done
28
29 override_dh_auto_build:
30         for v in $(PYVERS); do \
31            dh_auto_build --builddirectory=$(BUILDDIR)$$v; \
32         done
33         # Now configure and build again for C++
34         dh_auto_configure --builddirectory=$(BUILDDIR)$$v \
35                 -- $(extra_flags) \
36                 --prefix=/usr \
37                 --srcdir=$(CURDIR) \
38                 --enable-shared \
39                 --with-cxx
40         dh_auto_build --builddirectory=$(BUILDDIR)$$v; \
41
42 override_dh_clean:
43         dh_clean --exclude='*.orig'
44
45 override_dh_auto_clean:
46         for v in $(PYVERS); do \
47            rm -rf $(BUILDDIR)$$v; \
48         done
49
50 override_dh_strip:
51         dh_strip
52         find debian/octave-nlopt/usr/lib -name *.oct | \
53                 xargs strip --strip-unneeded --remove-section=.comment
54
55 override_dh_makeshlibs:
56         dh_makeshlibs $(shell for v in $(PYVERS); do printf -- "-X/usr/lib/python$$v/dist-packages "; done)
57
58 override_dh_shlibdeps:
59         dh_shlibdeps
60         dh_octave_substvar
61
62 override_dh_auto_install:
63         for v in $(PYVERS); do \
64           dh_auto_install --builddirectory=$(BUILDDIR)$$v; \
65         done
66
67         dh_numpy
68         find debian/tmp/usr/lib/python* \
69                 -name '*.pyc' -o -name '*.pyo' \
70                 -o -name '*.la' -o -name '*.a' | xargs rm
71
72 override_dh_install:
73         dh_install
74         # Remove C++ header from C interface
75         find debian/libnlopt-dev -name nlopt.hpp -delete
76
77 override_dh_link:
78         for package in libnlopt-dev libnlopt-guile0 octave-nlopt python-nlopt; do \
79                 rm -rf debian/$$package/usr/share/doc/$$package; \
80         done
81         dh_link
82
83
84 override_dh_auto_test:
85         for v in $(PYVERS); do \
86            dh_auto_test --builddirectory=$(BUILDDIR)$$v \
87                 -- $(extra_flags); \
88         done