Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/patch/binutils-patch.sh

    rd8a9d8b r3820147  
    1919# Download Binutils Source
    2020#
    21 install -d ~/tmp
    22 cd ~/tmp
     21cd /usr/src
    2322if ! [ -e binutils-${SOURCEVERSION}.tar.bz2  ]; then
    2423  wget ftp://ftp.gnu.org/gnu/binutils/binutils-${SOURCEVERSION}.tar.bz2
     
    2726# Set Patch Number
    2827#
    29 cd ~/tmp
     28cd /usr/src
    3029wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
    3130PATCH_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)
    3231PATCH_NUM=$(expr ${PATCH_NUM} + 1)
    33 PATCH_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)
    34 PATCH_NUM2=$(expr ${PATCH_NUM2} + 1)
    3532rm -f index.html
    3633
    3734# Cleanup Directory
    3835#
    39 cd ~/tmp
    4036rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
    4137tar xvf binutils-${SOURCEVERSION}.tar.bz2
     38mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
     39CURRENTDIR=$(pwd -P)
    4240
    4341# Get Current Updates from CVS
    4442#
    45 cd ~/tmp
    46 mv binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
    47 CURRENTDIR=$(pwd -P)
     43cd /usr/src
    4844FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
    4945cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src export -rbinutils-${FIXEDVERSION}-branch binutils
     
    5248# Cleanup
    5349#
    54 cd ~/tmp
    5550DIRS="binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig"
    5651for DIRECTORY in ${DIRS}; do
    57   cd ~/tmp/${DIRECTORY}
     52  cd /usr/src/${DIRECTORY}
    5853  FILE_LIST=".cvsignore *.gmo"
    5954  for files in ${FILE_LIST}; do
     
    7166    cd ..
    7267done
    73 cd ~/tmp/binutils-${SOURCEVERSION}
    74 rm -f ~/tmp/binutils-${SOURCEVERSION}.orig/md5.sum
     68cd /usr/src/binutils-${SOURCEVERSION}
     69rm -f /usr/src/binutils-${SOURCEVERSION}.orig/md5.sum
    7570
    7671# Make Binutils a Release
    7772#
    78 cd ~/tmp/binutils-${SOURCEVERSION}
     73cd /usr/src/binutils-${SOURCEVERSION}
    7974sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.am
    8075sed -i 's/# RELEASE=y/RELEASE=y/g' bfd/Makefile.in
     
    8277# Customize the version string, so we know it's patched
    8378#
    84 cd ~/tmp/binutils-${SOURCEVERSION}
     79cd /usr/src/binutils-${SOURCEVERSION}
    8580DATE_STAMP=$(date +%Y%m%d)
    86 cd ~/tmp/binutils-${SOURCEVERSION}
     81cd /usr/src/binutils-${SOURCEVERSION}
    8782sed -i "s:@PKGVERSION@:(GNU Binutils for Cross-LFS) :" bfd/Makefile.in
    8883sed -i "s:^[[:space:]]VERSION=\(.*\)$: VERSION=\1.${DATE_STAMP}:g" bfd/configure
     
    9085# Create Patch
    9186#
    92 cd ~/tmp
    93 install -d ~/patches
    94 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    95 echo "Date: `date +%m-%d-%Y`" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    96 echo "Initial Package Version: ${SOURCEVERSION}" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    97 echo "Origin: Upstream" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    98 echo "Upstream Status: Applied" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    99 echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    100 echo "             rechecked periodically." >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    101 echo "" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    102 echo "This patch was created on ${DATE_STAMP}" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    103 echo "" >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    104 diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >>  ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
    105 echo "Created ~/patches/binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch."
     87cd /usr/src
     88echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     89echo "Date: `date +%m-%d-%Y`" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     90echo "Initial Package Version: ${SOURCEVERSION}" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     91echo "Origin: Upstream" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     92echo "Upstream Status: Applied" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     93echo "Description: This is a branch update for binutils-${SOURCEVERSION}, and should be" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     94echo "             rechecked periodically." >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     95echo "" >> binutils-${SOURCEVERSION}-branch_update-${PATCH_NUM}.patch
     96echo "This patch was created on ${DATE_STAMP}" >> 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."
    106100
    107101# Cleanliness is the name of my game!
    108102#
    109103unset DATE_STAMP
    110 
    111 # Create Another Copy to create fixes patch
    112 #
    113 cd ~/tmp
    114 if [ -e ${PATCH_DIR}/${VERSION} ]; then
    115   rm -rf binutils-${SOURCEVERSION}.orig
    116   cp -ar binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
    117 
    118   # Apply Patches from directories
    119   #
    120   cd ~/tmp/binutils-${SOURCEVERSION}
    121   PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
    122   if [ "${PATCH_FILES}" != "" ]; then
    123     for pfile in ${PATCH_FILES}; do
    124       echo "Applying - ${pfile}..."
    125       for pvalue in $(seq 0 5); do
    126         patch --dry-run -Np${pvalue} -i ${pfile} > /dev/null 2>&1
    127         if [ "${?}" = "0" ]; then
    128           PVALUE=${pvalue}
    129           break
    130         fi
    131       done
    132       if [ "${PVALUE}" != "" ]; then
    133         patch -Np${PVALUE} -i ${pfile}
    134       else
    135         echo "Patch: ${pfile} Failed to Apply..."
    136         exit 255
    137       fi
    138     done
    139   fi
    140 
    141   # Cleanup Directory
    142   #
    143   cd ~/tmp/binutils-${SOURCEVERSION}
    144   rm -f $(find * -name "*~")
    145   rm -f $(find * -name "*.orig")
    146   rm -f $(find * -name "*.rej")
    147   rm -f *.orig *~ *.rej
    148 
    149   # Create Patch
    150   #
    151   cd ~/tmp
    152   install -d ~/patches
    153   echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    154   echo "Date: `date +%m-%d-%Y`" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    155   echo "Initial Package Version: ${VERSION}" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    156   echo "Origin: Upstream" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    157   echo "Upstream Status: Applied" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    158   echo "Description: This Patch contains fixes for binutils-${SOURCEVERSION}, and should be" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    159   echo "             rechecked periodically." >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    160   echo "" >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    161   diff -Naur binutils-${SOURCEVERSION}.orig binutils-${SOURCEVERSION} >> ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch
    162   echo "Created ~/patches/binutils-${SOURCEVERSION}-fixes-${PATCH_NUM2}.patch."
    163 fi
    164 
    165 # Cleanup Directory
    166 #
    167 cd ~/tmp
    168 rm -rf binutils-${SOURCEVERSION} binutils-${SOURCEVERSION}.orig
Note: See TracChangeset for help on using the changeset viewer.