source: scripts/patch/binutils-patch.sh@ 842cd58

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

Changed Patches URL's

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