blob: e77fd692224b230ff9f34e7bd5568c32b7875017 [file] [log] [blame]
Steve Kondikae271bc2015-11-15 02:50:53 +01001#!/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
10PACKAGES.indep = # ncurses6-docs
11PACKAGES.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)
15DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17
18CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
19CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
20
21MY_ABI=6
22MY_DIR=/usr
23MYDATA=/usr/local/ncurses/share/terminfo
24NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI)
25THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI)
26
27CFLAGS = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
28CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
29LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
30
31ifneq ($(MY_DIR),/usr)
32 RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
33 RPATH_OPT = --enable-rpath
34else
35 RPATH_ENV =
36 RPATH_OPT = --disable-rpath --disable-rpath-hack
37endif
38
39ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
40 CFLAGS += -O0
41else
42 CFLAGS += -O2
43endif
44ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
45 INSTALL_PROGRAM += -s
46endif
47
48verbose = # -v
49
50configure = \
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
87NCURSES6_DIR = $(CURDIR)/debian/ncurses6
88NCURSEST6_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
94all: build
95
96config: config-indep config-arch
97build: build-indep build-arch
98install: install-indep install-arch
99binary: binary-indep binary-arch
100clean:
101 dh_testdir
102 dh_testroot
103 dh_clean $(verbose)
104 rm -rf t
105
106config-indep: $(PACKAGES.indep:%=config-%-stamp)
107config-arch: $(PACKAGES.arch:%=config-%-stamp)
108
109build-indep: $(PACKAGES.indep:%=build-%-stamp)
110build-arch: $(PACKAGES.arch:%=build-%-stamp)
111
112install-indep: $(PACKAGES.indep:%=install-%-stamp)
113install-arch: $(PACKAGES.arch:%=install-%-stamp)
114
115config-ncurses6-stamp:
116 dh_testdir
117 rm -rf t/ncurses6
118 mkdir -p t/ncurses6
119 cd t/ncurses6; $(configure)
120 touch $@
121
122config-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
133build-ncurses6-stamp: config-ncurses6-stamp
134 dh_testdir
135
136 $(MAKE) -C t/ncurses6
137
138 touch $@
139
140build-ncursest6-stamp: config-ncursest6-stamp
141 dh_testdir
142
143 $(MAKE) -C t/ncursest6
144
145 touch $@
146
147install-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
160install-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.
174binary-indep: install-indep
175ifneq ($(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%)
189endif
190
191# Build architecture-dependent files here.
192binary-arch: install-arch
193ifneq ($(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%)
207endif