aboutsummaryrefslogtreecommitdiff
path: root/package/debian/rules
blob: 06c088ab3296b58fab6db12b2084b98719a7e005 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/make -f
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Some lines taken from debmake, by Cristoph Lameter.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# packages
PACKAGES.indep = ncurses6-doc ncurses6-doc-html
PACKAGES.arch  = ncurses6 ncursest6

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic

MY_ABI=6
MY_DIR=/usr
MYDATA=/usr/local/ncurses/share/terminfo
NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI)
THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI)

CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)

ifneq ($(MY_DIR),/usr)
	RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
	RPATH_OPT = --enable-rpath
else
	RPATH_ENV =
	RPATH_OPT = --disable-rpath --disable-rpath-hack
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
endif

verbose = # -v

configure = \
	$(RPATH_ENV) \
	CFLAGS="$(CFLAGS)" \
	CPPFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS)" ../../configure $(RPATH_OPT) \
		--host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=$(MY_DIR) \
		--disable-echo \
		--disable-getcap \
		--disable-leaks \
		--disable-macros  \
		--disable-overwrite  \
		--disable-relink \
		--disable-termcap \
		--enable-hard-tabs \
		--enable-opaque-curses \
		--enable-opaque-form \
		--enable-opaque-menu \
		--enable-opaque-panel \
		--enable-pc-files \
		--enable-warnings \
		--enable-wgetch-events \
		--enable-widec \
		--enable-xmc-glitch \
		--program-suffix=$(MY_ABI) \
		--verbose \
		--with-abi-version=$(MY_ABI) \
		--with-config-suffix=dev \
		--with-cxx-shared \
		--with-default-terminfo-dir=$(MYDATA) \
		--with-develop \
		--with-extra-suffix=$(MY_ABI) \
		--with-shared \
		--with-terminfo-dirs=$(MYDATA):/lib/terminfo:/usr/share/terminfo \
		--with-termlib \
		--with-ticlib \
		--with-trace \
		--with-versioned-syms \
		--with-xterm-kbs=DEL \
		--without-ada \
		--without-debug \
		--without-normal

NCURSES6_DIR = $(CURDIR)/debian/ncurses6
NCURSEST6_DIR = $(CURDIR)/debian/ncursest6

.PHONY: all config build install binary clean config-indep config-arch \
    build-indep build-arch install-indep install-arch binary-indep \
    binary-arch

all: build

config: config-indep config-arch
build: build-indep build-arch
install: install-indep install-arch
binary: binary-indep binary-arch
clean:
	dh_testdir
	dh_testroot
	dh_clean $(verbose)
	rm -rf t

config-indep: $(PACKAGES.indep:%=config-%-stamp)
config-arch: $(PACKAGES.arch:%=config-%-stamp)

build-indep: $(PACKAGES.indep:%=build-%-stamp)
build-arch: $(PACKAGES.arch:%=build-%-stamp)

install-indep: $(PACKAGES.indep:%=install-%-stamp)
install-arch: $(PACKAGES.arch:%=install-%-stamp)

config-ncurses6-stamp:
	dh_testdir
	rm -rf t/ncurses6
	mkdir -p t/ncurses6
	cd t/ncurses6; $(configure)
	touch $@

config-ncursest6-stamp:
	dh_testdir
	rm -rf t/ncursest6
	mkdir -p t/ncursest6
	cd t/ncursest6; $(configure) \
		--enable-interop \
		--enable-sp-funcs \
		--program-suffix=t$(MY_ABI) \
		--with-pthread
	touch $@

config-ncurses6-doc-stamp \
config-ncurses6-doc-html-stamp: config-ncurses6-stamp
	touch $@

build-ncurses6-stamp: config-ncurses6-stamp
	dh_testdir

	$(MAKE) -C t/ncurses6

	touch $@

build-ncursest6-stamp: config-ncursest6-stamp
	dh_testdir

	$(MAKE) -C t/ncursest6

	touch $@

build-ncurses6-doc-stamp \
build-ncurses6-doc-html-stamp: build-ncurses6-stamp
	touch $@

install-ncurses6-stamp: build-ncurses6-stamp
	dh_testdir
	dh_testroot
	dh_installdirs $(verbose)
	dh_prep        $(verbose) -pncurses6

	$(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
	$(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib

	mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)

	touch $@

install-ncursest6-stamp: build-ncursest6-stamp
	dh_testdir
	dh_testroot
	dh_installdirs $(verbose)
	dh_prep        $(verbose) -pncursest6

	$(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
	$(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib

	mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)

	touch $@

install-ncurses6-doc-stamp: build-ncurses6-stamp
	dh_testdir
	dh_testroot
	dh_installdirs $(verbose)
	dh_prep        $(verbose) -pncurses6-doc

	$(MAKE) -C t/ncurses6 install.man DESTDIR=$(NCURSES6_DIR)-doc

	touch $@

HTML_DESTDIR=$(NCURSES6_DIR)-doc-html/usr/share/ncurses6-doc-html
install-ncurses6-doc-html-stamp: build-ncurses6-stamp
	dh_testdir
	dh_testroot
	dh_installdirs $(verbose)
	dh_prep        $(verbose) -pncurses6-doc-html

	cd doc/html && find * -type d | sort | xargs -I{} mkdir -p -v $(HTML_DESTDIR)/{}
	cd doc/html && find * -type f -name '*.html' | sort | xargs -I{} install -m 644 -p -v -T {} $(HTML_DESTDIR)/{}

	touch $@

# Build architecture-independent files here.
binary-indep: install-indep
ifneq ($(PACKAGES.indep),)
	rm -f $(PACKAGES.indep:%=install-%-stamp)
	dh_testdir
	dh_testroot
	dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
	dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
	dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
	dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
	dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
	dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
	dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
	dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
	dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
	dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
	dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
endif

# Build architecture-dependent files here.
binary-arch: install-arch
ifneq ($(PACKAGES.arch),)
	rm -f $(PACKAGES.arch:%=install-%-stamp)
	dh_testdir
	dh_testroot
	dh_lintian           $(verbose) $(PACKAGES.arch:%=-p%)
	dh_installdocs       $(verbose) $(PACKAGES.arch:%=-p%)
	dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
	dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
	dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
	dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
	dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
	dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
	dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
	dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
	dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
	dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
endif