# # spec file for package avr-binutils # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # Copyright (C) 2012 by Volker Kuhlmann # http://volker.top.geek.nz/contact.html # Significant changes and improvements along the same lines as avr-gcc-462. # Released under the same license as the GNU binutils package. # # http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.2._norootforbuild # # norootforbuild # AVR toolchain bugs # http://www.nongnu.org/avr-libc/bugs.html %define prefix /opt/cross/avr %define pgprefix avr- %define pgsuffix %{nil} Name: avr-binutils Version: 2.22 Release: 1 Summary: Atmel AVR binutils with xmega support BuildRequires: texinfo libexpat-devel expat BuildRequires: bison dejagnu flex gcc-c++ %if 0%{?suse_version} > 1110 BuildRequires: zlib-devel-static %else BuildRequires: zlib-devel %endif Source0: ftp://ftp.dkuug.dk/pub/gnu/ftp/gnu/binutils/binutils-2.22.tar.bz2 Source1: buildavr-no-insight.sh Source2: getfiles.sh Source3: get-patches.sh Source4: hotfix.txt Patch1: binutils-patch-aa.diff Patch2: binutils-patch-coff-avr.diff Patch3: binutils-patch-data-origin.diff Patch4: binutils-patch-newdevices.diff Patch5: binutils-patch-newsections.diff Patch6: binutils-patch-xmega.diff Patch7: binutils-patch-zzz-atmega128rfa1.diff Patch8: binutils-patch-avr25-wraparound-reloc.diff Patch9: binutils-patch-avr-size.diff Url: http://www.gnu.org/software/binutils/ Group: Development/Libraries/C and C++ License: GPL AutoReqProv: on BuildRoot: %{_tmppath}/%{name}-%{version}-build # avr-binutils is an upgrade for cross-avr-binutils. Obsoletes: cross-avr-binutils # avr-gcc, avr-libc, avr-example may require cross-avr-binutils Provides: cross-avr-binutils %description Atmel AVR binutils with xmega support build instructions from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631 This package contains the latest stable binutils, compiled for AVR. It hasn't been extensively tested. Try it, and if it doesn't work, install the previous 2.19 again. %prep %setup -q -n binutils-%{version} cp %SOURCE1 . cp %SOURCE2 . cp %SOURCE3 . cp %SOURCE4 . mkdir patches-2.19 cp %PATCH1 %PATCH2 %PATCH3 %PATCH4 %PATCH5 %PATCH6 %PATCH7 %PATCH8 patches-2.19 #%patch1 -p0 # Patches 1-8 are for binutils 2.19 and fail for 2.22. #%patch2 -p0 #%patch3 -p0 #%patch4 -p0 #%patch5 -p0 #%patch6 -p0 #%patch7 -p0 #%patch8 -p0 %patch9 -p0 %build export CFLAGS="$RPM_OPT_FLAGS" export target=avr # Should this be using %%pgprefix? -VK # --program-prefix=%{pgprefix} \ echo "($0) configuring binutils source" ./configure -v --target=${target} \ --prefix=%prefix \ --mandir=%prefix/share/man \ --infodir=%prefix/share/info \ --with-gnu-ld \ --with-gnu-as \ --quiet \ --enable-install-libbfd \ --with-dwarf2 \ --disable-werror \ --enable-lto \ --enable-ld=yes \ --enable-gold=yes \ --enable-plugins \ CFLAGS="-Wno-format-security $RPM_OPT_FLAGS" make all chmod 644 *.sh %install # simulavrxx needs bfd.h so better keep this include directory # rm -rf $RPM_BUILD_ROOT%{_prefix}/include # gnu tools honor DESTDIR; # itcl Makefile has DESTDIR, but it cannot be set from ouside. # tcl Makefile has INSTALL_ROOT, but it cannot be set from ouside, and is missing a few times #sed -i.orig -e 's@^INSTALL_ROOT[ ]*=$@INSTALL_ROOT = '$RPM_BUILD_ROOT'@' tcl/unix/Makefile make install DESTDIR=$RPM_BUILD_ROOT INSTALL_ROOT=$RPM_BUILD_ROOT # Sometimes binaries are not stripped. strip $RPM_BUILD_ROOT%prefix/bin/* # Modify and rename info files. # The file name in the info file has to be the same as the actual file name, or # the info index is not updated properly. #pushd $RPM_BUILD_ROOT%{_infodir} pushd $RPM_BUILD_ROOT%{prefix}/share/info for file in *info*; do ## Modify file name in info file. name=$(basename $file .info) # base name (no .info) to change in info file pref=%{pgprefix} # name prefix to add in info file suff=%{pgsuffix} # name suffix to add in info file sed < "$file" > "$file.new" " s,/$name.info,/$pref$name$suff.info, s,\* $name: ($name)\.,* $pref$name$suff: ($pref$name$suff).,i s,\* cpplib: ($name)\.,* $pref$name$suff: ($pref$name$suff).,i s/File: $name.info/File: $pref$name$suff.info/ " \ && cat "$file.new" > "$file" \ && rm "$file.new" ## Rename info file. %__mv $file %{pgprefix}$(basename $file .info)%{pgsuffix}.info done popd # Compress info files (but not the dir file). %__gzip $RPM_BUILD_ROOT%{prefix}/share/info/*.info # Compress man pages. %__gzip -f $RPM_BUILD_ROOT%{prefix}/share/man/man*/*.* # Symlinks from /usr/bin to %prefix/bin. %__install -d $RPM_BUILD_ROOT%{_usr}/bin pushd $RPM_BUILD_ROOT%{prefix}/bin for f in *; do %__ln_s %{prefix}/bin/$f $RPM_BUILD_ROOT%{_usr}/bin done popd # Symlinks from /usr/share/man/man1 to prefix/share/man/man1. %__install -d $RPM_BUILD_ROOT%{_usr}/share/man/man1 pushd $RPM_BUILD_ROOT%{prefix}/share/man/man1 for f in *; do %__ln_s %{prefix}/share/man/man1/$f \ $RPM_BUILD_ROOT%{_usr}/share/man/man1 done popd # Save a list of info files here, for use in install scripts. %define infofileslist %{prefix}/avr/lib/infofiles rm -f $RPM_BUILD_ROOT%infofileslist # Symlinks from /usr/share/info to prefix/share/info. %__install -d $RPM_BUILD_ROOT%{_usr}/share/info pushd $RPM_BUILD_ROOT%{prefix}/share/info for f in *; do test "$f" = dir && continue %__ln_s %{prefix}/share/info/$f $RPM_BUILD_ROOT%{_usr}/share/info echo >> $RPM_BUILD_ROOT%infofileslist "$f" done popd install -d $RPM_BUILD_ROOT%prefix/include ## hmm, could install do recursive? cp -a include $RPM_BUILD_ROOT%prefix/include find $RPM_BUILD_ROOT%prefix/include -type f | xargs chmod 644 find $RPM_BUILD_ROOT%prefix/include -type d | xargs chmod 755 %post while read -r file; do file=$(basename "$file" .gz) %info_add "$file" %{_usr}/share/info done < %infofileslist %preun while read -r file; do # file=$(basename "$file" .gz) # Macro only works in postun, but want the file list to be automatic. # %%info_del "$file" %{_usr}/share/info test -x /sbin/install-info \ && /sbin/install-info --quiet --delete \ --info-dir=%{_usr}/share/info "$file" done < %infofileslist %clean %if ! 0%?dont_clean_build_root # %%dont_clean_build_root can be used by the build environment to prevent # deleting this. %__rm -rf "$RPM_BUILD_ROOT" %__rm -rf "$RPM_BUILD_DIR" %endif %files %defattr (-, root, root) %doc hotfix.txt getfiles.sh get-patches.sh buildavr-no-insight.sh COPYING* %doc patches-2.19 #%exclude %{_infodir}/dir %exclude %prefix/share/info/dir %exclude %prefix/lib*/libiberty.a # bfd.mo and opcodes.mo are part of package (cross-)avr-insight{,-lang}. %exclude %prefix/share/locale/*/*/bfd.mo %exclude %prefix/share/locale/*/*/opcodes.mo /opt/cross /usr/bin/* /usr/share/man/man1/* /usr/share/info/* %changelog * Sat Jan 14 2012 Volker Kuhlmann - Update to GNU binutils 2.22. - Fix spec similarly to avr-gcc-462 (info files have program prefix and are found, etc). - Fixed License: and URL:, which were those of avr-insight. * Tue Oct 18 2011 max@suse.com - Fix libmpfr build dependency. * Mon Oct 25 2010 jw@novell.com - added header files, to support simulavr * Thu Mar 4 2010 jw@novell.com - Release: 25jan2010 - using build instructions from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631