Fix debian package build
[senf.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 #
5 # This file was originally written by Joey Hess and Craig Small.
6 # As a special exception, when this file is copied by dh-make into a
7 # dh-make output file, you may use that output file without restriction.
8 # This special exception was added by Craig Small in version 0.37 of dh-make.
9 #
10 # Modified to make a template file for a multi-binary package with separated
11 # build-arch and build-indep targets  by Bill Allombert 2001
12
13 # Uncomment this to turn on verbose mode.
14 #export DH_VERBOSE=1
15
16 debian_build=1
17 export debian_build
18
19 # This has to be exported to make some magic below work.
20 export DH_OPTIONS
21
22 CONCURRENCY_LEVEL ?= 1
23 export CONCURRENCY_LEVEL
24
25 destdir=$(CURDIR)/debian/tmp
26
27 configure: configure-stamp
28 configure-stamp:
29         dh_testdir
30 #       Add here commands to configure the package.
31 #       rm -f Doxyfile.local SConstruct.local senf/local_config.hh
32         scons prepare
33 #       If needed, we could create new files 'Doxyfile.local',
34 #       'SConstruct.local' and/or 'local_config.hh' here.  We don't
35 #       remove them in 'clean' to allow building a source package from
36 #       an individually configured svn working copy. (The files are
37 #       ignored by dpkg-buildpackge because of appropriate -I
38 #       arguments provided by 'scons deb' and 'scons debsrc'
39         touch configure-stamp
40
41 build: build-arch build-indep
42
43 build-arch: build-arch-debug build-arch-final
44
45 build-arch-final: build-arch-final-stamp
46 build-arch-final-stamp: configure-stamp
47 #       Add here commands to compile the arch part of the package.
48         scons -j $(CONCURRENCY_LEVEL) default final=1
49         scons $(destdir)/usr/lib $(destdir)/usr/bin final=1 syslayout=1 \
50                 PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$PREFIX/lib/senf'
51         touch $@
52
53 build-arch-debug: build-arch-debug-stamp
54 build-arch-debug-stamp: configure-stamp
55 #       Add here commands to compile the arch part of the package.
56         scons -j $(CONCURRENCY_LEVEL) default LIBADDSUFFIX=_g OBJADDSUFFIX=_g
57         scons $(destdir)/usr/lib syslayout=1 LIBADDSUFFIX=_g OBJADDSUFFIX=_g \
58                 PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$PREFIX/lib/senf/debug'
59         touch $@
60
61 build-indep: build-indep-stamp
62 build-indep-stamp: configure-stamp
63 #       Add here commands to compile the indep part of the package.
64         scons -j $(CONCURRENCY_LEVEL) all_docs
65         scons all_docs
66         scons linklint
67         scons fixlinks
68         scons $(destdir)/usr/include $(destdir)/usr/share/doc syslayout=1 \
69                 PREFIX='$(destdir)/usr' \
70                 DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc/html'
71 #       Remove all the files not really needed from the documentation directories
72         find $(destdir)/usr/share/doc/libsenf-doc/html \
73                 -type f ! -regex '.*\.\(html\|css\|png\|php\|idx\|tag\)' | xargs rm -f
74 #       We need to install the example sourcecode
75         find Examples \( -name "*.hh" -o -name "*.cc" \) -printf "%P\n" | \
76                 while read src; do \
77                         dir="$(destdir)/usr/share/doc/libsenf-doc/examples/$$(dirname "$$src")"; \
78                         mkdir -p "$$dir"; \
79                         cp "Examples/$$src" "$$dir"; \
80                 done
81         touch $@
82
83 clean: debclean
84 #       Add here commands to clean up after the build process.
85         -scons -c all
86         -scons -c all LIBADDSUFFIX=_g OBJADDSUFFIX=_g
87
88 debclean:
89         dh_testdir
90         dh_testroot
91         rm -f build-arch-*-stamp build-indep-stamp configure-stamp
92         dh_clean
93
94 install: install-arch install-indep
95 install-indep: build-indep
96         dh_testdir
97         dh_testroot
98         dh_clean -k -i -Xdebian/tmp
99         dh_installdirs -i
100 #       Add here commands to install the indep part of the package into
101 #       debian/<package>-doc.
102         dh_install -X.svn -i
103
104 install-arch: build-arch
105         dh_testdir
106         dh_testroot
107         dh_clean -k -s -Xdebian/tmp
108         dh_installdirs -s
109 #       Add here commands to install the arch part of the package into 
110 #       debian/tmp.
111         dh_install -X.svn -s
112
113 # Must not depend on anything. This is to be called by
114 # binary-arch/binary-indep
115 # in another 'make' thread.
116 binary-common:
117         dh_testdir
118         dh_testroot
119         dh_installchangelogs
120         dh_installdocs
121         dh_installexamples
122 #       dh_installmenu
123 #       dh_installdebconf       
124 #       dh_installlogrotate     
125 #       dh_installemacsen
126 #       dh_installpam
127 #       dh_installmime
128 #       dh_python
129 #       dh_installinit
130 #       dh_installcron
131 #       dh_installinfo
132         dh_installman
133         dh_link
134         dh_strip
135         dh_compress -Xhtml -Xdoclib -Xexamples
136         dh_fixperms
137 #       dh_perl
138         dh_makeshlibs
139         dh_installdeb
140         dh_shlibdeps
141         dh_gencontrol
142         dh_md5sums
143         dh_builddeb
144
145 binary-indep: build-indep install-indep
146         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
147
148 binary-arch: build-arch install-arch
149         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
150
151 binary: binary-arch binary-indep
152 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch \
153         binary-arch-common binary-arch-final binary-arch-debug