28 |
SRCFILE="${PNAME}-${PVER/.0/}.tar.bz2" |
SRCFILE="${PNAME}-${PVER/.0/}.tar.bz2" |
29 |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER/.0/}/libc" |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER/.0/}/libc" |
30 |
|
|
31 |
sminclude mtools |
sminclude mtools cleanutils |
32 |
|
|
33 |
SRC_URI=( |
SRC_URI=( |
34 |
gnu://${PNAME}/${SRCFILE} |
gnu://${PNAME}/${SRCFILE} |
75 |
# kernel support |
# kernel support |
76 |
export ENABLE_KERNEL=2.6.18 |
export ENABLE_KERNEL=2.6.18 |
77 |
|
|
78 |
#SPLIT_PACKAGES="eglibc eglibc-dev" |
SPLIT_PACKAGES="eglibc eglibc-dev" |
79 |
|
|
80 |
split_info_eglibc() |
split_info_eglibc() |
81 |
{ |
{ |
85 |
>= virtual/base-files" |
>= virtual/base-files" |
86 |
|
|
87 |
PROVIDE="virtual/glibc" |
PROVIDE="virtual/glibc" |
88 |
|
|
89 |
|
preinstall() |
90 |
|
{ |
91 |
|
# remove libmemusage and libpcprofile as these libs now |
92 |
|
# resides in /usr/lib and are symlinked to /lib |
93 |
|
if [[ -f ${MROOT}/$(mlibdir)/libmemusage.so ]] |
94 |
|
then |
95 |
|
rm ${MROOT}/$(mlibdir)/libmemusage.so |
96 |
|
fi |
97 |
|
|
98 |
|
if [[ -f ${MROOT}/$(mlibdir)/libpcprofile.so ]] |
99 |
|
then |
100 |
|
rm ${MROOT}/$(mlibdir)/libpcprofile.so |
101 |
|
fi |
102 |
|
} |
103 |
|
|
104 |
|
postinstall() |
105 |
|
{ |
106 |
|
# first save the old libpthread.so.0; |
107 |
|
# it will later used to determinate that there are no stale |
108 |
|
# libpthreads that breaks ldconfig |
109 |
|
local OLD_PTHREAD |
110 |
|
OLD_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)" |
111 |
|
|
112 |
|
# slackware install method |
113 |
|
|
114 |
|
# we cannot easily install the glibc libs, |
115 |
|
# because our tools for cp etc needs them to run |
116 |
|
|
117 |
|
local file |
118 |
|
|
119 |
|
echo " Switching to new glibc ..." |
120 |
|
# swap libraries on the fly: |
121 |
|
if [ -x /sbin/ldconfig -a -d /$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
122 |
|
then |
123 |
|
# first create copies of the incoming libraries: |
124 |
|
cd /$(mlibdir)/incoming |
125 |
|
for file in $(find /$(mlibdir)/incoming -type f) |
126 |
|
do |
127 |
|
if [ ! -r "../$(basename ${file}).incoming" ] |
128 |
|
then |
129 |
|
cp -a ${file} ../$(basename ${file}).incoming |
130 |
|
fi |
131 |
|
done |
132 |
|
|
133 |
|
# then switch to them all at once: |
134 |
|
/sbin/ldconfig -l /$(mlibdir)/*.incoming 2> /dev/null |
135 |
|
|
136 |
|
# finally, rename them and clean up: |
137 |
|
cd /$(mlibdir) |
138 |
|
for file in *.incoming |
139 |
|
do |
140 |
|
rm -f $(basename ${file} .incoming) |
141 |
|
cp -a ${file} $(basename ${file} .incoming) |
142 |
|
/sbin/ldconfig -l $(basename ${file} .incoming) |
143 |
|
rm -f ${file} |
144 |
|
done |
145 |
|
|
146 |
|
# no ldconfig? |
147 |
|
# good, it's safe to just jam it on home (and make links below): |
148 |
|
else |
149 |
|
( |
150 |
|
cd ${MROOT}/$(mlibdir)/incoming |
151 |
|
for file in * |
152 |
|
do |
153 |
|
cp -a ${file} .. |
154 |
|
done |
155 |
|
|
156 |
|
local my_sym |
157 |
|
local my_dest |
158 |
|
|
159 |
|
# rebuild symlinks |
160 |
|
echo " Recreating Symlinks:" |
161 |
|
for i in $(find ${MROOT}/$(mlibdir)/incoming -type l) |
162 |
|
do |
163 |
|
my_sym="$(readlink ${i})" |
164 |
|
my_dest="$(basename ${i})" |
165 |
|
|
166 |
|
echo " ${my_dest} -> ${my_dest}" |
167 |
|
|
168 |
|
# assure to remove the old ones; |
169 |
|
[ -L ${MROOT}/$(mlibdir)/"${my_dest}" ] && \ |
170 |
|
rm ${MROOT}/$(mlibdir)/"${my_dest}" |
171 |
|
|
172 |
|
ln -snf "${my_sym}" ${MROOT}/$(mlibdir)/"${my_dest}" |
173 |
|
done |
174 |
|
) |
175 |
|
fi |
176 |
|
|
177 |
|
# now, get rid of the temporary directory: |
178 |
|
rm -rf ${MROOT}/$(mlibdir)/incoming |
179 |
|
|
180 |
|
# remove stale nptl libpthread-2.?.?.so, |
181 |
|
# fix only needed for glibc with linuxthreads; |
182 |
|
# prevent reloc errors such as: |
183 |
|
# ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
184 |
|
|
185 |
|
# get our new libpthread.so.0 |
186 |
|
local NEW_PTHREAD |
187 |
|
NEW_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)" |
188 |
|
|
189 |
|
if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
190 |
|
then |
191 |
|
echo " Removing stale libpthread libraries ..." |
192 |
|
for file in ${MROOT}/$(mlibdir)/libpthread-* |
193 |
|
do |
194 |
|
if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
195 |
|
then |
196 |
|
rm -f ${file} |
197 |
|
fi |
198 |
|
done |
199 |
|
|
200 |
|
#rm -f /lib/${OLD_PTHREAD} |
201 |
|
|
202 |
|
ln -snf ${NEW_PTHREAD} ${MROOT}/$(mlibdir)/libpthread.so.0 |
203 |
|
fi |
204 |
|
|
205 |
|
if [ -x /usr/sbin/iconvconfig ] |
206 |
|
then |
207 |
|
# generate fastloading iconv module configuration file. |
208 |
|
echo " Generate iconv module config ..." |
209 |
|
/usr/sbin/iconvconfig --prefix=${MROOT}/ |
210 |
|
fi |
211 |
|
|
212 |
|
# not working with busybox |
213 |
|
if [[ $(basename $(readlink /sbin/init)) != busybox ]] |
214 |
|
then |
215 |
|
# reloading init |
216 |
|
echo " Reloading init ..." |
217 |
|
[[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
218 |
|
fi |
219 |
|
|
220 |
|
if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]] |
221 |
|
then |
222 |
|
# generating user def locales |
223 |
|
echo " Generating user defined locales ..." |
224 |
|
/usr/sbin/locale-gen |
225 |
|
fi |
226 |
|
|
227 |
|
# now we must fix the mage db files |
228 |
|
# to stop the annoying errors messages |
229 |
|
fix_db_files |
230 |
|
} |
231 |
|
|
232 |
} |
} |
233 |
|
|
234 |
split_info_eglibc-dev() |
split_info_eglibc-dev() |
235 |
{ |
{ |
236 |
DESCRIPTION="Development files for ${PCATEGORE}/${PNAME}-${PVER}-${PBUILD}." |
DESCRIPTION="Development files for ${PCATEGORE}/${PNAME}-${PVER}-${PBUILD}." |
237 |
SDEPEND=">= ${PCATEGORIE}/${PNAME}-${PVER}" |
SDEPEND=">= ${PCATEGORIE}/${PNAME}-${PVER}" |
238 |
|
|
239 |
|
postinstall() |
240 |
|
{ |
241 |
|
|
242 |
|
if [ -x /usr/sbin/iconvconfig ] |
243 |
|
then |
244 |
|
# generate fastloading iconv module configuration file. |
245 |
|
echo " Generate iconv module config ..." |
246 |
|
/usr/sbin/iconvconfig --prefix=${MROOT}/ |
247 |
|
fi |
248 |
|
|
249 |
|
# not working with busybox |
250 |
|
if [[ $(basename $(readlink /sbin/init)) != busybox ]] |
251 |
|
then |
252 |
|
# reloading init |
253 |
|
echo " Reloading init ..." |
254 |
|
[[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
255 |
|
fi |
256 |
|
|
257 |
|
if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]] |
258 |
|
then |
259 |
|
# generating user def locales |
260 |
|
echo " Generating user defined locales ..." |
261 |
|
/usr/sbin/locale-gen |
262 |
|
fi |
263 |
|
} |
264 |
} |
} |
265 |
|
|
266 |
src_prepare() |
src_prepare() |
369 |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
make PARALLELMFLAGS="${MAKEOPTS}" || die |
370 |
} |
} |
371 |
|
|
372 |
src_install() |
src_install_eglibc() |
373 |
{ |
{ |
374 |
if [[ ${ARCH} = x86_64 ]] |
if [[ ${ARCH} = x86_64 ]] |
375 |
then |
then |
381 |
cd ${SRCDIR}/build |
cd ${SRCDIR}/build |
382 |
make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
383 |
|
|
384 |
# do not generate the locales here, let it the user do with the locale-gen tool |
# cleanup |
385 |
# make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
zapmost ${BINDIR} $(mlibdir) usr/$(mlibdir)/*.so $([[ ${ARCH} = x86_64 ]] && echo 'lib usr/lib/*.so') sbin/ldconfig || die |
|
|
|
|
# install locales list and generate tools |
|
|
# to generate this listing see the glibc-2.5/localedata/SUPPORTED file |
|
|
minstalletc locale.gen || die |
|
|
minstalldir /usr/sbin || die |
|
|
minstallexec -s locale-gen /usr/sbin || die |
|
|
|
|
|
# nsswitch configuration file |
|
|
minstalletc nsswitch.conf || die |
|
|
|
|
|
# nscd configuration file |
|
|
minstalletc nscd.conf || die |
|
|
|
|
|
# we use Berlin as default |
|
|
cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
|
|
[ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
|
|
[ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
|
386 |
|
|
387 |
# base environment |
# base environment |
388 |
minstallenv eglibc.envd 00eglibc || die |
minstallenv eglibc.envd 00eglibc || die |
407 |
# strip all but libpthread |
# strip all but libpthread |
408 |
install -d ${BUILDDIR}/thread-backup || die |
install -d ${BUILDDIR}/thread-backup || die |
409 |
mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die |
mv ${BINDIR}/$(mlibdir)/lib{pthread,thread_db}* ${BUILDDIR}/thread-backup/ || die |
|
|
|
410 |
# now strip |
# now strip |
411 |
find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
412 |
mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die |
mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/$(mlibdir)/ || die |
420 |
mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die |
mv ${BINDIR}/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/$(mlibdir) || die |
421 |
} |
} |
422 |
|
|
423 |
|
src_install_eglibc-dev() |
424 |
|
{ |
425 |
|
if [[ ${ARCH} = x86_64 ]] |
426 |
|
then |
427 |
|
# install -m32 libs |
428 |
|
cd ${SRCDIR}/build-m32 |
429 |
|
make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
430 |
|
fi |
431 |
|
|
432 |
|
cd ${SRCDIR}/build |
433 |
|
make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
434 |
|
|
435 |
|
# cleanup -> in eglibc |
436 |
|
rm -r ${BINDIR}/$(mlibdir) || die |
437 |
|
rm ${BINDIR}/usr/$(mlibdir)/*.so || die |
438 |
|
if [[ ${ARCH} = x86_64 ]] |
439 |
|
then |
440 |
|
rm -r ${BINDIR}/$(mlibdir) || die |
441 |
|
rm ${BINDIR}/usr/$(mlibdir)/*.so || die |
442 |
|
fi |
443 |
|
rm ${BINDIR}/sbin/ldconfig || die |
444 |
|
|
445 |
|
# do not generate the locales here, let it the user do with the locale-gen tool |
446 |
|
# make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
447 |
|
|
448 |
|
# install locales list and generate tools |
449 |
|
# to generate this listing see the glibc-2.5/localedata/SUPPORTED file |
450 |
|
minstalletc locale.gen || die |
451 |
|
minstalldir /usr/sbin || die |
452 |
|
minstallexec -s locale-gen /usr/sbin || die |
453 |
|
|
454 |
|
# nsswitch configuration file |
455 |
|
minstalletc nsswitch.conf || die |
456 |
|
|
457 |
|
# nscd configuration file |
458 |
|
minstalletc nscd.conf || die |
459 |
|
|
460 |
|
# we use Berlin as default |
461 |
|
cp --remove-destination ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
462 |
|
[ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
463 |
|
[ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
464 |
|
|
465 |
|
# strip all binaries |
466 |
|
find ${BINDIR} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
467 |
|
|
468 |
|
# strip all libraries |
469 |
|
find ${BINDIR} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded || die |
470 |
|
} |
471 |
|
|
472 |
fix_db_files() |
fix_db_files() |
473 |
{ |
{ |
474 |
local i |
local i |
489 |
-e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
-e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
490 |
done |
done |
491 |
} |
} |
|
|
|
|
preinstall() |
|
|
{ |
|
|
# remove libmemusage and libpcprofile as these libs now |
|
|
# resides in /usr/lib and are symlinked to /lib |
|
|
if [[ -f ${MROOT}/$(mlibdir)/libmemusage.so ]] |
|
|
then |
|
|
rm ${MROOT}/$(mlibdir)/libmemusage.so |
|
|
fi |
|
|
|
|
|
if [[ -f ${MROOT}/$(mlibdir)/libpcprofile.so ]] |
|
|
then |
|
|
rm ${MROOT}/$(mlibdir)/libpcprofile.so |
|
|
fi |
|
|
} |
|
|
|
|
|
postinstall() |
|
|
{ |
|
|
# first save the old libpthread.so.0; |
|
|
# it will later used to determinate that there are no stale |
|
|
# libpthreads that breaks ldconfig |
|
|
local OLD_PTHREAD |
|
|
OLD_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)" |
|
|
|
|
|
# slackware install method |
|
|
|
|
|
# we cannot easily install the glibc libs, |
|
|
# because our tools for cp etc needs them to run |
|
|
|
|
|
local file |
|
|
|
|
|
echo " Switching to new glibc ..." |
|
|
# swap libraries on the fly: |
|
|
if [ -x /sbin/ldconfig -a -d /$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
|
|
then |
|
|
# first create copies of the incoming libraries: |
|
|
cd /$(mlibdir)/incoming |
|
|
for file in $(find /$(mlibdir)/incoming -type f) |
|
|
do |
|
|
if [ ! -r "../$(basename ${file}).incoming" ] |
|
|
then |
|
|
cp -a ${file} ../$(basename ${file}).incoming |
|
|
fi |
|
|
done |
|
|
|
|
|
# then switch to them all at once: |
|
|
/sbin/ldconfig -l /$(mlibdir)/*.incoming 2> /dev/null |
|
|
|
|
|
# finally, rename them and clean up: |
|
|
cd /$(mlibdir) |
|
|
for file in *.incoming |
|
|
do |
|
|
rm -f $(basename ${file} .incoming) |
|
|
cp -a ${file} $(basename ${file} .incoming) |
|
|
/sbin/ldconfig -l $(basename ${file} .incoming) |
|
|
rm -f ${file} |
|
|
done |
|
|
|
|
|
# no ldconfig? |
|
|
# good, it's safe to just jam it on home (and make links below): |
|
|
else |
|
|
( |
|
|
cd ${MROOT}/$(mlibdir)/incoming |
|
|
for file in * |
|
|
do |
|
|
cp -a ${file} .. |
|
|
done |
|
|
|
|
|
local my_sym |
|
|
local my_dest |
|
|
|
|
|
# rebuild symlinks |
|
|
echo " Recreating Symlinks:" |
|
|
for i in $(find ${MROOT}/$(mlibdir)/incoming -type l) |
|
|
do |
|
|
my_sym="$(readlink ${i})" |
|
|
my_dest="$(basename ${i})" |
|
|
|
|
|
echo " ${my_dest} -> ${my_dest}" |
|
|
|
|
|
# assure to remove the old ones; |
|
|
[ -L ${MROOT}/$(mlibdir)/"${my_dest}" ] && \ |
|
|
rm ${MROOT}/$(mlibdir)/"${my_dest}" |
|
|
|
|
|
ln -snf "${my_sym}" ${MROOT}/$(mlibdir)/"${my_dest}" |
|
|
done |
|
|
) |
|
|
fi |
|
|
|
|
|
# now, get rid of the temporary directory: |
|
|
rm -rf ${MROOT}/$(mlibdir)/incoming |
|
|
|
|
|
# remove stale nptl libpthread-2.?.?.so, |
|
|
# fix only needed for glibc with linuxthreads; |
|
|
# prevent reloc errors such as: |
|
|
# ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
|
|
|
|
|
# get our new libpthread.so.0 |
|
|
local NEW_PTHREAD |
|
|
NEW_PTHREAD="$(readlink ${MROOT}/$(mlibdir)/libpthread.so.0)" |
|
|
|
|
|
if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
|
|
then |
|
|
echo " Removing stale libpthread libraries ..." |
|
|
for file in ${MROOT}/$(mlibdir)/libpthread-* |
|
|
do |
|
|
if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
|
|
then |
|
|
rm -f ${file} |
|
|
fi |
|
|
done |
|
|
|
|
|
#rm -f /lib/${OLD_PTHREAD} |
|
|
|
|
|
ln -snf ${NEW_PTHREAD} ${MROOT}/$(mlibdir)/libpthread.so.0 |
|
|
fi |
|
|
|
|
|
if [ -x /usr/sbin/iconvconfig ] |
|
|
then |
|
|
# generate fastloading iconv module configuration file. |
|
|
echo " Generate iconv module config ..." |
|
|
/usr/sbin/iconvconfig --prefix=${MROOT}/ |
|
|
fi |
|
|
|
|
|
# not working with busybox |
|
|
if [[ $(basename $(readlink /sbin/init)) != busybox ]] |
|
|
then |
|
|
# reloading init |
|
|
echo " Reloading init ..." |
|
|
[[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
|
|
fi |
|
|
|
|
|
if [[ -x /usr/sbin/locale-gen ]] && [[ -z ${MROOT} ]] |
|
|
then |
|
|
# generating user def locales |
|
|
echo " Generating user defined locales ..." |
|
|
/usr/sbin/locale-gen |
|
|
fi |
|
|
|
|
|
# now we must fix the mage db files |
|
|
# to stop the annoying errors messages |
|
|
fix_db_files |
|
|
} |
|