source: scripts/fetch/binutils.sh@ ab51b1c

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

Added Binutils Fetch. Added check for fixes patch.

  • Property mode set to 100755
File size: 4.1 KB
RevLine 
[e47a554]1#!/bin/bash
2# Create a Binutils Tarball
3
4# Get Version #
5#
6VERSION=$1
7
8# Check Input
9#
10if [ "${VERSION}" = "" ]; then
11 echo "$0 - Binutils_Version"
12 echo "This will Create a Tarball for Binutils Binutils_Version"
13 echo "Example $0 2.19.51"
14 exit 255
15fi
16
17# Clear out old Directory
18#
19rm -rf ~/tmp
20
21# Set Patch Directory
22#
23PATCH_DIR=$(pwd -P)/binutils
24
25# Get Current binutils from SVN
26#
27install -d ~/tmp
28cd ~/tmp
29echo "Pulling latest Binutils trunk from CVS..."
30cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rHEAD binutils
31
32# Set Patch Number
33#
34cd ~/tmp
35wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
36PATCH_NUM=$(cat index.html | grep binutils | grep "${VERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
37PATCH_NUM=$(expr ${PATCH_NUM} + 1)
38rm -f index.html
39
40# Customize the version string, so we know it's patched
41#
42cd ~/tmp
43mv src binutils-${VERSION}
44DL_DATE=$(date +%Y%m%d)
45cd ~/tmp/binutils-${VERSION}
46sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS - Retrieved on ${DL_DATE}) :" bfd/Makefile.in
47
48# Remove Files not needed
49#
50cd ~/tmp/binutils-${VERSION}
51FILE_LIST=".cvsignore"
52for files in ${FILE_LIST}; do
53 REMOVE=$(find * -name ${files})
54 for file in $REMOVE; do
55 rm -f ${file}
56 done
57done
58
59# Create a copy of the Original Directory So We can do some Updates
60#
61cd ~/tmp
62cp -ar binutils-${VERSION} binutils-${VERSION}.orig
63
64# Apply Patches from directories
65#
66cd ~/tmp/binutils-${VERSION}
67if [ -e ${PATCH_DIR}/${VERSION} ]; then
68 PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
69 if [ "${PATCH_FILES}" != "" ]; then
70 for pfile in ${PATCH_FILES}; do
71 echo "Applying - ${pfile}..."
72 for pvalue in $(seq 0 5); do
73 patch --dry-run -Np${pvalue} -i ${pfile} > /dev/null 2>&1
74 if [ "${?}" = "0" ]; then
75 PVALUE=${pvalue}
76 break
77 fi
78 done
79 if [ "${PVALUE}" != "" ]; then
80 patch -Np${PVALUE} -i ${pfile}
81 else
82 echo "Patch: ${pfile} Failed to Apply..."
83 exit 255
84 fi
85 done
86 fi
87fi
88
89# Cleanup Directory
90#
91for dir in $(find * -type d); do
92 cd ~/tmp/binutils-${VERSION}
93 for file in $(find . -name '*~'); do
94 rm -f ${file}
95 done
96 for file in $(find . -name '*.orig'); do
97 rm -f ${file}
98 done
99 for file in $(find . -name '*.rej'); do
100 rm -f ${file}
101 done
102done
103cd ~/tmp/binutils-${VERSION}
104rm -rf *.orig *~ *.rej
105
106# Create Patch
107#
108diff -Naur ~/tmp/binutils-${VERSION} ~/tmp/binutils-${VERSION}.orig >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
109if [ "$(cat ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch)" != "" ]; then
110 cd ~/tmp/binutils-${VERSION}
111 install -d ~/public_html/
112 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
113 echo "Date: `date +%m-%d-%Y`" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
114 echo "Initial Package Version: ${VERSION}" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
115 echo "Origin: Upstream" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
116 echo "Upstream Status: Applied" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
117 echo "Description: These are fixes binutils-${VERSION}, and should be" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
118 echo " rechecked periodically." >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
119 echo "" >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
120 diff -Naur ~/tmp/binutils-${VERSION} ~/tmp/binutils-${VERSION}.orig >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
121 echo "Created ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch."
122else
123 rm ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
124fi
125
126# Remove Patched Copy
127#
128cd ~/tmp
129rm -rf binutils-${VERSION}
130mv binutils-${VERSION}.orig binutils-${VERSION}
131
132# Compress
133#
134cd ~/tmp
135install -d ~/packages
136echo "Creating Tarball for Binutils ${VERSION}...."
137tar cjf ~/packages/binutils-${VERSION}-${DL_DATE}.tar.bz2 binutils-${VERSION}
138
139# Clean up Directores
140#
141cd ~/tmp
142rm -rf binutils-${VERSION}
Note: See TracBrowser for help on using the repository browser.