summaryrefslogtreecommitdiff
path: root/debian/rules
blob: ae5c14a48dd22e0159cda7b3ce2fdbb005b42f09 (plain)
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
#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/dpkg/architecture.mk

export DH_VERBOSE=1

export DEBIAN_DISABLE_RUBYGEMS_INTEGRATION = 1

# This has to be exported to make some magic below work.
export DH_OPTIONS
TESTOPTS += -v
export TESTOPTS

export SOURCE             := $(shell dpkg-parsechangelog -SSource)
export RUBY_VERSION       := $(patsubst ruby%,%,$(SOURCE))
export RUBY_API_VERSION   := $(RUBY_VERSION).0

# Bootstrap with Ruby 1.8 if proper Ruby is not available
baseruby=$(shell test -x /usr/bin/ruby && echo /usr/bin/ruby || echo /usr/bin/ruby1.8)

configure_options += --enable-multiarch
configure_options += --target=$(DEB_HOST_GNU_TYPE)
configure_options += --program-suffix=$(RUBY_VERSION)
configure_options += --with-soname=ruby-$(RUBY_VERSION)
configure_options += --enable-shared
configure_options += --disable-rpath
configure_options += --with-baseruby=$(baseruby)
configure_options += --with-sitedir='/usr/local/lib/site_ruby'
configure_options += --with-sitearchdir="/usr/local/lib/$(DEB_HOST_MULTIARCH)/site_ruby"

# the following are ignored by ./configure, but used by some extconf.rb scripts
configure_options += --enable-ipv6
configure_options += --with-dbm-type=gdbm_compat

# hardening and other standard Debian build flags
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
configure_options += $(shell dpkg-buildflags --export=configure)

# Always build with /bin/bash, to get consistent rbconfig.rb (which embeds SHELL).
export SHELL := /bin/bash

vtcltk=8.6
configure_options += --with-tcltkversion=$(vtcltk)
configure_options += --with-tclConfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl$(vtcltk)/tclConfig.sh
configure_options += --with-tkConfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/tk$(vtcltk)/tkConfig.sh
configure_options += --with-tcllib=tcl$(vtcltk)
configure_options += --with-tklib=tk$(vtcltk)
configure_options += --with-tcl-include=/usr/include/tcl$(vtcltk)
configure_options += --with-tk-include=/usr/include/tcl$(vtcltk)
configure_options += --with-tcl-lib=/usr/lib/$(DEB_HOST_MULTIARCH)
configure_options += --with-tk-lib=/usr/lib/$(DEB_HOST_MULTIARCH)

%:
	dh $@ --parallel --with autotools-dev --with autoreconf

override_dh_auto_configure:
	cp /usr/share/misc/config.guess tool
	cp /usr/share/misc/config.sub tool
	dh_auto_configure -- $(configure_options)

override_dh_auto_clean:
	dh_auto_clean
	rm -f tool/config.guess tool/config.sub
	$(RM) -r .ext
	$(RM) -r doc/capi

override_dh_auto_build-arch:
	dh_auto_build -- main V=1

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(MAKE) check V=1
endif

override_dh_auto_install-arch:
	$(MAKE) install-nodoc V=1 DESTDIR=$(CURDIR)/debian/tmp
	# remove RPATH from tcltklib bindings
	chrpath --delete $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/ruby/$(RUBY_API_VERSION)/tcltklib.so
	# handle embedded copy of jquery
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/js/jquery.js
	dh_link -plibruby$(RUBY_VERSION) /usr/share/javascript/jquery/jquery.min.js /usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/js/jquery.js
	# handle embedded copy of Lato (font)
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
	dh_link -plibruby$(RUBY_VERSION) /usr/share/fonts/truetype/lato/Lato-Regular.ttf /usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
	dh_link -plibruby$(RUBY_VERSION) /usr/share/fonts/truetype/lato/Lato-Italic.ttf /usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
	dh_link -plibruby$(RUBY_VERSION) /usr/share/fonts/truetype/lato/Lato-Light.ttf /usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
	dh_link -plibruby$(RUBY_VERSION) /usr/share/fonts/truetype/lato/Lato-LightItalic.ttf /usr/lib/ruby/$(RUBY_API_VERSION)/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
	# remove embedded SSL certificates (replaced using ca-certificates via rubygems-integration)
	$(RM) $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rubygems/ssl_certs/*
	# ship rubygems system install directory
	mkdir -p $(CURDIR)/debian/tmp/var/lib/gems/$(RUBY_API_VERSION)
	# sanity check
	debian/sanity_check

override_dh_auto_build-indep:
	$(MAKE) docs V=1

override_dh_auto_install-indep:
	$(MAKE) install-doc V=1 DESTDIR=$(CURDIR)/debian/ruby$(RUBY_VERSION)-doc

override_dh_install-arch:
	# install SystemTap tapfile
	mkdir -p $(CURDIR)/debian/tmp/usr/share/systemtap/tapset
	sed 's|@LIBRARY_PATH@|/usr/lib/$(DEB_HOST_MULTIARCH)/libruby-$(RUBY_VERSION).so|g' $(CURDIR)/debian/libruby.stp > $(CURDIR)/debian/tmp/usr/share/systemtap/tapset/libruby$(RUBY_VERSION)-$(DEB_HOST_MULTIARCH).stp
	dh_install
	# split Ruby/Tk files
	$(baseruby) debian/split-tk-out.rb

import-orig-source:
	test -d .git
	test -n "$$UPSTREAM_GIT"
	test -n "$$UPSTREAM_VERSION"
	cd $(UPSTREAM_GIT) && git archive --format=tar --prefix=ruby-$(UPSTREAM_VERSION)/ v$(shell echo $(UPSTREAM_VERSION) | tr . _) | xz -c > /tmp/ruby-$(UPSTREAM_VERSION).tar.xz
	gbp import-orig /tmp/ruby-$(UPSTREAM_VERSION).tar.xz

.PHONY: override_dh_strip
override_dh_strip:
	dh_strip --dbgsym-migration=libruby$(RUBY_VERSION)-dbg' (<< 2.3.1-3~)'