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 |
|
---|
18 | # Clear out old Directory
|
---|
19 | #
|
---|
20 | rm -rf ~/tmp
|
---|
21 |
|
---|
22 | # Set Patch Directory
|
---|
23 | #
|
---|
24 | PATCH_DIR=$(pwd -P)/eglibc
|
---|
25 |
|
---|
26 | # Get Current Eglibc from SVN
|
---|
27 | #
|
---|
28 | install -d ~/tmp
|
---|
29 | cd ~/tmp
|
---|
30 | FIXEDVERSION=$(echo ${VERSION} | sed -e 's/\./_/g')
|
---|
31 | DL_REVISION=$(svn info svn://svn.eglibc.org/branches/eglibc-${FIXEDVERSION} | grep "Last Changed Rev" | cut -f2 -d: | sed -e 's/ //g')
|
---|
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}
|
---|
34 |
|
---|
35 | # Set Patch Number
|
---|
36 | #
|
---|
37 | cd ~/tmp
|
---|
38 | wget http://svn.cross-lfs.org/svn/repos/patches/eglibc/ --no-remove-listing
|
---|
39 | for num in $(seq 1 99); do
|
---|
40 | PATCH_NUM=$(cat index.html | grep "${VERSION}" | grep fixes-${num} | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
|
---|
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
|
---|
49 | done
|
---|
50 | rm -f index.html
|
---|
51 |
|
---|
52 | # Customize the version string, so we know it's patched
|
---|
53 | #
|
---|
54 | install -d ~/tmp/eglibc-${SOURCEVERSION}
|
---|
55 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
56 | DL_DATE=$(date +%Y%m%d)
|
---|
57 | echo "#define DL_DATE \"${DL_DATE}\"" >> libc/version.h
|
---|
58 | echo "#define DL_REVISION \"${DL_REVISION}\"" >> libc/version.h
|
---|
59 | 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
|
---|
60 | sed -i "s@Compiled by GNU CC version@Revision # \"DL_REVISION\".\\\\n\\\\\\nCompiled by GNU CC version@" libc/csu/version.c
|
---|
61 | 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
|
---|
62 | 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
|
---|
63 |
|
---|
64 | # Remove Files not needed
|
---|
65 | #
|
---|
66 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
67 | FILE_LIST=".cvsignore"
|
---|
68 | for files in ${FILE_LIST}; do
|
---|
69 | REMOVE=$(find * -name ${files})
|
---|
70 | for file in $REMOVE; do
|
---|
71 | rm -f ${file}
|
---|
72 | done
|
---|
73 | done
|
---|
74 |
|
---|
75 | # Fix configuration files
|
---|
76 | #
|
---|
77 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
78 | echo "Updating Glibc configure files..."
|
---|
79 | find . -name configure -exec touch {} \;
|
---|
80 |
|
---|
81 | # Create a copy of the Original Directory So We can do some Updates
|
---|
82 | #
|
---|
83 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
84 | cp -ar libc libc.orig
|
---|
85 |
|
---|
86 | # Change gcc to BUILD_CC in the following files
|
---|
87 | #
|
---|
88 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
89 | FIX_FILES="sunrpc/Makefile timezone/Makefile"
|
---|
90 | for fix_file in ${FIX_FILES}; do
|
---|
91 | sed -i 's/gcc/\$\(BUILD_CC\)/g' ${fix_file}
|
---|
92 | done
|
---|
93 |
|
---|
94 | # Make testsuite fixes
|
---|
95 | #
|
---|
96 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
97 | sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
|
---|
98 | sed -i s/utf8/UTF-8/ libio/tst-fgetwc.c
|
---|
99 | sed -i '/tst-fgetws-ENV/ a\
|
---|
100 | tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata' libio/Makefile
|
---|
101 |
|
---|
102 | # Apply Patches from directories
|
---|
103 | #
|
---|
104 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
105 | if [ -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
|
---|
125 | fi
|
---|
126 |
|
---|
127 | # Cleanup Directory
|
---|
128 | #
|
---|
129 | for 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
|
---|
140 | done
|
---|
141 | cd ~/tmp/eglibc-${SOURCEVERSION}/libc
|
---|
142 | rm -rf *.orig *~ *.rej
|
---|
143 |
|
---|
144 | # Create Patch
|
---|
145 | #
|
---|
146 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
147 | install -d ~/public_html/
|
---|
148 | diff -Naur libc.orig libc >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
149 | if [ "$(cat ~/public_html/eglibc-${VERSION}-fixes-${PATCH_NUM}.patch)" != "" ]; then
|
---|
150 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
151 | echo "Date: `date +%m-%d-%Y`" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
152 | echo "Initial Package Version: ${SOURCEVERSION}" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
153 | echo "Origin: Upstream" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
154 | echo "Upstream Status: Applied" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
155 | echo "Description: These are fixes eglibc-${SOURCEVERSION}, and should be" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
156 | echo " rechecked periodically." >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
157 | echo "" >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
158 | diff -Naur libc.orig libc >> ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
159 | echo "Created ~/public_html/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch."
|
---|
160 | else
|
---|
161 | rm -f ~/public_html/eglibc-${VERSION}-fixes-${PATCH_NUM}.patch
|
---|
162 | fi
|
---|
163 |
|
---|
164 | # Remove Patched Copy
|
---|
165 | #
|
---|
166 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
167 | rm -rf libc
|
---|
168 | mv libc.orig libc
|
---|
169 |
|
---|
170 | # Compress
|
---|
171 | #
|
---|
172 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
173 | install -d ~/packages
|
---|
174 | echo "Creating Tarball for Eglibc Ports ${SOURCEVERSION}...."
|
---|
175 | tar cjf ~/packages/eglibc-ports-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 ports
|
---|
176 | rm -rf ports
|
---|
177 | echo "Creating Tarball for Eglibc Linuxthreads ${SOURCEVERSION}...."
|
---|
178 | tar cjf ~/packages/eglibc-linuxthreads-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 linuxthreads
|
---|
179 | rm -rf linuxthreads
|
---|
180 | echo "Creating Tarball for Eglibc LocaleDef ${SOURCEVERSION}...."
|
---|
181 | tar cjf ~/packages/eglibc-localedef-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 localedef
|
---|
182 | rm -rf localedef
|
---|
183 | mv libc eglibc-${SOURCEVERSION}
|
---|
184 | echo "Creating Tarball for Eglibc ${SOURCEVERSION}...."
|
---|
185 | tar cjf ~/packages/eglibc-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 eglibc-${SOURCEVERSION}
|
---|
186 |
|
---|
187 | # Clean up Directores
|
---|
188 | #
|
---|
189 | cd ~/tmp
|
---|
190 | rm -rf eglibc-${SOURCEVERSION}
|
---|