#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/architecture.mk PACKAGE=binutils-avr TARGET=avr BUILT_USING := $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W binutils-source) CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) #DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -q DEB_HOST_GNU_TYPE) #DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -q DEB_BUILD_GNU_TYPE) CONFARGS = --prefix=/usr \ --build=$(DEB_BUILD_GNU_TYPE) \ --host=$(DEB_HOST_GNU_TYPE) \ --target=$(TARGET) \ --with-gnu-ld \ --with-gnu-as \ --with-system-zlib \ --enable-install-libbfd \ --with-dwarf2 \ --disable-static \ --disable-gdb --disable-libdecnumber --disable-readline \ --disable-sim \ $(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" \ env DEB_BUILD_MAINT_OPTIONS="hardening=+all" \ dpkg-buildflags --export=configure) # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 #TAR_DIR=binutils-* #TAR_DIR=TAR_DIR=binutils-* #include /usr/share/dbs/dbs-build.mk #include debian/dbs-build.mk BUILD_TREE=build %: dh $@ override_dh_auto_configure: configure-stamp unpack-stamp: tar xf /usr/src/binutils/binutils-*.tar.* mv binutils* src patch -p1 src/binutils/size.c debian/size_avr_support.patch mkdir build touch unpack-stamp patch-stamp: unpack-stamp touch $@ # the dbs rules #include /usr/src/toolchain/patches/binutils/dbs-build.mk # configure-stamp: patch-stamp dh_testdir dh_update_autotools_config # Add here commands to configure the package. cd $(BUILD_TREE) && env CC="gcc" CFLAGS="-Wno-error=unused-but-set-variable -Wno-error=unused-but-set-parameter" CPPFLAGS="$(CPPFLAGS)" ../src/configure $(CONFARGS) make -C $(BUILD_TREE) maybe-configure-bfd make -C $(BUILD_TREE)/bfd/ headers touch configure-stamp override_dh_auto_build:configure-stamp build-stamp build-stamp: dh_testdir # Add here commands to compile the package. cd $(BUILD_TREE) && $(MAKE) #/usr/bin/docbook-to-man debian/$(PACKAGE).sgml > $(PACKAGE).1 touch build-stamp override_dh_auto_clean: dh_testdir dh_testroot rm -f configure-stamp unpack-stamp patch-stamp rm -f debian/files debian/binuils-avr.substvars rm -rf src build debian/binutils-avr debian/.debhelper override_dh_auto_install: dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/$(PACKAGE). cd $(BUILD_TREE) && $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE)/usr # Non standard avr dir to keep FHS happy mv debian/binutils-avr/usr/avr debian/binutils-avr/usr/lib/ # Convert hardlinks to softlinks cd debian/binutils-avr/usr/lib/avr/bin && for f in *; do \ rm ../../../bin/avr-$$f; \ ln -s ../lib/avr/bin/$$f ../../../bin/avr-$$f; \ done # Emptying the dependency_libs field of .la files sed -i "/dependency_libs/ s/'.*'/''/" `find debian/binutils-avr -name '*.la'` # Adjust paths sed -i 's/\/usr\/$(DEB_HOST_GNU_TYPE)\/avr/\/usr\/lib\/avr\/$(DEB_HOST_GNU_TYPE)/' `find debian/binutils-avr -name '*.la'` ln -s avr-ld.1.gz debian/binutils-avr/usr/share/man/man1/avr-ld.bfd.1.gz # Remove man pages that are not needed rm debian/binutils-avr/usr/share/man/man1/avr-dlltool.1 rm debian/binutils-avr/usr/share/man/man1/avr-windmc.1 rm debian/binutils-avr/usr/share/man/man1/avr-windres.1 # Files also in main binutils pkg cd debian/$(PACKAGE)/usr && \ rm -rf include \ rm -rf lib/libiberty.* lib/libbfd.* lib/libopcodes* \ include/bfd.h include/ansidecl.h include/bfdlink.h \ share/locale include/symcat.h include/dis-asm.h \ info share/info share/man/man1/avr-c++filt.1.gz \ share/locale mv debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE)/avr \ debian/binutils-avr/usr/lib/avr/$(DEB_HOST_GNU_TYPE) rm -r debian/binutils-avr/usr/$(DEB_HOST_GNU_TYPE) mkdir debian/binutils-avr/usr/lib/avr/lib/ rm -f debian/binutils-avr/usr/lib/*.a rm -f debian/binutils-avr/usr/lib/*.la \ rm -rf debian/binutils-avr/usr/lib/bfd-plugins mv debian/binutils-avr/usr/lib/ldscripts \ debian/binutils-avr/usr/lib/avr/lib/ldscripts