| 1 |
|
| 2 |
export DH_VERBOSE=1 |
| 3 |
|
| 4 |
target=xtensa-lx106-elf |
| 5 |
|
| 6 |
package=binutils-xtensa-lx106 |
| 7 |
top_dir=$(shell pwd) |
| 8 |
binutils_dir=/usr/src/binutils |
| 9 |
stampdir=debian/stamp |
| 10 |
|
| 11 |
source_version := $(shell dpkg-query -W -f="\$${Version}\n" binutils-source) |
| 12 |
deb_version := $(source_version)+$(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p") |
| 13 |
deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1) |
| 14 |
base_version := $(shell echo $(deb_version) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/') |
| 15 |
|
| 16 |
upstream_dir := binutils-$(shell echo $(deb_upstream_version) | sed -Ee 's/\.[0-9]{8}//') |
| 17 |
|
| 18 |
untar_stamp=$(stampdir)/tar |
| 19 |
|
| 20 |
buildflags=$(shell dpkg-buildflags --export=configure) |
| 21 |
BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-source) |
| 22 |
|
| 23 |
|
| 24 |
CFLAGS="-O2 -g" |
| 25 |
|
| 26 |
configure_flags = \ |
| 27 |
--target=$(target) \ |
| 28 |
--prefix=/usr/lib \ |
| 29 |
--bindir=/usr/bin \ |
| 30 |
--libdir=/usr/lib/xtensa-lx106-elf \ |
| 31 |
--infodir=/usr/share/doc/$(package)/info \ |
| 32 |
--htmldir=/usr/share/doc/$(package)/html \ |
| 33 |
--pdfdir=/usr/share/doc/$(package)/pdf \ |
| 34 |
--mandir=/usr/share/man \ |
| 35 |
--disable-nls \ |
| 36 |
--disable-werror \ |
| 37 |
--enable-plugins \ |
| 38 |
--enable-interwork \ |
| 39 |
--with-system-zlib \ |
| 40 |
--enable-deterministic-archives \ |
| 41 |
"--with-pkgversion=$(deb_version)" \ |
| 42 |
$(buildflags) |
| 43 |
|
| 44 |
%: |
| 45 |
dh $@ -D$(upstream_dir) -Bbuild |
| 46 |
|
| 47 |
$(untar_stamp): |
| 48 |
tar xf $(binutils_dir)/binutils-*.tar.* |
| 49 |
cp debian/overlay/bfd/xtensa-modules.c binutils-*/bfd/ |
| 50 |
cp debian/overlay/include/xtensa-config.h binutils-*/include/ |
| 51 |
mkdir -p $(stampdir) |
| 52 |
cp /usr/share/doc/binutils-source/copyright debian/copyright |
| 53 |
touch $@ |
| 54 |
|
| 55 |
override_dh_auto_configure: $(untar_stamp) |
| 56 |
install -d build |
| 57 |
cd build && ../$(upstream_dir)/configure $(configure_flags) |
| 58 |
|
| 59 |
override_dh_gencontrol: |
| 60 |
dh_gencontrol -a -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vbinutils:Version=$(source_version) -VBuilt-Using="$(BUILT_USING)" |
| 61 |
|
| 62 |
override_dh_auto_clean: |
| 63 |
rm -rf $(upstream_dir) build $(stampdir) |
| 64 |
|
| 65 |
override_dh_installchangelogs: |
| 66 |
dh_installchangelogs $(upstream_dir)/ChangeLog |
| 67 |
|
| 68 |
override_dh_auto_test: |