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