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
|
#!/usr/bin/make -f
# https://wiki.debian.org/PackagingLessCommonBinutilsTargets
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS := hardening=+all
# The GNU triplet determines Debian package names, but not the other
# way around because GNU triplets may contain underscore characters.
gnu_type = or1k-elf
package = binutils-$(subst _,-,$(gnu_type))
# 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
mv binutils* src
# _GCC_AUTOCONF_VERSION_CHECK in config/override.m4 requires 2.69.
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
override_dh_auto_configure:
# Imitate dh_auto_configure -- $(confargs), but without
# --runstatedir as long as libiberty/configure cannot be refreshed.
install -d bld
cd bld && ../src/configure --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=/usr/lib/$(DEB_HOST_GNU_TYPE) --disable-maintainer-mode --disable-dependency-tracking \
$(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:
# Shared data are provided by the binutils-common dependency.
not_installed = \
usr/share/info \
usr/share/locale \
usr/share/man
execute_after_dh_auto_install:
rm -fr $(addprefix debian/$(package)/,$(not_installed))
# For each executable in the path, provide a manual page as a symbolic
# link to the one from binutils-common.
links += $(foreach t,$(subst debian/$(package)/usr/bin/$(gnu_type)-,,\
$(wildcard debian/$(package)/usr/bin/$(gnu_type)-*)),\
usr/share/man/man1/$(t).1.gz \
usr/share/man/man1/$(gnu_type)-$(t).1.gz)
# Upstream installs hard links to the executables from the traditional
# path for cross-compiler tools. Replace them with symbolic links.
links += $(foreach t,\
$(notdir $(wildcard debian/$(package)/usr/$(gnu_type)/bin/*)), \
usr/bin/$(gnu_type)-$(t) usr/$(gnu_type)/bin/$(t))
override_dh_link:
dh_link $(links)
# Run dpkg-query once, only for this recipe. Show the output in logs.
gencontrol_format = \
-v$${Version}+$(DEB_VERSION) \
-VBuilt-Using="$${source:Package} (= $${source:Version})"
gencontrol_args != dpkg-query -Wf'$(gencontrol_format)' binutils-source
override_dh_gencontrol:
dh_gencontrol -- $(gencontrol_args)
# avoid debhelper confusion when source directory is initially missing
execute_before_dh_auto_clean:
mkdir --parents src
|