File: rules

package info (click to toggle)
ruby 1.6.7-3woody4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,244 kB
  • ctags: 33
  • sloc: makefile: 400; sh: 346; ruby: 6
file content (411 lines) | stat: -rwxr-xr-x 13,628 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
#!/usr/bin/make -f
include debian/scripts/vars
BUILD_DIR=$(SOURCE_DIR)/$(TAR_DIR)

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

arch       := $(DEB_BUILD_ARCH)
pwd        := $(shell pwd)

#prog_sfx   := 16
prog_sfx   := 

rb_name    := ruby
ruby       := $(BUILD_DIR)/miniruby

el_base    := $(pwd)/debian/$(rb_name)-elisp
el_dir     := $(el_base)/usr/share/emacs/site-lisp/$(rb_name)-elisp
el_etc     := $(el_base)/etc/emacs/site-start.d

target_os  := $(arch)-linux
arch_dir   := $(target_os)

find_examples_param := -name '*.rb' -type f -not -name 'extconf.rb' -not -path '*/lib/*'

# BEGIN HACK for ia64
ifeq ($(arch),ia64)
CFLAGS += -O0
endif
# END HACK for ia64

# BEGIN HACK for m68k
ifeq ($(arch),m68k)
CFLAGS += -O
endif
# END HACK for m68k

CONFIGURE_ENV := 

# BEGIN HACK for Bug#112367
CONFIGURE_ENV += rb_cv_func_strtod=no
# END HACK for Bug#112367

ifdef CFLAGS
CONFIGURE_ENV += CFLAGS="$(CFLAGS)"
endif

build: $(STAMP_DIR)/source.build $(STAMP_DIR)/build
STAMP_DIR_TARGETS+= $(STAMP_DIR)/build
$(STAMP_DIR)/build:
	dh_testdir

	cd $(BUILD_DIR) && \
	  autoconf
	cd $(BUILD_DIR) && \
	$(CONFIGURE_ENV) ./configure \
	  --program-suffix=$(prog_sfx) \
	  --prefix='/usr' \
	  --datadir='$${prefix}/share' \
	  --mandir='$${datadir}/man' \
	  --sysconfdir='/etc' \
	  --localstatedir='/var' \
	  --with-sitedir='$${prefix}/local/lib/site_ruby' \
	  --with-default-kcode=none \
	  --with-dbm-include=/usr/include/db1 \
	  --with-tklib=tk8.3 \
	  --with-tk-include=/usr/include/tk8.3 \
	  --with-tcllib=tcl8.3 \
	  --with-tcl-include=/usr/include/tcl8.3 \
	  --enable-shared \
	  --enable-ipv6 \
	  --with-lookup-order-hack=INET \
	  $(target_os)

	$(MAKE) -C $(BUILD_DIR)
	LD_LIBRARY_PATH=$(BUILD_DIR) make -C $(BUILD_DIR) test

	touch $(STAMP_DIR)/build

rb_ver_file     = $(shell grep RUBY_VERSION $(BUILD_DIR)/version.h)
rb_major_ver    = $(shell expr '$(rb_ver_file)' : '\#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"')
rb_minor_ver    = $(shell expr '$(rb_ver_file)' : '\#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"')
rb_teeny_ver    = $(shell expr '$(rb_ver_file)' : '\#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"')
rb_version      = $(rb_major_ver).$(rb_minor_ver)
rb_version_full = $(rb_major_ver).$(rb_minor_ver).$(rb_teeny_ver)
irb_base        = $(pwd)/debian/irb$(prog_sfx)
irb_bin         = $(irb_base)/usr/bin
irb_lib         = $(irb_base)/usr/lib/$(rb_name)/$(rb_version)/irb

$(STAMP_DIR)/source.build:
	dh_testdir
	$(MAKE) -f debian/sys-build.mk source.make

clean:
	dh_testdir
	dh_testroot

	# No need to run make clean etc.
	$(MAKE) -f debian/sys-build.mk source.clean
	rm -rf $(STAMP_DIR)

	-rm -f \
	  debian/dirs \
	  debian/irb$(prog_sfx).files \
	  debian/lib$(rb_name)$(prog_sfx).postinst \
	  debian/lib$(rb_name)$(prog_sfx).prerm \
	  debian/libcurses-$(rb_name)$(prog_sfx).files \
	  debian/libdbm-$(rb_name)$(prog_sfx).files \
	  debian/libgdbm-$(rb_name)$(prog_sfx).files \
	  debian/libnkf-$(rb_name)$(prog_sfx).files \
	  debian/libpty-$(rb_name)$(prog_sfx).files \
	  debian/libreadline-$(rb_name)$(prog_sfx).files \
	  debian/libsdbm-$(rb_name)$(prog_sfx).files \
	  debian/libtcltk-$(rb_name)$(prog_sfx).files \
	  debian/libtk-$(rb_name)$(prog_sfx).files \
	  debian/libsyslog-$(rb_name)$(prog_sfx).files \
	  debian/$(rb_name)$(prog_sfx)-dev.files

	dh_clean

install: $(STAMP_DIR)/install
STAMP_DIR_TARGETS+= $(STAMP_DIR)/install
$(STAMP_DIR)/install: $(STAMP_DIR)/build
	dh_testdir
	dh_testroot
	dh_clean -k

	#
	# make dirs, ruby.{postinst,prerm}
	#
	for s in dirs lib$(rb_name)$(prog_sfx).postinst lib$(rb_name)$(prog_sfx).prerm; do \
	  $(ruby) -r $(BUILD_DIR)/rbconfig.rb \
	    -pe '$$_.gsub!(/@@sitebase@@/, File.dirname(Config::CONFIG["sitedir"])); \
	         $$_.gsub!(/@@sitedir@@/, Config::CONFIG["sitedir"]); \
	         $$_.gsub!(/@@version@@/, "$(rb_version)"); \
	         $$_.gsub!(/@@arch@@/, Config::CONFIG["arch"])' \
	      < debian/$$s.in > debian/$$s; \
	  chmod +x debian/$$s; \
	done
	dh_installdirs

	# Add here commands to install the package into debian/tmp.
	#$(MAKE) prefix=`pwd`/debian/tmp/usr install
	$(MAKE) -C $(BUILD_DIR) DESTDIR=$(pwd)/debian/tmp install
	cd debian/tmp/usr && rm -rf local

	#
	# movefiles
	#

	# libcurses-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/curses.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/curses/MANIFEST) \
	> debian/libcurses-$(rb_name)$(prog_sfx).files

	# libdbm-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/dbm.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/dbm/MANIFEST) \
	> debian/libdbm-$(rb_name)$(prog_sfx).files

	# libgdbm-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/gdbm.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/gdbm/MANIFEST) \
	> debian/libgdbm-$(rb_name)$(prog_sfx).files

	# libnkf-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/nkf.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/nkf/MANIFEST) \
	> debian/libnkf-$(rb_name)$(prog_sfx).files

	# libpty-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/pty.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/pty/MANIFEST) \
	> debian/libpty-$(rb_name)$(prog_sfx).files

	# libreadline-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/readline.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/readline/MANIFEST) \
	> debian/libreadline-$(rb_name)$(prog_sfx).files

	# libsdbm-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/sdbm.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/sdbm/MANIFEST) \
	> debian/libsdbm-$(rb_name)$(prog_sfx).files

	# libtcltk-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/tcltklib.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/tcltklib/MANIFEST) \
	> debian/libtcltk-$(rb_name)$(prog_sfx).files

	# libtk-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/tkutil.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/tk/MANIFEST) \
	> debian/libtk-$(rb_name)$(prog_sfx).files

	# libsyslog-ruby
	(echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/syslog.so; \
	 $(ruby) debian/greplib.rb $(rb_version) $(BUILD_DIR)/ext/syslog/MANIFEST) \
	> debian/libsyslog-$(rb_name)$(prog_sfx).files

	dh_movefiles -plibcurses-$(rb_name)$(prog_sfx)
	dh_movefiles -plibdbm-$(rb_name)$(prog_sfx)
	dh_movefiles -plibgdbm-$(rb_name)$(prog_sfx)
	dh_movefiles -plibnkf-$(rb_name)$(prog_sfx)
	dh_movefiles -plibpty-$(rb_name)$(prog_sfx)
	dh_movefiles -plibreadline-$(rb_name)$(prog_sfx)
	dh_movefiles -plibsdbm-$(rb_name)$(prog_sfx)
	dh_movefiles -plibtcltk-$(rb_name)$(prog_sfx)
	dh_movefiles -plibtk-$(rb_name)$(prog_sfx)
	dh_movefiles -plibsyslog-$(rb_name)$(prog_sfx)

	# ruby-dev
	(echo usr/lib/lib$(rb_name)$(prog_sfx).so; \
	 echo usr/lib/$(rb_name)/$(rb_version)/mkmf.rb; \
	 cd debian/tmp/usr/lib/$(rb_name)/$(rb_version)/$(arch_dir); \
	 for h in *.a *.h; do \
	   echo usr/lib/$(rb_name)/$(rb_version)/$(arch_dir)/$$h; \
	 done) \
	> debian/$(rb_name)$(prog_sfx)-dev.files
	dh_movefiles -p$(rb_name)$(prog_sfx)-dev

	# irb
	(cd debian/tmp/usr/lib/$(rb_name)/$(rb_version)/irb; \
	 for r in *; do \
	   echo usr/lib/$(rb_name)/$(rb_version)/irb/$$r; \
	 done) \
	> debian/irb$(prog_sfx).files
	dh_movefiles -pirb$(prog_sfx)

	# libruby
	# split dh_movefiles for libruby for the ordering reasen... 
	# (see packaging manual chapter 12)
	dh_movefiles -plib$(rb_name)$(prog_sfx) \
	  usr/lib/lib$(rb_name)$(prog_sfx).so.$(rb_version_full) \
	  usr/lib/$(rb_name)
	dh_movefiles -plib$(rb_name)$(prog_sfx) \
	  usr/lib/lib$(rb_name)$(prog_sfx).so.$(rb_version)

	# ruby-elisp
	install -d $(el_dir)
	install -d $(el_etc)
	install -m444 $(BUILD_DIR)/misc/*.el $(el_dir)

	# irb
	install -d $(irb_bin)
	#install -m555 $(BUILD_DIR)/sample/irb.rb $(irb_bin)/irb$(prog_sfx)
	mv $(pwd)/debian/tmp/usr/bin/irb $(irb_bin)/irb$(prog_sfx)

	# ruby-examples
	#dh_movefiles -p$(rb_name)$(prog_sfx)-examples

	# fixing `#!' line for bin...
	for f in `find $(pwd)/debian -path '*/usr/bin/*' -type f`; \
	do \
	  cp -p $$f $$f.tmp; \
	  sed -e '1,1s,^#![ 	]*\([^ 	]*\)/\(ruby\|env ruby\),#!/usr/bin/\2$(prog_sfx),' < $$f > $$f.tmp; \
	  if ! cmp $$f $$f.tmp >/dev/null; \
	  then \
	    mv -f $$f.tmp $$f; \
	  else \
	    rm -f $$f.tmp; \
	  fi; \
	done

	# removing `#!' line for libs...
	for f in `find $(pwd)/debian -path '*/usr/lib/$(rb_name)/$(rb_version)/*' -name '*.rb' -type f`; \
	do \
	  sed -e '1,1s/^#!.*//' -e '/^$$/,1d' < $$f > $$f.tmp; \
	  mv -f $$f.tmp $$f; \
	done

	touch $(STAMP_DIR)/install

binary-indep: build install
# Add rules here to build the indep debs.
#	dh_testversion
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installdocs -p$(rb_name)$(prog_sfx)-elisp $(BUILD_DIR)/misc/README
	dh_installdocs -pirb$(prog_sfx) \
	  $(BUILD_DIR)/doc/irb/*

#	dh_installexamples -i
	# XXX:
	#dh_installexamples -p$(rb_name)$(prog_sfx)-examples \
	#  $(filter-out %/irb.rb,$(wildcard build-tree/$(rb_name)$(prog_sfx)-$(rb_version).4/sample/*))
	dh_installexamples -p$(rb_name)$(prog_sfx)-examples \
	  $(filter-out %/irb.rb,$(wildcard build-tree/$(rb_name)$(prog_sfx)-$(rb_version_full)/sample/*))
	dh_installmenu -i
	dh_installemacsen -i
#	dh_installpam -i
#	dh_installinit -i
#	dh_installcron -i
#	dh_installmanpages -i
	dh_installmanpages -pirb$(prog_sfx) $(rb_name)$(prog_sfx).1
#	dh_undocumented -i
#	dh_undocumented -pirb$(prog_sfx) irb$(prog_sfx).1
	dh_installchangelogs -i
	dh_link -i
	dh_compress -i -X.rb -X.pl -X.py -X.scm -X.awk -X.dat
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
# Add rules here to build the arch debs.
#	dh_testversion
	dh_testdir -a
	dh_testroot -a

	dh_installdocs -a
	# documents for libcurses-$(rb_name)$(prog_sfx)
	# documents for libdbm-$(rb_name)$(prog_sfx)
	# documents for libgdbm-$(rb_name)$(prog_sfx)
	dh_installdocs -plibgdbm-$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/ext/gdbm/README
	# documents for libnkf-$(rb_name)$(prog_sfx)
	# documents for libpty-$(rb_name)$(prog_sfx)
	dh_installdocs -plibpty-$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/ext/pty/README*
	# documents for libreadline-$(rb_name)$(prog_sfx)
	dh_installdocs -plibreadline-$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/ext/readline/README*
	# documents for lib$(rb_name)$(prog_sfx)
	dh_installdocs -plib$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/lib/README \
	  $(BUILD_DIR)/ext/etc/*.txt* \
	  $(BUILD_DIR)/ext/digest/*.txt* \
	  $(BUILD_DIR)/doc/*rd* \
	  $(BUILD_DIR)/doc/net/*rd* \
	  $(BUILD_DIR)/doc/NEWS
	# documents for libsdbm-$(rb_name)$(prog_sfx)
	# documents for libtcltk-$(rb_name)$(prog_sfx)
	dh_installdocs -plibtcltk-$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/ext/tcltklib/README* \
	  $(BUILD_DIR)/ext/tcltklib/MANUAL*
	# documents for libtk-$(rb_name)$(prog_sfx)
	# documents for libsyslog-$(rb_name)$(prog_sfx)
	dh_installdocs -plibsyslog-$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/ext/syslog/syslog.txt
	# documents for $(rb_name)$(prog_sfx)
	dh_installdocs -p$(rb_name)$(prog_sfx) \
	  $(BUILD_DIR)/COPYING \
	  $(BUILD_DIR)/COPYING.ja \
	  $(BUILD_DIR)/LEGAL \
	  $(BUILD_DIR)/README \
	  $(BUILD_DIR)/README.ja \
	  $(BUILD_DIR)/ToDo \
	  $(BUILD_DIR)/doc/NEWS
	# documents for $(rb_name)$(prog_sfx)-dev
	dh_installdocs -p$(rb_name)$(prog_sfx)-dev \
	  $(BUILD_DIR)/README.EXT \
	  $(BUILD_DIR)/README.EXT.ja

#	dh_installexamples -a
	# examples for libcurses-$(rb_name)$(prog_sfx)
	dh_installexamples -plibcurses-$(rb_name)$(prog_sfx) \
	  `find $(BUILD_DIR)/ext/curses $(find_examples_param)`
	# examples for libdbm-$(rb_name)$(prog_sfx)
	# examples for libgdbm-$(rb_name)$(prog_sfx)
	# examples for libnkf-$(rb_name)$(prog_sfx)
	dh_installexamples -plibnkf-$(rb_name)$(prog_sfx) \
	  `find $(BUILD_DIR)/ext/nkf $(find_examples_param)`
	# examples for libpty-$(rb_name)$(prog_sfx)
	dh_installexamples -plibpty-$(rb_name)$(prog_sfx) \
	  `find $(BUILD_DIR)/ext/pty $(find_examples_param)`
	# examples for libreadline-$(rb_name)$(prog_sfx)
	# examples for lib$(rb_name)$(prog_sfx)
	# examples for libsdbm-$(rb_name)$(prog_sfx)
	# examples for libtcltk-$(rb_name)$(prog_sfx)
	install -d $(pwd)/debian/libtcltk-$(rb_name)$(prog_sfx)/usr/share/doc/libtcltk-$(rb_name)$(prog_sfx)/exmaples
	(cd $(BUILD_DIR)/ext/tcltklib && \
	 tar cf - demo sample) | \
	  (cd $(pwd)/debian/libtcltk-$(rb_name)$(prog_sfx)/usr/share/doc/libtcltk-$(rb_name)$(prog_sfx)/exmaples && tar xvf -)
	# examples for libtk-$(rb_name)$(prog_sfx)
	dh_installexamples -plibtk-$(rb_name)$(prog_sfx) \
	  `find $(BUILD_DIR)/ext/tk $(find_examples_param)`
	dh_installexamples -plibsyslog-$(rb_name)$(prog_sfx) \
	  `find $(BUILD_DIR)/ext/syslog $(find_examples_param)`
	# fixing `#!' path for examples...
	for f in `find $(pwd)/debian -path '*/usr/share/doc/*/examples/*' -type f`; \
	do \
	  sed -e '1,1s,^#![ 	]*\([^ 	]*\)/\(ruby\|wish\|perl\|env ruby\),#!/usr/bin/\2,' < $$f > $$f.tmp; \
	  mv -f $$f.tmp $$f; \
	  sed -e '1,1s,^#![ 	]*\([^ 	]*\)/\(ruby\|env ruby\),#!/usr/bin/\2$(prog_sfx),' < $$f > $$f.tmp; \
	  mv -f $$f.tmp $$f; \
	done
	dh_installmenu -a
	dh_installemacsen -a
#	dh_installpam -a
#	dh_installinit -a
#	dh_installcron -a
#	dh_installmanpages -a
#	dh_undocumented
	dh_installchangelogs -a $(BUILD_DIR)/ChangeLog
	dh_strip -a
	dh_link -a
	dh_compress -a -X.rb -X.pl -X.py -X.scm -X.awk -X.dat
	dh_fixperms -a
	dh_installdeb -a
	dh_makeshlibs -m$(rb_version) -plib$(rb_name)$(prog_sfx) -V
	dh_shlibdeps -a \
	  -l$(pwd)/debian/libruby$(prog_sfx)/usr/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch