source: scripts/fetch/eglibc.sh@ 16b5be3

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 16b5be3 was 65a1d51, checked in by Jim Gifford <clfs@…>, 15 years ago

Updated eglibc fetch script

  • Property mode set to 100755
File size: 5.8 KB
Line 
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
18# Clear out old Directory
19#
20rm -rf ~/tmp
21
22# Set Patch Directory
23#
24PATCH_DIR=$(pwd -P)/eglibc
25
26# Get Current Eglibc from SVN
27#
28install -d ~/tmp
29cd ~/tmp
30FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
31DL_REVISION=$(svn info svn://svn.eglibc.org/branches/eglibc-${FIXEDVERSION} | grep "Last Changed Rev" | cut -f2 -d: | sed -e 's/ //g')
32echo "Retreiving Revision #${DL_REVISION} from SVN eglibc-${SOURCEVERSION}..."
33svn export -r ${DL_REVISION} svn://svn.eglibc.org/branches/eglibc-${FIXEDVERSION} eglibc-${SOURCEVERSION}
34
35# Set Patch Number
36#
37cd ~/tmp
38wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
39PATCH_NUM=$(cat index.html | grep eglibc | grep "${SOURCEVERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
40PATCH_NUM=$(expr ${PATCH_NUM} + 1)
41rm -f index.html
42
43# Customize the version string, so we know it's patched
44#
45install -d ~/tmp/eglibc-${SOURCEVERSION}
46cd ~/tmp/eglibc-${SOURCEVERSION}
47DL_DATE=$(date +%Y%m%d)
48echo "#define DL_DATE \"${DL_DATE}\"" >> libc/version.h
49echo "#define DL_REVISION \"${DL_REVISION}\"" >> libc/version.h
50sed -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
51sed -i "s@Compiled by GNU CC version@Revision # \"DL_REVISION\".\\\\n\\\\\\nCompiled by GNU CC version@" libc/csu/version.c
52sed -i "s@static const char __libc_release@static const char __libc_dl_date[] = DL_DATE;\nstatic const char __libc_release@" libc/csu/version.c
53sed -i "s@static const char __libc_release@static const char __libc_dl_revision[] = DL_REVISION;\nstatic const char __libc_release@" libc/csu/version.c
54
55# Remove Files not needed
56#
57cd ~/tmp/eglibc-${SOURCEVERSION}
58FILE_LIST=".cvsignore"
59for files in ${FILE_LIST}; do
60 REMOVE=$(find * -name ${files})
61 for file in $REMOVE; do
62 rm -f ${file}
63 done
64done
65
66# Fix configuration files
67#
68cd ~/tmp/eglibc-${SOURCEVERSION}
69echo "Updating Glibc configure files..."
70find . -name configure -exec touch {} \;
71
72# Create A copy of the Original Directory So We can do some Updates
73#
74cd ~/tmp/eglibc-${SOURCEVERSION}
75cp -ar libc libc.orig
76
77# Change gcc to BUILD_CC in the following files
78#
79cd ~/tmp/eglibc-${SOURCEVERSION}/libc
80FIX_FILES="sunrpc/Makefile timezone/Makefile"
81for fix_file in ${FIX_FILES}; do
82 sed -i 's/gcc/\$\(BUILD_CC\)/g' ${fix_file}
83done
84
85# Make testsuite fixes
86#
87cd ~/tmp/eglibc-${SOURCEVERSION}/libc
88sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
89sed -i s/utf8/UTF-8/ libio/tst-fgetwc.c
90sed -i '/tst-fgetws-ENV/ a\
91tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata' libio/Makefile
92
93# Apply Patches from directories
94#
95cd ~/tmp/eglibc-${SOURCEVERSION}/libc
96if [ -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
116fi
117
118# Cleanup Directory
119#
120for 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
131done
132cd ~/tmp/eglibc-${SOURCEVERSION}/libc
133rm -rf *.orig *~ *.rej
134
135# Create Patch
136#
137cd ~/tmp/eglibc-${SOURCEVERSION}
138install -d ~/patches/
139echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
140echo "Date: `date +%m-%d-%Y`" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
141echo "Initial Package Version: ${SOURCEVERSION}" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
142echo "Origin: Upstream" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
143echo "Upstream Status: Applied" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
144echo "Description: These are fixes eglibc-${SOURCEVERSION}, and should be" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
145echo " rechecked periodically." >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
146echo "" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
147diff -Naur libc.orig libc >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
148echo "Created ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch."
149
150# Remove Patched Copy
151#
152cd ~/tmp/eglibc-${SOURCEVERSION}
153rm -rf libc
154mv libc.orig libc
155
156# Compress
157#
158cd ~/tmp/eglibc-${SOURCEVERSION}
159install -d ~/packages
160echo "Creating Tarball for Eglibc Ports ${SOURCEVERSION}...."
161tar cjf ~/packages/eglibc-ports-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 ports
162rm -rf ports
163echo "Creating Tarball for Eglibc Linuxthreads ${SOURCEVERSION}...."
164tar cjf ~/packages/eglibc-linuxthreads-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 linuxthreads
165rm -rf linuxthreads
166echo "Creating Tarball for Eglibc LocaleDef ${SOURCEVERSION}...."
167tar cjf ~/packages/eglibc-localedef-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 localedef
168rm -rf localedef
169mv libc eglibc-${SOURCEVERSION}
170echo "Creating Tarball for Eglibc ${SOURCEVERSION}...."
171tar cjf ~/packages/eglibc-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 eglibc-${SOURCEVERSION}
172
173# Clean up Directores
174#
175cd ~/tmp
176rm -rf eglibc-${SOURCEVERSION}
Note: See TracBrowser for help on using the repository browser.