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