source: scripts/fetch/eglibc.sh@ d5cf32ea

Last change on this file since d5cf32ea was 841faaa, checked in by Jim Gifford <clfs@…>, 15 years ago

Updated Patch to Show were created files are located

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