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
|
#!/usr/bin/make -f
# -*- makefile -*-
# Copyright © 2010-2019 Stephen Kitt <skitt@debian.org>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
# Disable package mangling in Launchpad; it currently fails to parse
# Built-Using, which results in build failures
export NO_PKG_MANGLE=1
include /usr/share/dpkg/default.mk
top_dir := $(shell pwd)
binutils_dir := /usr/src/binutils
upstream_dir := $(top_dir)/upstream
build_dir := $(top_dir)/build
source_version := $(shell dpkg-query -W -f="\$${Version}" binutils-source)
deb_version := $(source_version)+$(DEB_VERSION)
deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1)
gnu_upstream_version := $(shell echo $(deb_upstream_version) | cut -d. -f1-3)
targets := i686-w64-mingw32 x86_64-w64-mingw32
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
PF := /usr
confflags = \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_HOST_GNU_TYPE) \
--target=$(1) \
--prefix=$(PF) \
--bindir=$(PF)/bin \
--libdir=$(PF)/$(1)/lib \
--libexecdir=$(PF)/$(1)/lib \
--disable-compressed-debug-sections \
--disable-dependency-tracking \
--disable-maintainer-mode \
--disable-multilib \
--disable-silent-rules \
--disable-werror \
--disable-x86-used-note \
--enable-deterministic-archives \
--enable-lto \
--enable-plugins \
--enable-threads \
--with-system-zlib
%:
dh $@ --without autoreconf
spelling = grep -rl '$(1)' $(upstream_dir) | xargs sed -i 's/$(1)/$(2)/g' 2>/dev/null || echo '*** Misspelling "$(1)" not found. ***'
.PHONY: unpack
unpack:
tar xf $(binutils_dir)/binutils-$(gnu_upstream_version).tar.*
rm -rf $(upstream_dir)
mv binutils-* $(upstream_dir)
# Revert the ldscripts location patch so we avoid conflicting with binutils
patch -d $(upstream_dir) -R -p1 < /usr/src/binutils/patches/001_ld_makefile_patch.patch
# Apply our patches
QUILT_SERIES=debian/patches/series QUILT_PATCHES=debian/patches quilt push -a
# On big-endian architectures, disable the windres tests (#754829)
# and the codeview tests
if [ "$(DEB_HOST_ARCH_ENDIAN)" = "big" ]; then \
rm -f $(upstream_dir)/binutils/testsuite/binutils-all/windres/windres.exp; \
rm -f $(upstream_dir)/gas/testsuite/gas/i386/codeview.exp; \
rm -f $(upstream_dir)/ld/testsuite/ld-pe/pdb.exp; \
fi
# Spelling fixes
@$(call spelling,allows to,allows one to)
@$(call spelling,complier,compiler)
@$(call spelling,explict,explicit)
@$(call spelling,extention,extension)
@$(call spelling,maching,matching)
@$(call spelling,preceeded,preceded)
@$(call spelling,refered,referred)
@$(call spelling,specifed,specified)
@$(call spelling,supressed,suppressed)
@$(call spelling,targetted,targeted)
override_dh_clean:
dh_clean
rm -rf .pc $(build_dir) $(upstream_dir) $(patsubst %,debian/%-dllwrap.1,$(targets))
# Unpack before autotools
override_dh_update_autotools_config: unpack
dh_update_autotools_config
override_dh_auto_configure:
set -e; \
for target in $(targets); do \
mkdir -p $(build_dir)/$$target; \
cd $(build_dir)/$$target; \
$(upstream_dir)/configure $(call confflags,$$target); \
done
override_dh_auto_build-arch:
set -e; \
for target in $(targets); do \
dh_auto_build --parallel -B$(build_dir)/$$target; \
done
# The test suite can't run in parallel (it fails because of libbfd.tmp)
override_dh_auto_test-arch:
set -e; \
unset CFLAGS CPPFLAGS LDFLAGS; \
for target in $(targets); do \
dh_auto_test --no-parallel -B$(build_dir)/$$target; \
done
override_dh_auto_install-arch:
for target in $(targets); do \
dh_auto_install -B$(build_dir)/$$target; \
done
# Drop unused files
rm -rf debian/tmp/usr/x86_64-w64-mingw32/lib/ldscripts/i386pe.*
# Drop files which will conflict with other packages
rm -rf debian/tmp/usr/lib/*.a
rm -rf debian/tmp/usr/share/info
rm -rf debian/tmp/usr/share/locale
# Copy the dllwrap manpages
for target in $(targets); do \
cp debian/dllwrap.1 debian/$$target-dllwrap.1; \
done
override_dh_install-arch:
dh_install -a
# Symlink duplicates — see https://wiki.debian.org/dedup.debian.net
# We remove hardlinks too, otherwise one of the ld hardlinks is left alone and
# isn't symlinked
for install in debian/*.install; do \
rdfind -outputname /dev/null -removeidentinode false -makesymlinks true $${install%%.*}; \
symlinks -r -s -c $${install%%.*}; \
done
override_dh_installchangelogs:
dh_installchangelogs $(upstream_dir)/ChangeLog
override_dh_gencontrol:
dh_gencontrol -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vbinutils:Version=$(source_version)
|