File: rules

package info (click to toggle)
elfutils 0.194-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,680 kB
  • sloc: ansic: 114,970; sh: 35,537; cpp: 4,998; makefile: 1,986; yacc: 1,388; lex: 130; asm: 77; sed: 39; awk: 35
file content (192 lines) | stat: -rwxr-xr-x 5,349 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
#!/usr/bin/make -f
# -*- makefile -*-
# Copyright 2006, Kurt Roeckx <kurt@roeckx.be>

# Based on the sample file from dh-make:
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

DISTRO = $(shell lsb_release -is)

# 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)
DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
        confflags += --build=$(DEB_HOST_GNU_TYPE) --enable-maintainer-mode
else
        confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    USE_JOBS = -j$(NUMJOBS)
endif

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

# https://sourceware.org/pipermail/elfutils-devel/2020q2/002733.html
ifneq (,$(findstring -flto, $(CFLAGS)))
  CFLAGS += -flto-partition=none -Wno-error=stack-usage=
  CXXFLAGS += -flto-partition=none
  LDFLAGS += -Wno-error=stack-usage=
endif
CFLAGS := $(patsubst -O%,-O3, $(CFLAGS))
CXXFLAGS := $(patsubst -O%,-O3, $(CXXFLAGS))

# debuginfod configuration flags.
ifneq (,$(filter pkg.elfutils.nodebuginfod,$(DEB_BUILD_PROFILES)))
  conf_debuginfod = \
	--disable-libdebuginfod \
	--disable-debuginfod
else
  conf_debuginfod = \
	--enable-libdebuginfod \
	--enable-debuginfod

  ifeq ($(DISTRO),Debian)
    conf_debuginfod += \
	--enable-debuginfod-urls="https://debuginfod.debian.net"
  else ifeq ($(DISTRO),Ubuntu)
    conf_debuginfod += \
	--enable-debuginfod-urls="https://debuginfod.ubuntu.com"
  endif
endif


stamps/configure:
	dh_testdir
	dh_autoreconf
	@mkdir -p stamps
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	CFLAGS='$(CFLAGS_FOR_BUILD)' \
	CPPFLAGS='$(CPPFLAGS_FOR_BUILD)' \
	CXXFLAGS='$(CXXFLAGS_FOR_BUILD)' \
	LDFLAGS='$(LDFLAGS_FOR_BUILD)' \
	./configure --enable-maintainer-mode \
		--enable-libdebuginfod=dummy \
		--disable-debuginfod
	$(MAKE) $(USE_JOBS)
	$(MAKE) clean
endif
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
		./configure $(confflags) --prefix=/usr \
		--sysconfdir=/etc \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--program-prefix=eu- --disable-silent-rules \
		$(conf_debuginfod)
	touch $@

build: stamps/build
stamps/build: stamps/configure
	dh_testdir

	$(MAKE) $(USE_JOBS)

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Check that those files exist.
	-ls -l /proc/$$$$/maps
	-ls -l /proc/$$$$/auxv
	-ls -l /proc/$$$$/
	-LC_CTYPE=C $(MAKE) check $(USE_JOBS) || { cat tests/test-suite.log; exit 1; }
	cat tests/test-suite.log
endif

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -rf stamps
	[ ! -f Makefile ] || $(MAKE) distclean
	dh_autoreconf_clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	: # Add here commands to install the package into debian/tmp
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

	: # We do not provide a libebl anymore, use libdw instead.
	rm -f debian/tmp/usr/include/elfutils/libebl.h

	: # We don't install the systemd service file.
	rm -f debian/tmp/usr/share/man/man8/debuginfod.service.8

	: # Don't package fish.
	rm -rf debian/tmp/usr/share/fish

	dh_install --sourcedir=debian/tmp
	rm -f debian/elfutils/usr/bin/debuginfod*
	dh_missing --fail-missing --sourcedir=debian/tmp

# Build architecture-independent files here.
build-indep: build
binary-indep: build-indep install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i ChangeLog
	dh_installdocs -i

	dh_compress -i
	dh_fixperms -i
	dh_installdebconf -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# We have nothing to do.

# Build architecture-dependent files here.
build-arch: build
binary-arch: build-arch install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a ChangeLog
	dh_installdocs -a

	: # FIXME: package those ...
#	find debian/tmp -name '*debuginfod*' | xargs -r rm -f
#	rm -f debian/tmp/usr/share/man/man1/eu-elfclassify.1
#	rm -f debian/tmp/usr/share/man/man1/eu-readelf.1
#	rm -f debian/tmp/usr/share/man/man3/elf_*.3

	dh_dwz -a
	dh_strip -a
	dh_strip_nondeterminism -a
	dh_compress -a
	dh_fixperms -a
	dpkg-gensymbols -Pdebian/libdw1t64/ -plibdw1t64 -c4
	dpkg-gensymbols -Pdebian/libasm1t64/ -plibasm1t64 -c4
	dpkg-gensymbols -Pdebian/libelf1t64/ -plibelf1t64 -c4
	dh_makeshlibs -plibelf1t64 -V "libelf1t64 (>= 0.132)"
	dh_makeshlibs -plibasm1t64 -V "libasm1t64 (>= 0.132)"
	dh_makeshlibs -plibdw1t64 -V "libdw1t64 (>= 0.138)"
	dh_makeshlibs -plibdebuginfod1t64
	dh_installdebconf -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

maint-unpatch:
	bash debian/unpatch.sh debian/patches

.PHONY: build clean binary-indep binary-arch binary install maint-unpatch