source: scripts/patch/binutils-patch.sh@ d8a9d8b

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since d8a9d8b was d8a9d8b, checked in by Jim Gifford <clfs@…>, 15 years ago

Updates to Patch Scripts

  • Property mode set to 100755
File size: 6.1 KB
Line 
1#!/bin/bash
2# Create a Binutils Patch
3
4# Get Version #
5#
6VERSION=$1
7SOURCEVERSION=$2
8
9# Check Input
10#
11if [ "${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
16fi
17
18#
19# Download Binutils Source
20#
21install -d ~/tmp
22cd ~/tmp
23if ! [ -e binutils-${SOURCEVERSION}.tar.bz2 ]; then
24 wget ftp://ftp.gnu.org/gnu/binutils/binutils-${SOURCEVERSION}.tar.bz2
25fi
26
27# Set Patch Number
28#
29cd ~/tmp
30wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
31PATCH_NUM=$(cat index.html | grep binutils | grep "${SOURCEVERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
32PATCH_NUM=$(expr ${PATCH_NUM} + 1)
33PATCH_NUM2=$(cat index.html | grep binutils | grep "${SOURCEVERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
34PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
35rm -f index.html
36
37# Cleanup Directory
38#
39cd ~/tmp
40rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
41tar xvf binutils-${SOURCEVERSION}.tar.bz2
42
43# Get Current Updates from CVS
44#
45cd ~/tmp
46mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
47CURRENTDIR=$(pwd -P)
48FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
49cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rbinutils-${FIXEDVERSION}-branch binutils
50mv src binutils-${SOURCEVERSION}
51
52# Cleanup
53#
54cd ~/tmp
55DIRS="binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig"
56for DIRECTORY in ${DIRS}; do
57 cd ~/tmp/${DIRECTORY}
58 FILE_LIST=".cvsignore *.gmo"
59 for files in ${FILE_LIST}; do
60 REMOVE=$(find * -name ${files})
61 for file in $REMOVE; do
62 rm -f ${file}
63 done
64 done
65
66 REMOVE=".cvsignore MAINTAINERS COPYING.LIBGLOSS COPYING.NEWLIB README-maintainer-mode depcomp
67 ChangeLog compile ltgcc.m4 lt~obsolete.m4 etc/ChangeLog etc/add-log.el etc/add-log.vi"
68 for file in $REMOVE; do
69 rm -f ${file}
70 done
71 cd ..
72done
73cd ~/tmp/binutils-${SOURCEVERSION}
74rm -f ~/tmp/binutils-${SOURCEVERSION}.orig/md5.sum
75
76# Make Binutils a Release
77#
78cd ~/tmp/binutils-${SOURCEVERSION}
79sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.am
80sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.in
81
82# Customize the version string, so we know it's patched
83#
84cd ~/tmp/binutils-${SOURCEVERSION}
85DATE_STAMP=$(date +%Y%m%d)
86cd ~/tmp/binutils-${SOURCEVERSION}
87sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
88sed -i "s:^[[:space:]]VERSION=\(.*\)$: VERSION=\1.${DATE_STAMP}:g" bfd/configure
89
90# Create Patch
91#
92cd ~/tmp
93install -d ~/patches
94echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
95echo "Date: `date +%m-%d-%Y`" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
96echo "Initial Package Version: ${SOURCEVERSION}" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
97echo "Origin: Upstream" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
98echo "Upstream Status: Applied" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
99echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
100echo " rechecked periodically." >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
101echo "" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
102echo "This patch was created on ${DATE_STAMP}" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
103echo "" >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
104diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
105echo "Created ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
106
107# Cleanliness is the name of my game!
108#
109unset DATE_STAMP
110
111# Create Another Copy to create fixes patch
112#
113cd ~/tmp
114if [ -e ${PATCH_DIR}/${VERSION} ]; then
115 rm -rf binutils-${SOURCEVERSION}.orig
116 cp -ar binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
117
118 # Apply Patches from directories
119 #
120 cd ~/tmp/binutils-${SOURCEVERSION}
121 PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
122 if [ "${PATCH_FILES}" != "" ]; then
123 for pfile in ${PATCH_FILES}; do
124 echo "Applying - ${pfile}..."
125 for pvalue in $(seq 0 5); do
126 patch --dry-run -Np${pvalue} -i ${pfile} > /dev/null 2>&1
127 if [ "${?}" = "0" ]; then
128 PVALUE=${pvalue}
129 break
130 fi
131 done
132 if [ "${PVALUE}" != "" ]; then
133 patch -Np${PVALUE} -i ${pfile}
134 else
135 echo "Patch: ${pfile} Failed to Apply..."
136 exit 255
137 fi
138 done
139 fi
140
141 # Cleanup Directory
142 #
143 cd ~/tmp/binutils-${SOURCEVERSION}
144 rm -f $(find * -name "*~")
145 rm -f $(find * -name "*.orig")
146 rm -f $(find * -name "*.rej")
147 rm -f *.orig *~ *.rej
148
149 # Create Patch
150 #
151 cd ~/tmp
152 install -d ~/patches
153 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
154 echo "Date: `date +%m-%d-%Y`" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
155 echo "Initial Package Version: ${VERSION}" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
156 echo "Origin: Upstream" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
157 echo "Upstream Status: Applied" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
158 echo "Description: This Patch contains fixes for binutils-${SOURCEVERSION}, and should be" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
159 echo " rechecked periodically." >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
160 echo "" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
161 diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
162 echo "Created ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch."
163fi
164
165# Cleanup Directory
166#
167cd ~/tmp
168rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
Note: See TracBrowser for help on using the repository browser.