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