[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
|
---|
| 35 | wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
|
---|
| 36 | PATCH_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)
|
---|
| 37 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
| 38 | rm -f index.html
|
---|
| 39 |
|
---|
| 40 | # Customize the version string, so we know it's patched
|
---|
| 41 | #
|
---|
| 42 | cd ~/tmp
|
---|
| 43 | mv src binutils-${VERSION}
|
---|
| 44 | DL_DATE=$(date +%Y%m%d)
|
---|
| 45 | cd ~/tmp/binutils-${VERSION}
|
---|
| 46 | sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS - Retrieved on ${DL_DATE}) :" bfd/Makefile.in
|
---|
| 47 |
|
---|
| 48 | # Remove Files not needed
|
---|
| 49 | #
|
---|
| 50 | cd ~/tmp/binutils-${VERSION}
|
---|
| 51 | FILE_LIST=".cvsignore"
|
---|
| 52 | for files in ${FILE_LIST}; do
|
---|
| 53 | REMOVE=$(find * -name ${files})
|
---|
| 54 | for file in $REMOVE; do
|
---|
| 55 | rm -f ${file}
|
---|
| 56 | done
|
---|
| 57 | done
|
---|
| 58 |
|
---|
| 59 | # Create a copy of the Original Directory So We can do some Updates
|
---|
| 60 | #
|
---|
| 61 | cd ~/tmp
|
---|
| 62 | cp -ar binutils-${VERSION} binutils-${VERSION}.orig
|
---|
| 63 |
|
---|
| 64 | # Apply Patches from directories
|
---|
| 65 | #
|
---|
| 66 | cd ~/tmp/binutils-${VERSION}
|
---|
| 67 | if [ -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
|
---|
| 87 | fi
|
---|
| 88 |
|
---|
| 89 | # Cleanup Directory
|
---|
| 90 | #
|
---|
| 91 | for 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
|
---|
| 102 | done
|
---|
| 103 | cd ~/tmp/binutils-${VERSION}
|
---|
| 104 | rm -rf *.orig *~ *.rej
|
---|
| 105 |
|
---|
| 106 | # Create Patch
|
---|
| 107 | #
|
---|
| 108 | diff -Naur ~/tmp/binutils-${VERSION} ~/tmp/binutils-${VERSION}.orig >> ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 109 | if [ "$(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."
|
---|
| 122 | else
|
---|
| 123 | rm ~/public_html/binutils-${VERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 124 | fi
|
---|
| 125 |
|
---|
| 126 | # Remove Patched Copy
|
---|
| 127 | #
|
---|
| 128 | cd ~/tmp
|
---|
| 129 | rm -rf binutils-${VERSION}
|
---|
| 130 | mv binutils-${VERSION}.orig binutils-${VERSION}
|
---|
| 131 |
|
---|
| 132 | # Compress
|
---|
| 133 | #
|
---|
| 134 | cd ~/tmp
|
---|
| 135 | install -d ~/packages
|
---|
| 136 | echo "Creating Tarball for Binutils ${VERSION}...."
|
---|
| 137 | tar cjf ~/packages/binutils-${VERSION}-${DL_DATE}.tar.bz2 binutils-${VERSION}
|
---|
| 138 |
|
---|
| 139 | # Clean up Directores
|
---|
| 140 | #
|
---|
| 141 | cd ~/tmp
|
---|
| 142 | rm -rf binutils-${VERSION}
|
---|