ncurses 6.0 - patch 20170701
[ncurses.git] / package / debian / rules
1 #!/usr/bin/make -f
2 # Made with the aid of dh_make, by Craig Small
3 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4 # Some lines taken from debmake, by Cristoph Lameter.
5
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
8
9 # packages
10 PACKAGES.indep = ncurses6-doc ncurses6-doc-html
11 PACKAGES.arch  = ncurses6 ncursest6
12
13 # These are used for cross-compiling and for saving the configure script
14 # from having to guess our platform (since we know it already)
15 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17
18 CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
19 CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
20
21 MY_ABI=6
22 MY_DIR=/usr
23 MYDATA=/usr/local/ncurses/share/terminfo
24 NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI)
25 THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI)
26
27 CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
28 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
29 LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
30
31 ifneq ($(MY_DIR),/usr)
32         RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
33         RPATH_OPT = --enable-rpath
34 else
35         RPATH_ENV =
36         RPATH_OPT = --disable-rpath --disable-rpath-hack
37 endif
38
39 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
40         CFLAGS += -O0
41 else
42         CFLAGS += -O2
43 endif
44 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
45         INSTALL_PROGRAM += -s
46 endif
47
48 verbose = # -v
49
50 configure = \
51         $(RPATH_ENV) \
52         CFLAGS="$(CFLAGS)" \
53         CPPFLAGS="$(CPPFLAGS)" \
54         LDFLAGS="$(LDFLAGS)" ../../configure $(RPATH_OPT) \
55                 --host=$(DEB_HOST_GNU_TYPE) \
56                 --build=$(DEB_BUILD_GNU_TYPE) \
57                 --prefix=$(MY_DIR) \
58                 --with-default-terminfo-dir=$(MYDATA) \
59                 --with-terminfo-dirs=$(MYDATA):/usr/share/terminfo \
60                 --disable-echo \
61                 --disable-getcap \
62                 --disable-leaks \
63                 --disable-macros  \
64                 --disable-overwrite  \
65                 --disable-termcap \
66                 --enable-hard-tabs \
67                 --enable-pc-files \
68                 --enable-warnings \
69                 --enable-wgetch-events \
70                 --enable-widec \
71                 --program-suffix=$(MY_ABI) \
72                 --verbose \
73                 --with-abi-version=$(MY_ABI) \
74                 --with-develop \
75                 --with-extra-suffix=$(MY_ABI) \
76                 --with-shared \
77                 --with-termlib \
78                 --with-ticlib \
79                 --with-trace \
80                 --with-cxx-shared \
81                 --with-terminfo-dirs=/lib/terminfo:/usr/share/terminfo \
82                 --with-versioned-syms \
83                 --with-xterm-kbs=DEL \
84                 --without-ada \
85                 --without-debug \
86                 --without-normal
87
88 NCURSES6_DIR = $(CURDIR)/debian/ncurses6
89 NCURSEST6_DIR = $(CURDIR)/debian/ncursest6
90
91 .PHONY: all config build install binary clean config-indep config-arch \
92     build-indep build-arch install-indep install-arch binary-indep \
93     binary-arch
94
95 all: build
96
97 config: config-indep config-arch
98 build: build-indep build-arch
99 install: install-indep install-arch
100 binary: binary-indep binary-arch
101 clean:
102         dh_testdir
103         dh_testroot
104         dh_clean $(verbose)
105         rm -rf t
106
107 config-indep: $(PACKAGES.indep:%=config-%-stamp)
108 config-arch: $(PACKAGES.arch:%=config-%-stamp)
109
110 build-indep: $(PACKAGES.indep:%=build-%-stamp)
111 build-arch: $(PACKAGES.arch:%=build-%-stamp)
112
113 install-indep: $(PACKAGES.indep:%=install-%-stamp)
114 install-arch: $(PACKAGES.arch:%=install-%-stamp)
115
116 config-ncurses6-stamp:
117         dh_testdir
118         rm -rf t/ncurses6
119         mkdir -p t/ncurses6
120         cd t/ncurses6; $(configure)
121         touch $@
122
123 config-ncursest6-stamp:
124         dh_testdir
125         rm -rf t/ncursest6
126         mkdir -p t/ncursest6
127         cd t/ncursest6; $(configure) \
128                 --enable-interop \
129                 --enable-sp-funcs \
130                 --program-suffix=t$(MY_ABI) \
131                 --with-pthread
132         touch $@
133
134 config-ncurses6-doc-stamp \
135 config-ncurses6-doc-html-stamp: config-ncurses6-stamp
136         touch $@
137
138 build-ncurses6-stamp: config-ncurses6-stamp
139         dh_testdir
140
141         $(MAKE) -C t/ncurses6
142
143         touch $@
144
145 build-ncursest6-stamp: config-ncursest6-stamp
146         dh_testdir
147
148         $(MAKE) -C t/ncursest6
149
150         touch $@
151
152 build-ncurses6-doc-stamp \
153 build-ncurses6-doc-html-stamp: build-ncurses6-stamp
154         touch $@
155
156 install-ncurses6-stamp: build-ncurses6-stamp
157         dh_testdir
158         dh_testroot
159         dh_installdirs $(verbose)
160         dh_prep        $(verbose) -pncurses6
161
162         $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
163         $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
164
165         mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
166
167         touch $@
168
169 install-ncursest6-stamp: build-ncursest6-stamp
170         dh_testdir
171         dh_testroot
172         dh_installdirs $(verbose)
173         dh_prep        $(verbose) -pncursest6
174
175         $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
176         $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
177
178         mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
179
180         touch $@
181
182 install-ncurses6-doc-stamp: build-ncurses6-stamp
183         dh_testdir
184         dh_testroot
185         dh_installdirs $(verbose)
186         dh_prep        $(verbose) -pncurses6-doc
187
188         $(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc
189
190         touch $@
191
192 HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/ncurses6-doc-html
193 install-ncurses6-doc-html-stamp: build-ncurses6-stamp
194         dh_testdir
195         dh_testroot
196         dh_installdirs $(verbose)
197         dh_prep        $(verbose) -pncurses6-doc-html
198
199         cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
200         cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}
201
202         touch $@
203
204 # Build architecture-independent files here.
205 binary-indep: install-indep
206 ifneq ($(PACKAGES.indep),)
207         rm -f $(PACKAGES.indep:%=install-%-stamp)
208         dh_testdir
209         dh_testroot
210         dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
211         dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
212         dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
213         dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
214         dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
215         dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
216         dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
217         dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
218         dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
219         dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
220 endif
221
222 # Build architecture-dependent files here.
223 binary-arch: install-arch
224 ifneq ($(PACKAGES.arch),)
225         rm -f $(PACKAGES.arch:%=install-%-stamp)
226         dh_testdir
227         dh_testroot
228         dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
229         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
230         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
231         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
232         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
233         dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
234         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
235         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
236         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
237         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
238 endif