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