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
|
#!/usr/bin/make -f
# -*- makefile -*-
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
DEB_BUILD_OPTIONS += abi=time64
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
include /usr/share/dpkg/pkg-info.mk
export RUBY_VERSION := $(patsubst ruby%,%,$(DEB_SOURCE))
export RUBY_API_VERSION := $(RUBY_VERSION).0
configure_options += --prefix=/usr
configure_options += --enable-multiarch
configure_options += --target=$(DEB_HOST_MULTIARCH)
configure_options += --program-suffix=$(RUBY_VERSION)
configure_options += --with-soname=ruby-$(RUBY_VERSION)
configure_options += --enable-shared
configure_options += --disable-rpath
configure_options += --with-sitedir='/usr/local/lib/site_ruby'
configure_options += --with-sitearchdir="/usr/local/lib/$(DEB_HOST_MULTIARCH)/site_ruby"
configure_options += --runstatedir=/var/run
configure_options += --localstatedir=/var
configure_options += --sysconfdir=/etc
# These are embedded in rbconfig.rb and should be triplet-prefixed for
# cross compilation.
configure_options += AS=$(DEB_HOST_GNU_TYPE)-as
configure_options += CC=$(DEB_HOST_GNU_TYPE)-gcc
configure_options += CXX=$(DEB_HOST_GNU_TYPE)-g++
configure_options += LD=$(DEB_HOST_GNU_TYPE)-ld
ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
# Cross-building. This is the same logic that debhelper's
# lib/Debian/Debhelper/Buildsystem/autoconf.pm uses.
# note that you also need --with-baseruby, so use the "cross" build-profile.
configure_options += --build=$(DEB_BUILD_GNU_TYPE)
configure_options += --host=$(DEB_HOST_GNU_TYPE)
endif
ifneq ($(filter cross,$(DEB_BUILD_PROFILES)),)
configure_options += --with-baseruby=/usr/bin/$(DEB_SOURCE)
endif
# the following are ignored by ./configure, but used by some extconf.rb scripts
configure_options += --enable-ipv6
configure_options += --with-dbm-type=gdbm_compat
# do not compress debug sections for arch-dep Ruby packages with dh_compat 12
configure_options += --with-compress-debug-sections=no
# hardening and other standard Debian build flags
# TODO: remove optimize=-lto once we import ruby 3.1.0 where
# https://bugs.ruby-lang.org/issues/18062 is apparently fixed
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow optimize=-lto
configure_options += $(shell dpkg-buildflags --export=configure)
# Pass variables to ensure consistent values when built on a usrmerge
# or non-usrmerge system.
configure_options += EGREP='/bin/grep -E'
configure_options += GREP='/bin/grep'
configure_options += MAKEDIRS='/bin/mkdir -p'
configure_options += MKDIR_P='/bin/mkdir -p'
configure_options += SHELL='/bin/sh'
configure_options += PKG_CONFIG=$(DEB_HOST_GNU_TYPE)-pkg-config
# Requires Rust
configure_options += --disable-yjit
# For more info see #999351
ifneq (,$(filter $(DEB_HOST_ARCH),alpha))
export DEB_CFLAGS_MAINT_APPEND += -O1
endif
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93808
ifneq (,$(filter $(DEB_HOST_ARCH),sh3 sh4))
export DEB_CFLAGS_MAINT_APPEND += -fno-crossjumping
endif
export LANG := C.UTF-8
export LC_ALL := $(LANG)
%:
dh $@
override_dh_auto_configure:
cp /usr/share/misc/config.guess tool
cp /usr/share/misc/config.sub tool
./configure $(configure_options)
override_dh_auto_clean:
$(MAKE) clean || true
$(MAKE) distclean-ext || true
rm -f tool/config.guess tool/config.sub
$(RM) test/excludes/$(DEB_HOST_ARCH)
$(RM) -r .ext
$(RM) -r doc/capi
$(RM) .installed.list GNUmakefile Makefile builtin_binary.inc \
config.status enc.mk uncommon.mk verconf.h config.log
override_dh_auto_build-arch:
dh_auto_build -- main V=1
sed -i -e "s,$(CURDIR),BUILDDIR,g" ./rbconfig.rb
# see full list in common.mk (search for /^check:/)
TEST_TARGETS := test test-tool test-all # missing test-spec
excludes =
excludes += --excludes-dir=debian/tests/excludes/any/
excludes += --excludes-dir=debian/tests/excludes/$(DEB_HOST_ARCH)/
ifneq (,$(DEBIAN_RUBY_EXTRA_TEST_EXCLUDES))
excludes += --excludes-dir=debian/tests/excludes/$(DEBIAN_RUBY_EXTRA_TEST_EXCLUDES)/
endif
override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
# dpkg-source does not allow empty file creation via patch file.
# This is needed by openssl 3.0.0
touch $(CURDIR)/test/openssl/fixtures/pkey/empty.pem
$(MAKE) $(TEST_TARGETS) V=1 RUBY_TESTOPTS=-v TESTS="$(excludes)" OPENSSL_CONF=$(CURDIR)/debian/openssl.cnf
endif
override_dh_auto_install-arch:
$(MAKE) install-nodoc V=1 DESTDIR=$(CURDIR)/debian/tmp
# 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) -r $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/rubygems/ssl_certs/*
$(RM) -r $(CURDIR)/debian/tmp/usr/lib/ruby/$(RUBY_API_VERSION)/bundler/ssl_certs/*
# remove extension build directories
$(RM) -r $(CURDIR)/debian/tmp/usr/lib/ruby/gems/$(RUBY_API_VERSION)/gems/*/ext/
# ship rubygems system install directory
mkdir -p $(CURDIR)/debian/tmp/var/lib/gems/$(RUBY_API_VERSION)
# fix pkg-config
# FIXME there is probably less brutal way of doing this
sed -i -e 's/^DLDFLAGS=.*/DLDFLAGS=/; s/LIBPATH=.*/LIBPATH=/' \
$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/ruby-$(RUBY_VERSION).pc
# 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
find $(CURDIR)/debian/ruby$(RUBY_VERSION)-doc -name created.rid -delete
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
find $(CURDIR)/debian/libruby$(RUBY_VERSION)/usr/lib/ruby/gems/$(RUBY_API_VERSION)/gems/ \
'(' -name \*.so -or -name \*.o ')' \
-delete
find $(CURDIR)/debian/ruby$(RUBY_VERSION)/usr/bin -name \*.lock -delete
override_dh_gencontrol:
./debian/genprovides $(CURDIR)/debian/libruby$(RUBY_VERSION)/usr/lib/ruby/gems/$(RUBY_API_VERSION)/specifications/ \
>> debian/libruby$(RUBY_VERSION).substvars
dh_gencontrol
|