File: rules

package info (click to toggle)
gcc-or1k-elf 1.0.10
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 64 kB
  • sloc: makefile: 53; sh: 26
file content (101 lines) | stat: -rwxr-xr-x 3,629 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
#!/usr/bin/make -f

# https://wiki.debian.org/PackagingLessCommonBinutilsTargets

# -format: errors in libcpp/expr.cc, seen with gcc-10-14
# lto: https://bugs.debian.org/1015414
DEB_BUILD_MAINT_OPTIONS := hardening=+all,-format optimize=-lto
DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/buildopts.mk
include /usr/share/dpkg/pkg-info.mk

gnu_type := or1k-elf
# Not deducible from package name because of possible underscore characters.
gnu_type_in_deb_name = $(subst _,-,$(gnu_type))
package = gcc-$(gnu_type_in_deb_name)
tmpdir = debian/$(package)

gcc-version-major := $(shell sed '/^ gcc-\(.*\)-source,$$/!d;s//\1/;q' debian/control)
# The Debian packaging calls this BV.

gcc-version != dpkg-query -Wf'$${Version}' gcc-$(gcc-version-major)-source

# https://gcc.gnu.org/install/configure.html recommends out-of-tree builds.
%:
	dh $@

execute_before_dh_update_autotools_config: src
tar_dir = /usr/src/gcc-$(gcc-version-major)
src:
	tar -xf $(tar_dir)/gcc-*.tar.xz --transform='s|[^/]*|src|'
  # git-updates.diff always exists, but may contain no diff chunk.
	if grep -q '^---' $(tar_dir)/patches/git-updates.diff; then \
	  patch -p1 < $(tar_dir)/patches/git-updates.diff; \
	fi
  # Apply patches, either local or from $(tar_dir)/patches/, with
  # 'patch -p1 < PATCH':
	patch -p1 < $(tar_dir)/patches/gcc-gfdl-build.diff

# _GCC_AUTOCONF_VERSION_CHECK in config/override.m4 requires 2.69.
override_dh_autoreconf:
	dh_autoreconf autoreconf2.69 -- -f -i -v `grep -v \# debian/autoreconf`

# libssp: libssp requires glibc
# Install to the same path hierarchy than other GCCs: neither
# multiarch components nor GCC minor versions.

# Translations would duplicate the suggested gcc-locales.
configure_options += --disable-nls

override_dh_auto_configure:
  # Imitate dh_auto_configure -- $(confargs), but without
  # --runstatedir as long as libiberty/configure cannot be refreshed.
	install -d bld
	$(filter-out --runstatedir=/run, \
	  $(shell dh_auto_configure -Dsrc -Bbld --no-act)) \
	  --target=$(gnu_type) \
	  --disable-shared \
	  --disable-multilib \
	  --disable-bootstrap \
	  --enable-languages=c \
	  --disable-libssp \
	  --libdir=\$${prefix}/lib \
	  --with-gcc-major-version-only \
	  --without-included-gettext \
	  --with-pkgversion='GCC $(gcc-version) Debian $(DEB_VERSION)' \
	  $(configure_options) \
	  --with-system-zlib

# Prevent dh_auto_{build,test,install} from parsing Makefile, see
# https://gcc.gnu.org/legacy-ml/gcc/2013-04/msg00171.html
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100933

override_dh_auto_build:
	cd bld && $(MAKE) $(addprefix -j,$(DEB_BUILD_OPTION_PARALLEL))

override_dh_auto_test:
# Skip tests because they consume a lot of time and space, their
# results are ignored, and most are redundant with native builds.
# 	cd bld && $(MAKE) check

# Even if building one package, install in two steps and display
# explicit install/missing lists.
override_dh_auto_install:
	cd bld && $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp' AM_UPDATE_INFO_DIR=no

# The archive may be stripped, but
# * not for the or1k-elf target, see commit d4e32cd0
# * that would be $(gnu_type)-strip, not $(DEB_HOST_GNU_TYPE)-strip
override_dh_strip:
	dh_strip --exclude=.a
# dh_fixperms would be more consistent, but comes before dh_strip.
	chmod 644 $(tmpdir)/usr/libexec/gcc/$(gnu_type)/$(gcc-version-major)/liblto_plugin.so

# The private shared library needs no ldconfig trigger.
override_dh_makeshlibs:
	dh_makeshlibs --no-scripts

override_dh_gencontrol:
	dh_gencontrol -- -v${gcc-version}+$(DEB_VERSION) \
	  -Vgcc-version-major=$(gcc-version-major)