[06dcdf6] | 1 | #!/bin/bash
|
---|
| 2 | # Create a Binutils Patch
|
---|
| 3 |
|
---|
| 4 | # Get Version #
|
---|
| 5 | #
|
---|
| 6 | VERSION=$1
|
---|
[06fb515] | 7 | SOURCEVERSION=$2
|
---|
[06dcdf6] | 8 |
|
---|
| 9 | # Check Input
|
---|
| 10 | #
|
---|
[7df856d] | 11 | if [ "${VERSION}" = "" -o "${SOURCEVERSION}" = "" ]; then
|
---|
[9676bac] | 12 | echo "$0 - Binutils_Version"
|
---|
[06fb515] | 13 | echo "This will Create a Patch for Binutils Binutils_Series Binutils_Version"
|
---|
[7df856d] | 14 | echo "Example $0 2.19 2.19.1"
|
---|
[9676bac] | 15 | exit 255
|
---|
[06dcdf6] | 16 | fi
|
---|
| 17 |
|
---|
[06fb515] | 18 | #
|
---|
[06dcdf6] | 19 | # Download Binutils Source
|
---|
| 20 | #
|
---|
| 21 | cd /usr/src
|
---|
[06fb515] | 22 | if ! [ -e binutils-${SOURCEVERSION}.tar.bz2 ]; then
|
---|
| 23 | wget ftp://ftp.gnu.org/gnu/binutils/binutils-${SOURCEVERSION}.tar.bz2
|
---|
[06dcdf6] | 24 | fi
|
---|
| 25 |
|
---|
[c7ef534] | 26 | # Set Patch Number
|
---|
| 27 | #
|
---|
| 28 | cd /usr/src
|
---|
| 29 | wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
|
---|
| 30 | PATCH_NUM=$(cat index.html | grep binutils | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
|
---|
| 31 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
| 32 | rm -f index.html
|
---|
| 33 |
|
---|
[06dcdf6] | 34 | # Cleanup Directory
|
---|
| 35 | #
|
---|
[06fb515] | 36 | rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
|
---|
| 37 | tar xvf binutils-${SOURCEVERSION}.tar.bz2
|
---|
| 38 | mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
|
---|
[06dcdf6] | 39 | CURRENTDIR=$(pwd -P)
|
---|
| 40 |
|
---|
| 41 | # Get Current Updates from CVS
|
---|
| 42 | #
|
---|
| 43 | cd /usr/src
|
---|
| 44 | FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
|
---|
| 45 | cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rbinutils-${FIXEDVERSION}-branch binutils
|
---|
[06fb515] | 46 | mv src binutils-${SOURCEVERSION}
|
---|
[06dcdf6] | 47 |
|
---|
| 48 | # Cleanup
|
---|
| 49 | #
|
---|
[06fb515] | 50 | DIRS="binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig"
|
---|
[06dcdf6] | 51 | for DIRECTORY in ${DIRS}; do
|
---|
[9676bac] | 52 | cd /usr/src/${DIRECTORY}
|
---|
| 53 | FILE_LIST=".cvsignore *.gmo"
|
---|
| 54 | for files in ${FILE_LIST}; do
|
---|
| 55 | REMOVE=$(find * -name ${files})
|
---|
| 56 | for file in $REMOVE; do
|
---|
| 57 | rm -f ${file}
|
---|
| 58 | done
|
---|
| 59 | done
|
---|
[06dcdf6] | 60 |
|
---|
[9676bac] | 61 | REMOVE=".cvsignore MAINTAINERS COPYING.LIBGLOSS COPYING.NEWLIB README-maintainer-mode depcomp
|
---|
| 62 | ChangeLog compile ltgcc.m4 lt~obsolete.m4 etc/ChangeLog etc/add-log.el etc/add-log.vi"
|
---|
| 63 | for file in $REMOVE; do
|
---|
| 64 | rm -f ${file}
|
---|
| 65 | done
|
---|
| 66 | cd ..
|
---|
[06dcdf6] | 67 | done
|
---|
[06fb515] | 68 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
| 69 | rm -f /usr/src/binutils-${SOURCEVERSION}.orig/md5.sum
|
---|
[06dcdf6] | 70 |
|
---|
| 71 | # Make Binutils a Release
|
---|
| 72 | #
|
---|
[06fb515] | 73 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
[06dcdf6] | 74 | sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.am
|
---|
| 75 | sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.in
|
---|
| 76 |
|
---|
[cd317ff] | 77 | # Customize the version string, so we know it's patched
|
---|
| 78 | #
|
---|
| 79 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
[e6c6e3e] | 80 | DATE_STAMP="`date +%Y%m%d`"
|
---|
| 81 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
[5d01446] | 82 | sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
|
---|
[e6c6e3e] | 83 | sed -i "s:^[[:space:]]VERSION=\(.*\)$:VERSION=\1.${DATE_STAMP}:g" bfd/configure
|
---|
| 84 | # Cleanliness is the name of my game!
|
---|
| 85 | unset DATE_STAMP
|
---|
[cd317ff] | 86 |
|
---|
[06dcdf6] | 87 | # Create Patch
|
---|
| 88 | #
|
---|
| 89 | cd /usr/src
|
---|
[c7ef534] | 90 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 91 | echo "Date: `date +%m-%d-%Y`" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 92 | echo "Initial Package Version: ${SOURCEVERSION}" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 93 | echo "Origin: Upstream" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 94 | echo "Upstream Status: Applied" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 95 | echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 96 | echo " rechecked periodically." >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 97 | echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 98 | diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
| 99 | echo "Created /usr/src/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
|
---|