ncurses 6.0 - patch 20150905
[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-versioned-syms \
82                 --with-xterm-kbs=DEL \
83                 --without-ada \
84                 --without-debug \
85                 --without-normal
86
87 NCURSES6_DIR = $(CURDIR)/debian/ncurses6
88 NCURSEST6_DIR = $(CURDIR)/debian/ncursest6
89
90 .PHONY: all config build install binary clean config-indep config-arch \
91     build-indep build-arch install-indep install-arch binary-indep \
92     binary-arch
93
94 all: build
95
96 config: config-indep config-arch
97 build: build-indep build-arch
98 install: install-indep install-arch
99 binary: binary-indep binary-arch
100 clean:
101         dh_testdir
102         dh_testroot
103         dh_clean $(verbose)
104         rm -rf t
105
106 config-indep: $(PACKAGES.indep:%=config-%-stamp)
107 config-arch: $(PACKAGES.arch:%=config-%-stamp)
108
109 build-indep: $(PACKAGES.indep:%=build-%-stamp)
110 build-arch: $(PACKAGES.arch:%=build-%-stamp)
111
112 install-indep: $(PACKAGES.indep:%=install-%-stamp)
113 install-arch: $(PACKAGES.arch:%=install-%-stamp)
114
115 config-ncurses6-stamp:
116         dh_testdir
117         rm -rf t/ncurses6
118         mkdir -p t/ncurses6
119         cd t/ncurses6; $(configure)
120         touch $@
121
122 config-ncursest6-stamp:
123         dh_testdir
124         rm -rf t/ncursest6
125         mkdir -p t/ncursest6
126         cd t/ncursest6; $(configure) \
127                 --enable-interop \
128                 --enable-sp-funcs \
129                 --program-suffix=t$(MY_ABI) \
130                 --with-pthread
131         touch $@
132
133 build-ncurses6-stamp: config-ncurses6-stamp
134         dh_testdir
135
136         $(MAKE) -C t/ncurses6
137
138         touch $@
139
140 build-ncursest6-stamp: config-ncursest6-stamp
141         dh_testdir
142
143         $(MAKE) -C t/ncursest6
144
145         touch $@
146
147 install-ncurses6-stamp: build-ncurses6-stamp
148         dh_testdir
149         dh_testroot
150         dh_installdirs $(verbose)
151         dh_prep        $(verbose) -pncurses6
152
153         $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
154         $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
155
156         mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
157
158         touch $@
159
160 install-ncursest6-stamp: build-ncursest6-stamp
161         dh_testdir
162         dh_testroot
163         dh_installdirs $(verbose)
164         dh_prep        $(verbose) -pncursest6
165
166         $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
167         $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
168
169         mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
170
171         touch $@
172
173 # Build architecture-independent files here.
174 binary-indep: install-indep
175 ifneq ($(PACKAGES.indep),)
176         rm -f $(PACKAGES.indep:%=install-%-stamp)
177         dh_testdir
178         dh_testroot
179         dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
180         dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
181         dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
182         dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
183         dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
184         dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
185         dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
186         dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
187         dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
188         dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
189 endif
190
191 # Build architecture-dependent files here.
192 binary-arch: install-arch
193 ifneq ($(PACKAGES.arch),)
194         rm -f $(PACKAGES.arch:%=install-%-stamp)
195         dh_testdir
196         dh_testroot
197         dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
198         dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
199         dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
200         dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
201         dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
202         dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
203         dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
204         dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
205         dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
206         dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
207 endif