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