| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# https://wiki.debian.org/PackagingLessCommonBinutilsTargets |
| 4 |
|
| 5 |
DEB_BUILD_MAINT_OPTIONS := hardening=+all |
| 6 |
DPKG_EXPORT_BUILDFLAGS := 1 |
| 7 |
include /usr/share/dpkg/buildflags.mk |
| 8 |
include /usr/share/dpkg/pkg-info.mk |
| 9 |
|
| 10 |
# The GNU triplet determines Debian package names, but not the other |
| 11 |
# way around because GNU triplets may contain underscore characters. |
| 12 |
gnu_type = or1k-elf |
| 13 |
|
| 14 |
# Extract sources to a fixed path (computing the version is |
| 15 |
# inefficient, mentioning it everywhere does not help readability, and |
| 16 |
# there will never be other versions here anyway). |
| 17 |
|
| 18 |
# Note for the build directory: build is the name of a Debian phony |
| 19 |
# target, an existing directory with the same name would confuse Make. |
| 20 |
|
| 21 |
%: |
| 22 |
dh $@ -Dsrc -Bbld --without single-binary |
| 23 |
|
| 24 |
# Reduce the dependency on upstream naming scheme with wildcards. |
| 25 |
tar_dir = /usr/src/binutils |
| 26 |
execute_before_dh_update_autotools_config: src |
| 27 |
src: |
| 28 |
tar -xf $(tar_dir)/binutils-*.tar.xz --transform='s|[^/]*|src|' |
| 29 |
# Apply patches here with 'patch -dsrc -p1 < $patch'. |
| 30 |
|
| 31 |
# _GCC_AUTOCONF_VERSION_CHECK in config/override.m4 requires 2.69. |
| 32 |
# Seen with 2.42-4. |
| 33 |
override_dh_autoreconf: |
| 34 |
dh_autoreconf -D. autoreconf2.69 -- -f -i -v `debian/autoreconf` |
| 35 |
|
| 36 |
confargs += --target=$(gnu_type) |
| 37 |
|
| 38 |
# The private libraries in this package do not conform to the |
| 39 |
# multiarch policy, and should avoid multiarch paths. |
| 40 |
confargs += --libdir=/usr/lib/$(gnu_type) |
| 41 |
|
| 42 |
# Link with packaged libz-dev. |
| 43 |
confargs += --with-system-zlib |
| 44 |
|
| 45 |
# Let the executables report the Debian version. |
| 46 |
# != would compute the version on each debian/rules parsing. |
| 47 |
pkgversion = $(shell dpkg-query -Wf'$${Version}' binutils-source) |
| 48 |
confargs += --with-pkgversion='$(pkgversion)+$(DEB_VERSION)' |
| 49 |
|
| 50 |
confargs += --disable-nls |
| 51 |
|
| 52 |
# https://tests.reproducible-builds.org/debian/issues/unstable/timestamps_in_static_libraries_issue.html |
| 53 |
confargs += --enable-deterministic-archives |
| 54 |
|
| 55 |
# autoconf2.69 fails on the --runstatedir argument. |
| 56 |
override_dh_auto_configure: |
| 57 |
install -d bld |
| 58 |
$(filter-out --runstatedir=/run, \ |
| 59 |
$(shell dh_auto_configure -Dsrc -Bbld --no-act)) $(confargs) |
| 60 |
|
| 61 |
# Disable tests, until someone fixes |
| 62 |
# https://buildd.debian.org/status/fetch.php?pkg=binutils-or1k-elf&arch=mips64el&ver=1.0.4&stamp=1656249446&raw=0 |
| 63 |
override_dh_auto_test: |
| 64 |
|
| 65 |
# Install in two steps even if building one package. |
| 66 |
# This will become the default in debhelper compatility level 15. |
| 67 |
override_dh_auto_install: |
| 68 |
dh_auto_install --destdir=debian/tmp |
| 69 |
|
| 70 |
sed -i 's/^\( binutils_source_version: "\).*/\1$(pkgversion)"/' \ |
| 71 |
debian/debputy.manifest |
| 72 |
|
| 73 |
# avoid debhelper confusion when source directory is initially missing |
| 74 |
execute_before_dh_auto_clean: |
| 75 |
mkdir --parents src |