chiark / gitweb /
changelog: start 1.3.2
[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 tcl_versions= 8.5 8.6
30
31 march := $(shell dpkg-architecture -q DEB_HOST_MULTIARCH)
32 libsubdir = /$(march)
33
34 garch := $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE)
35 ifneq ($(garch),)
36
37 ifeq ($(origin CC),default)
38 export CC=$(garch)-gcc
39 endif
40
41 endif # $garch
42
43 define checkdir
44         test -f hbytes/hbytes.tct
45 endef
46
47 build: build-arch build-indep
48 build-arch:
49         $(checkdir)
50         $(MAKE) prefix=/usr VERSION=$(majversion) TCL_VERSION=$(tclversion)
51
52 build-indep:
53
54 clean:
55         $(checkdir)
56         $(MAKE) clean
57         rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
58         dh_clean
59
60 binary-indep:
61
62 binary-arch:    checkroot build
63         $(checkdir)
64         -rm -rf debian/$(docpackage) debian/$(libpackage)
65         install -d debian/$(libpackage)/usr/lib$(libsubdir)
66         install -d debian/$(docpackage)/usr/share/doc/$(docpackage)
67
68         set -e; for f in lintian; do                                         \
69                 install -d debian/$(libpackage)/usr/share/$$f/overrides;     \
70                 cp debian/$$f-overrides                                      \
71                  debian/$(libpackage)/usr/share/$$f/overrides/$(libpackage); \
72                 done
73
74         cp */*.so debian/$(libpackage)/usr/lib$(libsubdir)/.
75
76         set -e; for f in */*.[ch]; do                                   \
77                 perl debian/extractdoc <$$f                             \
78                         debian/$(docpackage)/$(docdir)/ $$f .txt;       \
79                 done
80         cp */*.tct debian/README debian/copyright \
81                 debian/$(docpackage)/$(docdir)
82
83         dh_installchangelogs
84         dh_strip
85
86         dh_makeshlibs
87         dh_shlibdeps -Xchiark_tcl_adns -Xchiark_tcl_crypto
88
89         # be consistent about what we compress:
90         dh_compress -X.c.txt -X.h.txt
91
92         dh_fixperms
93         dh_installdeb
94         dh_gencontrol
95         dh_md5sums
96         dh_builddeb
97
98 # Below here is fairly generic really
99
100 binary:         binary-indep binary-arch
101
102 source diff:
103         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
104
105 checkroot:
106         $(checkdir)
107         dh_testroot
108
109 debian/tests/control: debian/regenerate-autopkgtests debian/rules
110         $(MAKE) debian-substvars
111         $< $(tcl_versions)
112
113 .PHONY: binary binary-arch binary-indep clean checkroot