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/cross-lfs/trunk/patches/ --no-remove-listing
|
---|
39 | PATCH_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)
|
---|
40 | PATCH_NUM=$(expr ${PATCH_NUM} + 1)
|
---|
41 | rm -f index.html
|
---|
42 |
|
---|
43 | # Customize the version string, so we know it's patched
|
---|
44 | #
|
---|
45 | install -d ~/tmp/eglibc-${SOURCEVERSION}
|
---|
46 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
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
|
---|
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
|
---|
51 | sed -i "s@Compiled by GNU CC version@Revision # \"DL_REVISION\".\\\\n\\\\\\nCompiled by GNU CC version@" libc/csu/version.c
|
---|
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
|
---|
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
|
---|
54 |
|
---|
55 | # Remove Files not needed
|
---|
56 | #
|
---|
57 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
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 | #
|
---|
68 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
69 | echo "Updating Glibc configure files..."
|
---|
70 | find . -name configure -exec touch {} \;
|
---|
71 |
|
---|
72 | # Create a copy of the Original Directory So We can do some Updates
|
---|
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 |
|
---|
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 |
|
---|
135 | # Create Patch
|
---|
136 | #
|
---|
137 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
138 | install -d ~/patches/
|
---|
139 | echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
140 | echo "Date: `date +%m-%d-%Y`" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
141 | echo "Initial Package Version: ${SOURCEVERSION}" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
142 | echo "Origin: Upstream" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
143 | echo "Upstream Status: Applied" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
144 | echo "Description: These are fixes eglibc-${SOURCEVERSION}, and should be" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
145 | echo " rechecked periodically." >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
146 | echo "" >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
147 | diff -Naur libc.orig libc >> ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch
|
---|
148 | echo "Created ~/patches/eglibc-${SOURCEVERSION}-fixes-${PATCH_NUM}.patch."
|
---|
149 |
|
---|
150 | # Remove Patched Copy
|
---|
151 | #
|
---|
152 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
153 | rm -rf libc
|
---|
154 | mv libc.orig libc
|
---|
155 |
|
---|
156 | # Compress
|
---|
157 | #
|
---|
158 | cd ~/tmp/eglibc-${SOURCEVERSION}
|
---|
159 | install -d ~/packages
|
---|
160 | echo "Creating Tarball for Eglibc Ports ${SOURCEVERSION}...."
|
---|
161 | tar cjf ~/packages/eglibc-ports-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 ports
|
---|
162 | rm -rf ports
|
---|
163 | echo "Creating Tarball for Eglibc Linuxthreads ${SOURCEVERSION}...."
|
---|
164 | tar cjf ~/packages/eglibc-linuxthreads-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 linuxthreads
|
---|
165 | rm -rf linuxthreads
|
---|
166 | echo "Creating Tarball for Eglibc LocaleDef ${SOURCEVERSION}...."
|
---|
167 | tar cjf ~/packages/eglibc-localedef-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 localedef
|
---|
168 | rm -rf localedef
|
---|
169 | mv libc eglibc-${SOURCEVERSION}
|
---|
170 | echo "Creating Tarball for Eglibc ${SOURCEVERSION}...."
|
---|
171 | tar cjf ~/packages/eglibc-${SOURCEVERSION}-${DL_DATE}-r${DL_REVISION}.tar.bz2 eglibc-${SOURCEVERSION}
|
---|
172 |
|
---|
173 | # Clean up Directores
|
---|
174 | #
|
---|
175 | cd ~/tmp
|
---|
176 | rm -rf eglibc-${SOURCEVERSION}
|
---|