File: rules

package info (click to toggle)
readline5 5.2+dfsg-3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 3,016 kB
  • ctags: 2,032
  • sloc: ansic: 22,060; sh: 5,191; perl: 4,105; makefile: 1,353
file content (268 lines) | stat: -rwxr-xr-x 7,669 bytes parent folder | download
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/dpatch/dpatch.make

soversion = 5
libversion = $(soversion).2

# architecture dependent variables
DEB_HOST_ARCH		?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS	?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

distribution := $(shell lsb_release -is)

DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/buildflags.mk

ifeq ($(origin CC),default)
CC = $(DEB_HOST_GNU_TYPE)-gcc
endif

CFLAGS += -g -O2

ifeq ($(DEB_HOST_ARCH_OS),netbsd)
  CC_LINK_FLAGS =
else
  CC_LINK_FLAGS = -Wl,
endif

SHELL	= bash

p_rl	= libreadline$(soversion)
p_comm	= readline-common
p_rld	= libreadline-gplv2-dev
p_rlg	= $(p_rl)-dbg
p_doc	= $(p_rl)-doc
p_rlfe	= rlfe

d	= debian/tmp
d_rl	= debian/$(p_rl)
d_comm	= debian/$(p_comm)
d_rld	= debian/$(p_rld)
d_rlg	= debian/$(p_rlg)
d_doc	= debian/$(p_doc)
d_rlfe	= debian/$(p_rlfe)

srcdir		= $(CURDIR)
builddir	= $(CURDIR)/build

default: build

configure: dpatch configure-stamp
configure-stamp: patch-stamp
	dh_testdir
	cp -p /usr/share/misc/config.* ./support/
	rm -rf $(builddir)
	mkdir $(builddir)
	find . -type d | xargs chmod g-s
	cd $(builddir) && \
	  CC=$(CC) $(srcdir)/configure \
		--with-curses --prefix=/usr\
		--host=$(DEB_HOST_GNU_TYPE) \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

	touch configure-stamp

#ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
#build: build-stamp build-rlfe-stamp
#else
build: build-stamp
#endif
build-arch: build
build-indep: build

build-stamp: configure-stamp
	dh_testdir
	$(MAKE) -C $(builddir) \
	    SHOBJ_CFLAGS="-fPIC -D_REENTRANT" \
	    SHLIB_LIBS="-ltinfo"

	$(MAKE) -C $(builddir)/doc info

	touch build-stamp

build-rlfe-stamp: configure-stamp
	dh_testdir
	ln -sf libhistory.so.$(libversion) \
	    $(builddir)/shlib/libhistory.so.$(soversion)
	ln -sf libhistory.so.$(soversion) $(builddir)/shlib/libhistory.so
	ln -sf libreadline.so.$(libversion) \
	    $(builddir)/shlib/libreadline.so.$(soversion)
	ln -sf libreadline.so.$(soversion) $(builddir)/shlib/libreadline.so
	rm -rf $(builddir)/examples/rlfe
	cp -a examples/rlfe $(builddir)/examples/
	ln -sf ../../.. $(builddir)/examples/rlfe/readline
	cd $(builddir)/examples/rlfe \
		&& ./configure --prefix=/usr --host=$(DEB_HOST_GNU_TYPE)
	$(MAKE) -C $(builddir)/examples/rlfe \
	    LDFLAGS="-g -L$(builddir)/shlib" rlfe
	touch build-rlfe-stamp

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f configure*-stamp build*-stamp install-stamp
	rm -rf autom4te.cache
	rm -rf $(builddir)
	rm -f doc/*.dvi
	rm -f debian/shlibs.local
	$(MAKE) -f debian/rules unpatch
	rm -f patch-stamp*
	find . -type d | xargs chmod g-s
	rm -f support/config.guess support/config.sub
	dh_clean

install: install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k
	rm -rf $(d)
	mkdir -p $(d)/usr/bin
	$(MAKE) -C $(builddir) install \
	    CFLAGS="-g -O2 -D_REENTRANT" \
	    DESTDIR=$(CURDIR)/$(d) \
	    mandir=/usr/share/man \
	    infodir=/usr/share/info

	: # move $(p_rl)
	dh_installdirs -p$(p_rl) \
		etc \
		lib/$(DEB_HOST_MULTIARCH) \
		usr/share/doc
	cp -a $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.so.* $(d_rl)/lib/$(DEB_HOST_MULTIARCH)
#	cp -a $(d)/usr/lib/lib{history,readline}.so.$(libversion) $(d_rl)/lib/
#	ln -s libhistory.so.$(libversion) \
#		$(d_rl)/lib/libhistory.so.$(soversion)
#	ln -s libreadline.so.$(libversion) \
#		$(d_rl)/lib/libreadline.so.$(soversion)

	: # move $(p_comm)
ifeq (0,1)
	dh_installdirs -p$(p_comm) \
		etc \
		usr/share/readline \
		usr/share/info \
		usr/share/doc
	mv $(d)/usr/share/man $(d_comm)/usr/share/.
	mv $(d_comm)/usr/share/man/man3/history.3 \
		$(d_comm)/usr/share/man/man3/history.3readline
	mv $(d_comm)/usr/share/man/man3/readline.3 \
		$(d_comm)/usr/share/man/man3/readline.3readline
	install -m 644 debian/inputrc $(d_comm)/usr/share/readline/
endif

	: # move $(p_rlg)
	dh_installdirs -p$(p_rlg) \
		usr/lib/debug \
		usr/share/doc
	mv $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.so.$(libversion) \
		$(d_rlg)/usr/lib/debug/.
	ln -s libhistory.so.$(libversion) \
		$(d_rlg)/usr/lib/debug/libhistory.so.$(soversion)
	ln -s libreadline.so.$(libversion) \
		$(d_rlg)/usr/lib/debug/libreadline.so.$(soversion)

	: # move $(p_rld)
	dh_installdirs -p$(p_rld) \
		usr/lib/$(DEB_HOST_MULTIARCH) \
		usr/share/doc
	ln -s /lib/$(DEB_HOST_MULTIARCH)/libhistory.so.$(soversion) $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/libhistory.so
	ln -s /lib/$(DEB_HOST_MULTIARCH)/libreadline.so.$(soversion) $(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/libreadline.so
	mv $(d)/usr/lib/$(DEB_HOST_MULTIARCH)/lib{history,readline}.a	$(d_rld)/usr/lib/$(DEB_HOST_MULTIARCH)/.
	mv $(d)/usr/include $(d_rld)/usr/.

	: # remove HAVE_CONFIG_H from installed headers
	awk '/^#if defined \(HAVE_CONFIG_H\)/, /^#endif/ \
	     {if ($$0 == "#else") print "#include <string.h>"; next} {print}' \
	  $(d_rld)/usr/include/readline/chardefs.h \
	  > $(d_rld)/usr/include/readline/chardefs.h.new
	if diff -u $(d_rld)/usr/include/readline/chardefs.h \
		$(d_rld)/usr/include/readline/chardefs.h.new; \
	then \
	  rm -f $(d_rld)/usr/include/readline/chardefs.h.new; \
	else \
	  mv -f $(d_rld)/usr/include/readline/chardefs.h.new \
	    $(d_rld)/usr/include/readline/chardefs.h; \
	fi

ifeq (0,1)
	: # install $(p_rlfe)
ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
	dh_installdirs -p$(p_rlfe) \
	    usr/bin usr/share/man/man1 \
	    usr/share/doc/$(p_rlfe)
	cp -p $(builddir)/examples/rlfe/rlfe $(d_rlfe)/usr/bin/.
	cp -p debian/rlfe.1 $(d_rlfe)/usr/share/man/man1/.
endif
endif

	touch install-stamp

binary-indep: build install
ifeq (0,1)
	dh_testdir
	dh_testroot
	mkdir -p $(d_comm)/usr/share/lintian/overrides
	cp -p debian/readline-common.overrides \
		$(d_comm)/usr/share/lintian/overrides/readline-common
	dh_installdocs -p$(p_comm) debian/inputrc.arrows
	dh_installchangelogs -p$(p_comm)
	dh_installdocs -p$(p_comm)
	dh_installchangelogs -p$(p_comm)
	dh_compress -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i
endif

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs -p$(p_rl) \
		USAGE debian/inputrc.arrows
	dh_installchangelogs -p$(p_rl) CHANGES
	dh_installexamples -p$(p_rl) \
		examples/Inputrc
	mkdir -p $(d_rld)/usr/share/doc/$(p_rl)/examples
	cp -p $(builddir)/examples/Makefile examples/*.c \
		$(d_rld)/usr/share/doc/$(p_rl)/examples/
	sed -i -e's,srcdir = .*/readline5-5.*/examples,srcdir = /usr/share/doc/libreadline5/examples,' \
	    -e's,VPATH = .:.*/readline5-5.*/examples,VPATH = .:/usr/share/doc/libreadline5/examples,' \
	    -e's,top_srcdir = .*/readline5-5.*,top_srcdir = /usr/include/readline/,' \
	    $(d_rld)/usr/share/doc/$(p_rl)/examples/Makefile
	ln -sf $(p_rl) $(d_rld)/usr/share/doc/$(p_rld)
	ln -sf $(p_rl) $(d_rlg)/usr/share/doc/$(p_rlg)

ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
ifeq (0,1)
	dh_installdocs -p$(p_rlfe) examples/rlfe/README
	dh_installchangelogs -p$(p_rlfe) examples/rlfe/ChangeLog
endif

	dh_fixperms -p$(p_rl) -p$(p_rld) -p$(p_rlg)
	dh_strip -p$(p_rl) -p$(p_rld) -p$(p_rlg)
	dh_compress -p$(p_rl) -p$(p_rld) -p$(p_rlg)  -X.c
	dh_makeshlibs -p$(p_rl) -V '$(p_rl) (>= 5.2)'
	cp -p debian/$(p_rl).shlibs debian/shlibs.local
	dh_shlibdeps -p$(p_rl) -p$(p_rld) -p$(p_rlg) \
		 -L $(p_rl) -l $(d_rl)/lib
endif

	dh_installdeb -s
	dh_gencontrol -s $(gencontrol_flags)
	dh_md5sums -s
	dh_builddeb -s

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean

# Local Variables:
# mode: makefile
# end: