1 | #!/bin/bash
|
---|
2 | # Create a Binutils Patch
|
---|
3 |
|
---|
4 | # Get Version #
|
---|
5 | #
|
---|
6 | VERSION=$1
|
---|
7 | SOURCEVERSION=$2
|
---|
8 |
|
---|
9 | # Check Input
|
---|
10 | #
|
---|
11 | if [ "${VERSION}" = "" -o "${SOURCEVERSION}" = "" ]; then
|
---|
12 | echo "$0 - Binutils_Version"
|
---|
13 | echo "This will Create a Patch for Binutils Binutils_Series Binutils_Version"
|
---|
14 | echo "Example $0 2.19 2.19.1"
|
---|
15 | exit 255
|
---|
16 | fi
|
---|
17 |
|
---|
18 | #
|
---|
19 | # Download Binutils Source
|
---|
20 | #
|
---|
21 | cd /usr/src
|
---|
22 | if ! [ -e binutils-${SOURCEVERSION}.tar.bz2 ]; then
|
---|
23 | wget ftp://ftp.gnu.org/gnu/binutils/binutils-${SOURCEVERSION}.tar.bz2
|
---|
24 | fi
|
---|
25 |
|
---|
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 |
|
---|
34 | # Cleanup Directory
|
---|
35 | #
|
---|
36 | rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
|
---|
37 | tar xvf binutils-${SOURCEVERSION}.tar.bz2
|
---|
38 | mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
|
---|
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
|
---|
46 | mv src binutils-${SOURCEVERSION}
|
---|
47 |
|
---|
48 | # Cleanup
|
---|
49 | #
|
---|
50 | DIRS="binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig"
|
---|
51 | for DIRECTORY in ${DIRS}; do
|
---|
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
|
---|
60 |
|
---|
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 ..
|
---|
67 | done
|
---|
68 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
69 | rm -f /usr/src/binutils-${SOURCEVERSION}.orig/md5.sum
|
---|
70 |
|
---|
71 | # Make Binutils a Release
|
---|
72 | #
|
---|
73 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
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 |
|
---|
77 | # Customize the version string, so we know it's patched
|
---|
78 | #
|
---|
79 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
80 | DATE_STAMP="`date +%Y%m%d`"
|
---|
81 | cd /usr/src/binutils-${SOURCEVERSION}
|
---|
82 | sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
|
---|
83 | sed -i "s:^[[:space:]]VERSION=\(.*\)$:VERSION=\1.${DATE_STAMP}:g" bfd/configure
|
---|
84 |
|
---|
85 | # Cleanliness is the name of my game!
|
---|
86 | #
|
---|
87 | unset DATE_STAMP
|
---|
88 |
|
---|
89 | # Create Patch
|
---|
90 | #
|
---|
91 | cd /usr/src
|
---|
92 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
93 | echo "Date: `date +%m-%d-%Y`" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
94 | echo "Initial Package Version: ${SOURCEVERSION}" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
95 | echo "Origin: Upstream" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
96 | echo "Upstream Status: Applied" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
97 | echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
98 | echo " rechecked periodically." >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
99 | echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
100 | diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
|
---|
101 | echo "Created /usr/src/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
|
---|