ncurses 6.2 - patch 20200808
[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 CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
29 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
30 LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
31
32 ifneq ($(MY_DIR),/usr)
33         RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
34         RPATH_OPT = --enable-rpath
35 else
36         RPATH_ENV =
37         RPATH_OPT = --disable-rpath --disable-rpath-hack
38 endif
39
40 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
41         CFLAGS += -O0
42 else
43         CFLAGS += -O2
44 endif
45 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
46         INSTALL_PROGRAM += -s
47 endif
48
49 verbose = # -v
50
51 configure = \
52         $(RPATH_ENV) \
53         CFLAGS="$(CFLAGS)" \
54         CPPFLAGS="$(CPPFLAGS)" \
55         LDFLAGS="$(LDFLAGS)" ../../configure $(RPATH_OPT) \
56                 --host=$(DEB_HOST_GNU_TYPE) \
57                 --build=$(DEB_BUILD_GNU_TYPE) \
58                 --prefix=$(MY_DIR) \
59                 --disable-echo \
60                 --disable-getcap \
61                 --disable-leaks \
62                 --disable-macros  \
63                 --disable-overwrite  \
64                 --disable-relink \
65                 --disable-termcap \
66                 --enable-hard-tabs \
67                 --enable-opaque-curses \
68                 --enable-opaque-form \
69                 --enable-opaque-menu \
70                 --enable-opaque-panel \
71                 --enable-pc-files \
72                 --enable-warnings \
73                 --enable-wgetch-events \
74                 --enable-widec \
75                 --enable-xmc-glitch \
76                 --program-suffix=$(MY_ABI) \
77                 --verbose \
78                 --with-abi-version=$(MY_ABI) \
79                 --with-config-suffix=dev \
80                 --with-cxx-shared \
81                 --with-default-terminfo-dir=$(MYDATA) \
82                 --with-develop \
83                 --with-extra-suffix=$(MY_ABI) \
84                 --with-shared \
85                 --with-terminfo-dirs=$(MYDATA):/lib/terminfo:/usr/share/terminfo \
86                 --with-termlib \
87                 --with-ticlib \
88                 --with-trace \
89                 --with-versioned-syms \
90                 --with-xterm-kbs=DEL \
91                 --without-ada \
92                 --without-debug \
93                 --without-normal
94
95 NCURSES6_DIR = $(CURDIR)/debian/ncurses6
96 NCURSEST6_DIR = $(CURDIR)/debian/ncursest6
97
98 .PHONY: all config build install binary clean config-indep config-arch \
99     build-indep build-arch install-indep install-arch binary-indep \
100     binary-arch
101
102 all: build
103
104 config: config-indep config-arch
105 build: build-indep build-arch
106 install: install-indep install-arch
107 binary: binary-indep binary-arch
108 clean:
109         dh_testdir
110         dh_testroot
111         dh_clean $(verbose)
112         rm -rf t
113
114 config-indep: $(PACKAGES.indep:%=config-%-stamp)
115 config-arch: $(PACKAGES.arch:%=config-%-stamp)
116
117 build-indep: $(PACKAGES.indep:%=build-%-stamp)
118 build-arch: $(PACKAGES.arch:%=build-%-stamp)
119
120 install-indep: $(PACKAGES.indep:%=install-%-stamp)
121 install-arch: $(PACKAGES.arch:%=install-%-stamp)
122
123 config-ncurses6-stamp:
124         dh_testdir
125         rm -rf t/ncurses6
126         mkdir -p t/ncurses6
127         cd t/ncurses6; $(configure)
128         touch $@
129
130 config-ncursest6-stamp:
131         dh_testdir
132         rm -rf t/ncursest6
133         mkdir -p t/ncursest6
134         cd t/ncursest6; $(configure) \
135                 --enable-interop \
136                 --enable-sp-funcs \
137                 --program-suffix=t$(MY_ABI) \
138                 --with-pthread
139         touch $@
140
141 config-ncurses6-doc-stamp \
142 config-ncurses6-doc-html-stamp: config-ncurses6-stamp
143         touch $@
144
145 build-ncurses6-stamp: config-ncurses6-stamp
146         dh_testdir
147
148         $(MAKE) -C t/ncurses6
149
150         touch $@
151
152 build-ncursest6-stamp: config-ncursest6-stamp
153         dh_testdir
154
155         $(MAKE) -C t/ncursest6
156
157         touch $@
158
159 build-ncurses6-doc-stamp \
160 build-ncurses6-doc-html-stamp: build-ncurses6-stamp
161         touch $@
162
163 install-ncurses6-stamp: build-ncurses6-stamp
164         dh_testdir
165         dh_testroot
166         dh_installdirs $(verbose)
167         dh_prep        $(verbose) -pncurses6
168
169         $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
170         $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
171
172         mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
173
174         touch $@
175
176 install-ncursest6-stamp: build-ncursest6-stamp
177         dh_testdir
178         dh_testroot
179         dh_installdirs $(verbose)
180         dh_prep        $(verbose) -pncursest6
181
182         $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
183         $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
184
185         mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
186
187         touch $@
188
189 install-ncurses6-doc-stamp: build-ncurses6-stamp
190         dh_testdir
191         dh_testroot
192         dh_installdirs $(verbose)
193         dh_prep        $(verbose) -pncurses6-doc
194
195         $(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc
196
197         touch $@
198
199 HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/ncurses6-doc-html
200 install-ncurses6-doc-html-stamp: build-ncurses6-stamp
201         dh_testdir
202         dh_testroot
203         dh_installdirs $(verbose)
204         dh_prep        $(verbose) -pncurses6-doc-html
205
206         cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
207         cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}
208
209         touch $@
210
211 # Build architecture-independent files here.
212 binary-indep: install-indep
213 ifneq ($(PACKAGES.indep),)
214         rm -f $(PACKAGES.indep:%=install-%-stamp)
215         dh_testdir
216         dh_testroot
217         dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
218         dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
219         dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
220         dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
221         dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
222         dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
223         dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
224         dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
225         dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
226         dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
227         dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
228 endif
229
230 # Build architecture-dependent files here.
231 binary-arch: install-arch
232 ifneq ($(PACKAGES.arch),)
233         rm -f $(PACKAGES.arch:%=install-%-stamp)
234         dh_testdir
235         dh_testroot
236         dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
237         dh_installdocs       $(verbose) $(PACKAGES.arch:%=-p%)
238         dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
239         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
240         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
241         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
242         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
243         dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
244         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
245         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
246         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
247         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
248 endif