Ignore:
File:
1 edited

Legend:

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

    rd8a9d8b r3820147  
    2020# Download GCC Source
    2121#
    22 install -d ~/tmp
    23 cd ~/tmp
     22cd /usr/src
    2423if ! [ -e gcc-${VERSION}.tar.bz2  ]; then
    2524  wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-${VERSION}/gcc-${VERSION}.tar.bz2
     
    2827# Set Patch Number
    2928#
    30 cd ~/tmp
     29cd /usr/src
    3130wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing > /dev/null 2>&1
    3231PATCH_NUM=$(cat index.html | grep gcc | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
     
    3837# Cleanup Directory
    3938#
    40 cd ~/tmp
    4139rm -rf gcc-${VERSION} gcc-${VERSION}.orig
    4240tar xvf gcc-${VERSION}.tar.bz2
    4341mv gcc-${VERSION} gcc-${VERSION}.orig
     42CURRENTDIR=$(pwd -P)
    4443
    4544# Get Current Updates from SVN
    4645#
    47 cd ~/tmp
     46cd /usr/src
    4847NUM1=$(echo ${VERSION} | cut -f1 -d.)
    4948NUM2=$(echo ${VERSION} | cut -f2 -d.)
     
    5453# Add a custom version string
    5554#
    56 cd ~/tmp
    5755DATE_STAMP=$(cat gcc-${VERSION}/gcc/DATESTAMP)
    5856echo "${VERSION}" > gcc-${VERSION}/gcc/BASE-VER
     
    6159# Cleanup
    6260#
    63 cd ~/tmp
    6461DIRS="gcc-${VERSION} gcc-${VERSION}.orig"
    6562for DIRECTORY in ${DIRS}; do
    66   cd ~/tmp/${DIRECTORY}
     63  cd ${DIRECTORY}
    6764  REMOVE="ABOUT-NLS COPYING COPYING.LIB MAINTAINERS Makefile.def
    6865    Makefile.in Makefile.tpl README README.SCO BUGS FAQ LAST_UPDATED
    6966    MD5SUMS NEWS bugs.html faq.html gcc/BASE-VER gcc/DEV-PHASE
    70     gcc/f/BUGS gcc/f/NEWS gcc/gengtype-lex.c"
     67    gcc/f/BUGS gcc/f/NEWS gcc/c-parse.c gcc/gengtype-lex.c gcc/c-parse.y
     68    gcc/gengtype-yacc.c gcc/gengtype-yacc.h gcc/java/parse-scan.c
     69    gcc/java/parse.c gcc/objc/objc-parse.c gcc/objc/objc-parse.y
     70    libjava/classpath/doc/cp-tools.info"
    7171  for file in ${REMOVE}; do
    7272    rm -f $file
    7373  done
    7474  for file in $(find . -name "ChangeLog*" | sed -e 's@./@@'); do
    75     rm -fv ${file}
     75    rm -f ${file}
    7676  done
    77   REMVOVE_DIRS="INSTALL"
    78   for dir in ${REMOVE_DIRS}; do
    79     rm -rfv ${dir}
    80   done
    81   rm -fv fastjar/*.{1,info} gcc/doc/*.{1,info,7} gcc/fortran/*.{1,info,7} gcc/po/*.{gmo,po}
    82   rm -rf libcpp/po/*.{gmo,po} libgomp/*.{1,info,7} libjava/classpath/doc/*.{1,info}
    83  cd ..
     77  rm -rf INSTALL
     78  rm -f fastjar/*.{1,info} gcc/doc/*.{1,info,7} gcc/fortran/*.{1,info,7}
     79  rm -f gcc/po/*.{gmo,po}  libcpp/po/*.{gmo,po} libgomp/*.{1,info,7}
     80  rm -f libjava/classpath/doc/*.{1,info}
     81  cd ..
    8482done
    8583
    8684# Create Patch
    8785#
    88 cd ~/tmp
    89 install -d ~/patches
    90 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    91 echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    92 echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    93 echo "Origin: Upstream" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    94 echo "Upstream Status: Applied" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    95 echo "Description: This is a branch update for gcc-${VERSION}, and should be" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    96 echo "             rechecked periodically." >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    97 echo "" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    98 echo "This patch was made from Revision # ${REVISION}." >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    99 echo "" >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    100 diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
    101 echo "Created ~/patches/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch."
     86cd /usr/src
     87echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     88echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     89echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     90echo "Origin: Upstream" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     91echo "Upstream Status: Applied" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     92echo "Description: This is a branch update for gcc-${VERSION}, and should be" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     93echo "             rechecked periodically." >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     94echo "" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     95echo "This patch was made from Revision # ${REVISION}." >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     96echo "" >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     97diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-branch_update-${PATCH_NUM}.patch
     98echo "Created /usr/src/gcc-${VERSION}-branch_update-${PATCH_NUM}.patch."
    10299
    103100# Create Another Copy to create fixes patch
    104101#
    105 cd ~/tmp
     102cd /usr/src
     103rm -rf gcc-${VERSION}.orig
     104cp -ar gcc-${VERSION} gcc-${VERSION}.orig
     105
     106# Apply Patches from directories
     107#
     108cd /usr/src/gcc-${VERSION}
    106109if [ -e ${PATCH_DIR}/${VERSION} ]; then
    107   rm -rf gcc-${VERSION}.orig
    108   cp -ar gcc-${VERSION} gcc-${VERSION}.orig
    109 
    110   # Apply Patches from directories
    111   #
    112   cd ~/tmp/gcc-${VERSION}
    113110  PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
    114111  if [ "${PATCH_FILES}" != "" ]; then
     
    130127    done
    131128  fi
    132 
    133   # Cleanup Directory
    134   #
    135   cd ~/tmp/gcc-${VERSION}
    136   rm -f $(find * -name "*~")
    137   rm -f $(find * -name "*.orig")
    138   rm -f $(find * -name "*.rej")
    139   rm -f *.orig *~ *.rej
    140 
    141   # Create Patch
    142   #
    143   cd ~/tmp
    144   install -d ~/patches
    145   echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    146   echo "Date: `date +%m-%d-%Y`" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    147   echo "Initial Package Version: ${VERSION}" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    148   echo "Origin: Upstream" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    149   echo "Upstream Status: Applied" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    150   echo "Description: This Patch contains fixes for gcc-${VERSION}, and should be" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    151   echo "             rechecked periodically." >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    152   echo "" >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    153   diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
    154   echo "Created ~/patches/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch."
    155129fi
    156130
    157131# Cleanup Directory
    158132#
    159 cd ~/tmp
    160 rm -rf gcc-${VERSION} gcc-${VERSION}.orig
     133
     134for dir in $(find * -type d); do
     135  cd /usr/src/gcc-${VERSION}/${dir}
     136  for file in $(find . -name '*~'); do
     137    rm -f ${file}
     138  done
     139  for file in $(find . -name '*.orig'); do
     140    rm -f ${file}
     141  done
     142  for file in $(find . -name '*.rej'); do
     143    rm -f ${file}
     144  done
     145done
     146cd /usr/src/gcc-${VERSION}/
     147rm -rf *.orig *~ *.rej
     148
     149# Create Patch
     150#
     151cd /usr/src
     152echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     153echo "Date: `date +%m-%d-%Y`" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     154echo "Initial Package Version: ${VERSION}" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     155echo "Origin: Upstream" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     156echo "Upstream Status: Applied" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     157echo "Description: This Patch contains fixes for gcc-${VERSION}, and should be" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     158echo "             rechecked periodically." >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     159echo "" >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     160diff -Naur gcc-${VERSION}.orig gcc-${VERSION} >> gcc-${VERSION}-fixes-${PATCH_NUM2}.patch
     161echo "Created /usr/src/gcc-${VERSION}-fixes-${PATCH_NUM2}.patch."
Note: See TracChangeset for help on using the changeset viewer.