source: scripts/patch/binutils-patch.sh@ 663f8a7

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 663f8a7 was 5d01446, checked in by Jim Gifford <clfs@…>, 16 years ago

Update binutils patch script

  • Property mode set to 100755
File size: 3.4 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#
21cd /usr/src
22if ! [ -e binutils-${SOURCEVERSION}.tar.bz2 ]; then
23 wget ftp://ftp.gnu.org/gnu/binutils/binutils-${SOURCEVERSION}.tar.bz2
24fi
25
26# Set Patch Number
27#
28cd /usr/src
29wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
30PATCH_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)
31PATCH_NUM=$(expr ${PATCH_NUM} + 1)
32rm -f index.html
33
34# Cleanup Directory
35#
36rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
37tar xvf binutils-${SOURCEVERSION}.tar.bz2
38mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
39CURRENTDIR=$(pwd -P)
40
41# Get Current Updates from CVS
42#
43cd /usr/src
44FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
45cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rbinutils-${FIXEDVERSION}-branch binutils
46mv src binutils-${SOURCEVERSION}
47
48# Cleanup
49#
50DIRS="binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig"
51for 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 ..
67done
68cd /usr/src/binutils-${SOURCEVERSION}
69rm -f /usr/src/binutils-${SOURCEVERSION}.orig/md5.sum
70
71# Make Binutils a Release
72#
73cd /usr/src/binutils-${SOURCEVERSION}
74sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.am
75sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.in
76
77# Customize the version string, so we know it's patched
78#
79cd /usr/src/binutils-${SOURCEVERSION}
80DATE_STAMP="`date +%Y%m%d`"
81cd /usr/src/binutils-${SOURCEVERSION}
82sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
83sed -i "s:^[[:space:]]VERSION=\(.*\)$:VERSION=\1.${DATE_STAMP}:g" bfd/configure
84# Cleanliness is the name of my game!
85unset DATE_STAMP
86
87# Create Patch
88#
89cd /usr/src
90echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
91echo "Date: `date +%m-%d-%Y`" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
92echo "Initial Package Version: ${SOURCEVERSION}" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
93echo "Origin: Upstream" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
94echo "Upstream Status: Applied" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
95echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
96echo " rechecked periodically." >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
97echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
98diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
99echo "Created /usr/src/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
Note: See TracBrowser for help on using the repository browser.