| 12
 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
 
 | #!/usr/bin/make -f
# https://wiki.debian.org/PackagingLessCommonBinutilsTargets
DEB_BUILD_MAINT_OPTIONS := hardening=+all
DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
# The GNU triplet determines Debian package names, but not the other
# way around because GNU triplets may contain underscore characters.
gnu_type                                 = or1k-elf
# Extract sources to a fixed path (computing the version is
# inefficient, mentioning it everywhere does not help readability, and
# there will never be other versions here anyway).
# Note for the build directory: build is the name of a Debian phony
# target, an existing directory with the same name would confuse Make.
%:
	dh $@ -Dsrc -Bbld
# Reduce the dependency on upstream naming scheme with wildcards.
tar_dir = /usr/src/binutils
execute_before_dh_update_autotools_config: src
src:
	tar -xf $(tar_dir)/binutils-*.tar.xz --transform='s|[^/]*|src|'
  # Apply patches here with 'patch -dsrc -p1 < $patch'.
# _GCC_AUTOCONF_VERSION_CHECK in config/override.m4 requires 2.69.
# Seen with 2.42-4.
override_dh_autoreconf:
	dh_autoreconf -D. autoreconf2.69 -- -f -i -v `debian/autoreconf`
confargs += --target=$(gnu_type)
# The private libraries in this package do not conform to the
# multiarch policy, and should avoid multiarch paths.
confargs += --libdir=/usr/lib/$(gnu_type)
# Link with packaged libz-dev.
confargs += --with-system-zlib
# Let the executables report the Debian version.
pkgversion != dpkg-query -Wf'$${Version}' binutils-source
confargs += --with-pkgversion='$(pkgversion)+$(DEB_VERSION)'
confargs += --disable-nls
# https://tests.reproducible-builds.org/debian/issues/unstable/timestamps_in_static_libraries_issue.html
confargs += --enable-deterministic-archives
# autoconf2.69 fails on the --runstatedir argument.
override_dh_auto_configure:
	install -d bld
	$(filter-out --runstatedir=/run, \
	  $(shell dh_auto_configure -Dsrc -Bbld --no-act)) $(confargs)
# Disable tests, until someone fixes
# https://buildd.debian.org/status/fetch.php?pkg=binutils-or1k-elf&arch=mips64el&ver=1.0.4&stamp=1656249446&raw=0
override_dh_auto_test:
# Install in two steps even if building one package.
# This will become the default in debhelper compatility level 15.
override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
override_dh_gencontrol:
	dh_gencontrol -- '-v$(pkgversion)+$(DEB_VERSION)'
# avoid debhelper confusion when source directory is initially missing
execute_before_dh_auto_clean:
	mkdir --parents src
 |