[aa81e76] | 1 | #!/bin/bash
|
---|
| 2 | # Create a Eglibc Tarball
|
---|
| 3 |
|
---|
| 4 | # Get Version #
|
---|
| 5 | #
|
---|
| 6 | VERSION=$1
|
---|
| 7 | SOURCEVERSION=$2
|
---|
| 8 |
|
---|
| 9 | # Check Input
|
---|
| 10 | #
|
---|
| 11 | if [ "${VERSION}" = "" -o "${SOURCEVERSION}" = "" ]; then
|
---|
| 12 | echo "$0 - Eglibc_Version"
|
---|
| 13 | echo "This will Create a Tarball for Eglibc Eglibc_Series Eglibc_Version"
|
---|
| 14 | echo "Example $0 2.19 2.19.1"
|
---|
| 15 | exit 255
|
---|
| 16 | fi
|
---|
| 17 |
|
---|
[167f981] | 18 | # Clear out old Directory
|
---|
| 19 | #
|
---|
| 20 | rm -rf ~/tmp
|
---|
| 21 |
|
---|
[65a1d51] | 22 | # Set Patch Directory
|
---|
| 23 | #
|
---|
| 24 | PATCH_DIR=$(pwd -P)/eglibc
|
---|
| 25 |
|
---|
[aa81e76] | 26 | # Get Current Eglibc from SVN
|
---|
| 27 | #
|
---|
| 28 | install -d ~/tmp
|
---|
| 29 | cd ~/tmp
|
---|
| 30 | FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
|
---|
[65a1d51] | 31 | DL_REVISION=$(svn info svn://svn.eglibc.org/branches/eglibc-${FIXEDVERSION} | grep "Last Changed Rev" | cut -f2 -d: | sed -e 's/ //g')
|
---|
[a689767] | 32 | echo "Retreiving Revision #${DL_REVISION} from SVN eglibc-${SOURCEVERSION}..."
|
---|
| 33 | svn export -r ${DL_REVISION} svn://svn.eglibc.org/branches/eglibc-${FIXEDVERSION} eglibc-${SOURCEVERSION}
|
---|
[aa81e76] | 34 |
|
---|
[0053d13] | 35 | # Set Patch Number
|
---|
| 36 | #
|
---|
| 37 | cd ~/tmp
|
---|
| 38 | wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
|
---|
[e47a554] | 39 | PATCH_NUM=$(cat index.html | grep eglibc | grep "${SOURCEVERSION}" | grep fixes | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
|
---|
[0053d13] | 40 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
| 41 | rm -f index.html
|
---|
| 42 |
|
---|
[aa81e76] | 43 | # Customize the version string, so we know it's patched
|
---|
| 44 | #
|
---|
[65a1d51] | 45 | install -d ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[aa81e76] | 46 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[a689767] | 47 | DL_DATE=$(date +%Y%m%d)
|
---|
| 48 | echo "#define DL_DATE \"${DL_DATE}\"" >> libc/version.h
|
---|
| 49 | echo "#define DL_REVISION \"${DL_REVISION}\"" >> libc/version.h
|
---|
[aa81e76] | 50 | sed -i "s@Compiled by GNU CC version@Built for Cross-LFS.\\\\n\\\\\nRetrieved on \"DL_DATE\".\\\\n\\\\\\nCompiled by GNU CC version@" libc/csu/version.c
|
---|
[a689767] | 51 | sed -i "s@Compiled by GNU CC version@Revision # \"DL_REVISION\".\\\\n\\\\\\nCompiled by GNU CC version@" libc/csu/version.c
|
---|
[aa81e76] | 52 | sed -i "s@static const char __libc_release@static const char __libc_dl_date[] = DL_DATE;\nstatic const char __libc_release@" libc/csu/version.c
|
---|
[a689767] | 53 | sed -i "s@static const char __libc_release@static const char __libc_dl_revision[] = DL_REVISION;\nstatic const char __libc_release@" libc/csu/version.c
|
---|
[aa81e76] | 54 |
|
---|
| 55 | # Remove Files not needed
|
---|
| 56 | #
|
---|
[167f981] | 57 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[aa81e76] | 58 | FILE_LIST=".cvsignore"
|
---|
| 59 | for files in ${FILE_LIST}; do
|
---|
| 60 | REMOVE=$(find * -name ${files})
|
---|
| 61 | for file in $REMOVE; do
|
---|
| 62 | rm -f ${file}
|
---|
| 63 | done
|
---|
| 64 | done
|
---|
| 65 |
|
---|
| 66 | # Fix configuration files
|
---|
| 67 | #
|
---|
[167f981] | 68 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[aa81e76] | 69 | echo "Updating Glibc configure files..."
|
---|
| 70 | find . -name configure -exec touch {} \;
|
---|
| 71 |
|
---|
[55439e2] | 72 | # Create a copy of the Original Directory So We can do some Updates
|
---|
[0053d13] | 73 | #
|
---|
| 74 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
| 75 | cp -ar libc libc.orig
|
---|
| 76 |
|
---|
| 77 | # Change gcc to BUILD_CC in the following files
|
---|
| 78 | #
|
---|
| 79 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
| 80 | FIX_FILES="sunrpc/Makefile timezone/Makefile"
|
---|
| 81 | for fix_file in ${FIX_FILES}; do
|
---|
| 82 | sed -i 's/gcc/\$\(BUILD_CC\)/g' ${fix_file}
|
---|
| 83 | done
|
---|
| 84 |
|
---|
| 85 | # Make testsuite fixes
|
---|
| 86 | #
|
---|
| 87 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
| 88 | sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
|
---|
| 89 | sed -i s/utf8/UTF-8/ libio/tst-fgetwc.c
|
---|
| 90 | sed -i '/tst-fgetws-ENV/ a\
|
---|
| 91 | tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata' libio/Makefile
|
---|
| 92 |
|
---|
[65a1d51] | 93 | # Apply Patches from directories
|
---|
| 94 | #
|
---|
| 95 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
| 96 | if [ -e ${PATCH_DIR}/${VERSION} ]; then
|
---|
| 97 | PATCH_FILES=$(ls ${PATCH_DIR}/${VERSION}/*.patch)
|
---|
| 98 | if [ "${PATCH_FILES}" != "" ]; then
|
---|
| 99 | for pfile in ${PATCH_FILES}; do
|
---|
| 100 | echo "Applying - ${pfile}..."
|
---|
| 101 | for pvalue in $(seq 0 5); do
|
---|
| 102 | patch --dry-run -Np${pvalue} -i ${pfile} > /dev/null 2>&1
|
---|
| 103 | if [ "${?}" = "0" ]; then
|
---|
| 104 | PVALUE=${pvalue}
|
---|
| 105 | break
|
---|
| 106 | fi
|
---|
| 107 | done
|
---|
| 108 | if [ "${PVALUE}" != "" ]; then
|
---|
| 109 | patch -Np${PVALUE} -i ${pfile}
|
---|
| 110 | else
|
---|
| 111 | echo "Patch: ${pfile} Failed to Apply..."
|
---|
| 112 | exit 255
|
---|
| 113 | fi
|
---|
| 114 | done
|
---|
| 115 | fi
|
---|
| 116 | fi
|
---|
| 117 |
|
---|
| 118 | # Cleanup Directory
|
---|
| 119 | #
|
---|
| 120 | for dir in $(find * -type d); do
|
---|
| 121 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
| 122 | for file in $(find . -name '*~'); do
|
---|
| 123 | rm -f ${file}
|
---|
| 124 | done
|
---|
| 125 | for file in $(find . -name '*.orig'); do
|
---|
| 126 | rm -f ${file}
|
---|
| 127 | done
|
---|
| 128 | for file in $(find . -name '*.rej'); do
|
---|
| 129 | rm -f ${file}
|
---|
| 130 | done
|
---|
| 131 | done
|
---|
| 132 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
| 133 | rm -rf *.orig *~ *.rej
|
---|
| 134 |
|
---|
[0053d13] | 135 | # Create Patch
|
---|
| 136 | #
|
---|
| 137 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[e47a554] | 138 | install -d ~/public_html/
|
---|
| 139 | diff -Naur libc.orig libc >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 140 | if [ "$(cat ~/public_html/eglibc-${VERSION}-fixes-${PATCH_NUM}.patch)" != "" ]; then
|
---|
| 141 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 142 | echo "Date: `date +%m-%d-%Y`" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 143 | echo "Initial Package Version: ${SOURCEVERSION}" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 144 | echo "Origin: Upstream" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 145 | echo "Upstream Status: Applied" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 146 | echo "Description: These are fixes eglibc-${SOURCEVERSION}, and should be" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 147 | echo " rechecked periodically." >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 148 | echo "" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 149 | diff -Naur libc.orig libc >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 150 | echo "Created ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch."
|
---|
| 151 | else
|
---|
| 152 | rm -f ~/public_html/eglibc-${VERSION}-fixes-${PATCH_NUM}.patch
|
---|
| 153 | fi
|
---|
[0053d13] | 154 |
|
---|
| 155 | # Remove Patched Copy
|
---|
| 156 | #
|
---|
| 157 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
| 158 | rm -rf libc
|
---|
| 159 | mv libc.orig libc
|
---|
| 160 |
|
---|
[aa81e76] | 161 | # Compress
|
---|
| 162 | #
|
---|
[167f981] | 163 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
[65a1d51] | 164 | install -d ~/packages
|
---|
[aa81e76] | 165 | echo "Creating Tarball for Eglibc Ports ${SOURCEVERSION}...."
|
---|
[65a1d51] | 166 | tar cjf ~/packages/eglibc-ports-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 ports
|
---|
[aa81e76] | 167 | rm -rf ports
|
---|
| 168 | echo "Creating Tarball for Eglibc Linuxthreads ${SOURCEVERSION}...."
|
---|
[65a1d51] | 169 | tar cjf ~/packages/eglibc-linuxthreads-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 linuxthreads
|
---|
[aa81e76] | 170 | rm -rf linuxthreads
|
---|
| 171 | echo "Creating Tarball for Eglibc LocaleDef ${SOURCEVERSION}...."
|
---|
[65a1d51] | 172 | tar cjf ~/packages/eglibc-localedef-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 localedef
|
---|
[aa81e76] | 173 | rm -rf localedef
|
---|
| 174 | mv libc eglibc-${SOURCEVERSION}
|
---|
| 175 | echo "Creating Tarball for Eglibc ${SOURCEVERSION}...."
|
---|
[65a1d51] | 176 | tar cjf ~/packages/eglibc-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 eglibc-${SOURCEVERSION}
|
---|
[aa81e76] | 177 |
|
---|
| 178 | # Clean up Directores
|
---|
| 179 | #
|
---|
| 180 | cd ~/tmp
|
---|
| 181 | rm -rf eglibc-${SOURCEVERSION}
|
---|