ncurses 6.1 - patch 20180512
[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-config-suffix=dev \
79                 --with-cxx-shared \
80                 --with-default-terminfo-dir=$(MYDATA) \
81                 --with-develop \
82                 --with-extra-suffix=$(MY_ABI) \
83                 --with-shared \
84                 --with-terminfo-dirs=$(MYDATA):/lib/terminfo:/usr/share/terminfo \
85                 --with-termlib \
86                 --with-ticlib \
87                 --with-trace \
88                 --with-versioned-syms \
89                 --with-xterm-kbs=DEL \
90                 --without-ada \
91                 --without-debug \
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 config-ncurses6-stamp:
123         dh_testdir
124         rm -rf t/ncurses6
125         mkdir -p t/ncurses6
126         cd t/ncurses6; $(configure)
127         touch $@
128
129 config-ncursest6-stamp:
130         dh_testdir
131         rm -rf t/ncursest6
132         mkdir -p t/ncursest6
133         cd t/ncursest6; $(configure) \
134                 --enable-interop \
135                 --enable-sp-funcs \
136                 --program-suffix=t$(MY_ABI) \
137                 --with-pthread
138         touch $@
139
140 config-ncurses6-doc-stamp \
141 config-ncurses6-doc-html-stamp: config-ncurses6-stamp
142         touch $@
143
144 build-ncurses6-stamp: config-ncurses6-stamp
145         dh_testdir
146
147         $(MAKE) -C t/ncurses6
148
149         touch $@
150
151 build-ncursest6-stamp: config-ncursest6-stamp
152         dh_testdir
153
154         $(MAKE) -C t/ncursest6
155
156         touch $@
157
158 build-ncurses6-doc-stamp \
159 build-ncurses6-doc-html-stamp: build-ncurses6-stamp
160         touch $@
161
162 install-ncurses6-stamp: build-ncurses6-stamp
163         dh_testdir
164         dh_testroot
165         dh_installdirs $(verbose)
166         dh_prep        $(verbose) -pncurses6
167
168         $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
169         $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
170
171         mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
172
173         touch $@
174
175 install-ncursest6-stamp: build-ncursest6-stamp
176         dh_testdir
177         dh_testroot
178         dh_installdirs $(verbose)
179         dh_prep        $(verbose) -pncursest6
180
181         $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
182         $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
183
184         mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
185
186         touch $@
187
188 install-ncurses6-doc-stamp: build-ncurses6-stamp
189         dh_testdir
190         dh_testroot
191         dh_installdirs $(verbose)
192         dh_prep        $(verbose) -pncurses6-doc
193
194         $(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc
195
196         touch $@
197
198 HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/ncurses6-doc-html
199 install-ncurses6-doc-html-stamp: build-ncurses6-stamp
200         dh_testdir
201         dh_testroot
202         dh_installdirs $(verbose)
203         dh_prep        $(verbose) -pncurses6-doc-html
204
205         cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
206         cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}
207
208         touch $@
209
210 # Build architecture-independent files here.
211 binary-indep: install-indep
212 ifneq ($(PACKAGES.indep),)
213         rm -f $(PACKAGES.indep:%=install-%-stamp)
214         dh_testdir
215         dh_testroot
216         dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
217         dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
218         dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
219         dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
220         dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
221         dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
222         dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
223         dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
224         dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
225         dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
226         dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
227 endif
228
229 # Build architecture-dependent files here.
230 binary-arch: install-arch
231 ifneq ($(PACKAGES.arch),)
232         rm -f $(PACKAGES.arch:%=install-%-stamp)
233         dh_testdir
234         dh_testroot
235         dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
236         dh_installdocs       $(verbose) $(PACKAGES.arch:%=-p%)
237         dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
238         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
239         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
240         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
241         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
242         dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
243         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
244         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
245         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
246         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
247 endif