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