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