| 1 |
#!/usr/bin/make -f |
| 2 |
# Sample debian/rules that uses debhelper. |
| 3 |
# GNU copyright 1997 to 1999 by Joey Hess. |
| 4 |
|
| 5 |
#https://wiki.debian.org/PackagingLessCommonBinutilsTargets |
| 6 |
|
| 7 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 8 |
include /usr/share/dpkg/buildflags.mk |
| 9 |
include /usr/share/dpkg/architecture.mk |
| 10 |
|
| 11 |
PACKAGE=binutils-avr |
| 12 |
TARGET=avr |
| 13 |
BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-source) |
| 14 |
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) |
| 15 |
|
| 16 |
#DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE) |
| 17 |
#DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -q DEB_BUILD_GNU_TYPE) |
| 18 |
|
| 19 |
CONFARGS = --prefix=/usr \ |
| 20 |
--build=$(DEB_BUILD_GNU_TYPE) \ |
| 21 |
--host=$(DEB_HOST_GNU_TYPE) \ |
| 22 |
--target=$(TARGET) \ |
| 23 |
--with-gnu-ld \ |
| 24 |
--with-gnu-as \ |
| 25 |
--with-system-zlib \ |
| 26 |
--enable-install-libbfd \ |
| 27 |
--with-dwarf2 \ |
| 28 |
--disable-static \ |
| 29 |
--disable-gdb --disable-libdecnumber --disable-readline \ |
| 30 |
--disable-sim \ |
| 31 |
$(shell env DEB_CFLAGS_MAINT_APPEND="-Wno-implicit-fallthrough -Wno-format-overflow -Wno-pointer-compare -Wno-error=cast-function-type -Wno-error=stringop-truncation -Wno-error=format-truncation -Wno-error=discarded-qualifiers" \ |
| 32 |
env DEB_BUILD_MAINT_OPTIONS="hardening=+all" \ |
| 33 |
dpkg-buildflags --export=configure) |
| 34 |
|
| 35 |
|
| 36 |
# Uncomment this to turn on verbose mode. |
| 37 |
#export DH_VERBOSE=1 |
| 38 |
|
| 39 |
#TAR_DIR=binutils-* |
| 40 |
#TAR_DIR=TAR_DIR=binutils-* |
| 41 |
#include /usr/share/dbs/dbs-build.mk |
| 42 |
#include debian/dbs-build.mk |
| 43 |
|
| 44 |
BUILD_TREE=build |
| 45 |
|
| 46 |
%: |
| 47 |
dh $@ |
| 48 |
|
| 49 |
|
| 50 |
override_dh_auto_configure: configure-stamp |
| 51 |
|
| 52 |
unpack-stamp: |
| 53 |
tar xf /usr/src/binutils/binutils-*.tar.* |
| 54 |
mv binutils* src |
| 55 |
patch -p1 src/binutils/size.c debian/size_avr_support.patch |
| 56 |
mkdir build |
| 57 |
touch unpack-stamp |
| 58 |
|
| 59 |
patch-stamp: unpack-stamp |
| 60 |
touch $@ |
| 61 |
|
| 62 |
# the dbs rules |
| 63 |
#include /usr/src/toolchain/patches/binutils/dbs-build.mk |
| 64 |
# |
| 65 |
configure-stamp: patch-stamp |
| 66 |
dh_testdir |
| 67 |
|
| 68 |
dh_update_autotools_config |
| 69 |
# Add here commands to configure the package. |
| 70 |
cd $(BUILD_TREE) && env CFLAGS="-Wno-error=unused-but-set-variable -Wno-error=unused-but-set-parameter" CPPFLAGS="$(CPPFLAGS)" ../src/configure $(CONFARGS) |
| 71 |
make -C $(BUILD_TREE) maybe-configure-bfd |
| 72 |
make -C $(BUILD_TREE)/bfd/ headers |
| 73 |
touch configure-stamp |
| 74 |
|
| 75 |
override_dh_auto_build:configure-stamp build-stamp |
| 76 |
|
| 77 |
build-stamp: |
| 78 |
dh_testdir |
| 79 |
|
| 80 |
# Add here commands to compile the package. |
| 81 |
cd $(BUILD_TREE) && $(MAKE) |
| 82 |
#/usr/bin/docbook-to-man debian/$(PACKAGE).sgml > $(PACKAGE).1 |
| 83 |
|
| 84 |
touch build-stamp |
| 85 |
|
| 86 |
override_dh_auto_clean: |
| 87 |
dh_testdir |
| 88 |
dh_testroot |
| 89 |
rm -f configure-stamp unpack-stamp patch-stamp |
| 90 |
rm -f debian/files debian/binuils-avr.substvars |
| 91 |
rm -rf src build debian/binutils-avr debian/.debhelper |
| 92 |
|
| 93 |
override_dh_auto_install: |
| 94 |
dh_testdir |
| 95 |
dh_testroot |
| 96 |
dh_prep |
| 97 |
dh_installdirs |
| 98 |
|
| 99 |
# Add here commands to install the package into debian/$(PACKAGE). |
| 100 |
cd $(BUILD_TREE) && $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE)/usr |
| 101 |
|
| 102 |
# Non standard avr dir to keep FHS happy |
| 103 |
mv debian/binutils-avr/usr/avr debian/binutils-avr/usr/lib/ |
| 104 |
|
| 105 |
# Convert hardlinks to softlinks |
| 106 |
cd debian/binutils-avr/usr/lib/avr/bin && for f in *; do \ |
| 107 |
rm ../../../bin/avr-$$f; \ |
| 108 |
ln -s ../lib/avr/bin/$$f ../../../bin/avr-$$f; \ |
| 109 |
done |
| 110 |
|
| 111 |
# Emptying the dependency_libs field of .la files |
| 112 |
sed -i "/dependency_libs/ s/'.*'/''/" `find debian/binutils-avr -name '*.la'` |
| 113 |
|
| 114 |
# Adjust paths |
| 115 |
sed -i 's/\/usr\/$(DEB_HOST_GNU_TYPE)\/avr/\/usr\/lib\/avr\/$(DEB_HOST_GNU_TYPE)/' `find debian/binutils-avr -name '*.la'` |
| 116 |
|
| 117 |
ln -s avr-ld.1.gz debian/binutils-avr/usr/share/man/man1/avr-ld.bfd.1.gz |
| 118 |
|
| 119 |
# Remove man pages that are not needed |
| 120 |
rm debian/binutils-avr/usr/share/man/man1/avr-dlltool.1 |
| 121 |
rm debian/binutils-avr/usr/share/man/man1/avr-windmc.1 |
| 122 |
rm debian/binutils-avr/usr/share/man/man1/avr-windres.1 |
| 123 |
|
| 124 |
# Files also in main binutils pkg |
| 125 |
cd debian/$(PACKAGE)/usr && \ |
| 126 |
rm -rf include \ |
| 127 |
rm -rf lib/libiberty.* lib/libbfd.* lib/libopcodes* \ |
| 128 |
include/bfd.h include/ansidecl.h include/bfdlink.h \ |
| 129 |
share/locale include/symcat.h include/dis-asm.h \ |
| 130 |
info share/info share/man/man1/avr-c++filt.1.gz \ |
| 131 |
share/locale |
| 132 |
|
| 133 |
mv debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE)/avr \ |
| 134 |
debian/binutils-avr/usr/lib/avr/$(DEB_HOST_GNU_TYPE) |
| 135 |
rm -r debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE) |
| 136 |
|
| 137 |
mkdir debian/binutils-avr/usr/lib/avr/lib/ |
| 138 |
|
| 139 |
rm -f debian/binutils-avr/usr/lib/*.a |
| 140 |
rm -f debian/binutils-avr/usr/lib/*.la \ |
| 141 |
rm -rf debian/binutils-avr/usr/lib/bfd-plugins |
| 142 |
|
| 143 |
mv debian/binutils-avr/usr/lib/ldscripts \ |
| 144 |
debian/binutils-avr/usr/lib/avr/lib/ldscripts |