source: scripts/fetch/eglibc.sh@ d3d4417f

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

Added Binutils Fetch. Added check for fixes patch.

  • Property mode set to 100755
File size: 6.1 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 fixes | 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 ~/public_html/
139diff -Naur libc.orig libc >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
140if [ "$(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."
151else
152 rm -f ~/public_html/eglibc-${VERSION}-fixes-${PATCH_NUM}.patch
153fi
154
155# Remove Patched Copy
156#
157cd ~/tmp/eglibc-${SOURCEVERSION}
158rm -rf libc
159mv libc.orig libc
160
161# Compress
162#
163cd ~/tmp/eglibc-${SOURCEVERSION}
164install -d ~/packages
165echo "Creating Tarball for Eglibc Ports ${SOURCEVERSION}...."
166tar cjf ~/packages/eglibc-ports-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 ports
167rm -rf ports
168echo "Creating Tarball for Eglibc Linuxthreads ${SOURCEVERSION}...."
169tar cjf ~/packages/eglibc-linuxthreads-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 linuxthreads
170rm -rf linuxthreads
171echo "Creating Tarball for Eglibc LocaleDef ${SOURCEVERSION}...."
172tar cjf ~/packages/eglibc-localedef-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 localedef
173rm -rf localedef
174mv libc eglibc-${SOURCEVERSION}
175echo "Creating Tarball for Eglibc ${SOURCEVERSION}...."
176tar cjf ~/packages/eglibc-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 eglibc-${SOURCEVERSION}
177
178# Clean up Directores
179#
180cd ~/tmp
181rm -rf eglibc-${SOURCEVERSION}
Note: See TracBrowser for help on using the repository browser.