chiark / gitweb /
changelog: finalise 1.3.5
[chiark-tcl.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # chiark-tcl - various Tcl bindings and extensions
4 # Copyright 2006-2012 Ian Jackson
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this library; if not, see <http://www.gnu.org/licenses/>.
18
19
20 majversion=1
21 srcpackage=chiark-tcl
22 libpackage=libtcl-chiark-$(majversion)
23 docpackage=libtcl-chiark-$(majversion)
24 docdir=usr/share/doc/$(docpackage)
25
26 tclh:=$(firstword $(wildcard /usr/include/tcl8.*/tcl.h))
27 tclversion:=$(patsubst /usr/include/tcl%/tcl.h,%,$(tclh))
28
29 garch := $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE)
30 ifneq ($(garch),)
31
32 libsubdir = /$(garch)
33
34 ifeq ($(origin CC),default)
35 export CC=$(garch)-gcc
36 endif
37
38 endif # $garch
39
40 define checkdir
41         test -f hbytes/hbytes.tct
42 endef
43
44 build: build-arch build-indep
45 build-arch:
46         $(checkdir)
47         $(MAKE) prefix=/usr VERSION=$(majversion) TCL_VERSION=$(tclversion)
48
49 build-indep:
50
51 clean:
52         $(checkdir)
53         $(MAKE) clean
54         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
55         dh_clean
56
57 binary-indep:
58
59 binary-arch:    checkroot build
60         $(checkdir)
61         -rm -rf debian/$(docpackage) debian/$(libpackage)
62         install -d debian/$(libpackage)/usr/lib$(libsubdir)
63         install -d debian/$(docpackage)/usr/share/doc/$(docpackage)
64
65         set -e; for f in lintian; do                                         \
66                 install -d debian/$(libpackage)/usr/share/$$f/overrides;     \
67                 cp debian/$$f-overrides                                      \
68                  debian/$(libpackage)/usr/share/$$f/overrides/$(libpackage); \
69                 done
70
71         cp */*.so debian/$(libpackage)/usr/lib$(libsubdir)/.
72
73         set -e; for f in */*.[ch]; do                                   \
74                 perl debian/extractdoc <$$f                             \
75                         debian/$(docpackage)/$(docdir)/ $$f .txt;       \
76                 done
77         cp */*.tct debian/README debian/copyright \
78                 debian/$(docpackage)/$(docdir)
79
80         dh_installchangelogs
81         dh_strip
82
83         dh_makeshlibs
84         dh_shlibdeps -Xchiark_tcl_adns -Xchiark_tcl_crypto
85
86         # be consistent about what we compress:
87         dh_compress -X.c.txt -X.h.txt
88
89         dh_fixperms
90         dh_installdeb
91         dh_gencontrol
92         dh_md5sums
93         dh_builddeb
94
95 # Below here is fairly generic really
96
97 binary:         binary-indep binary-arch
98
99 source diff:
100         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
101
102 checkroot:
103         $(checkdir)
104         dh_testroot
105
106 .PHONY: binary binary-arch binary-indep clean checkroot