|
Lines 21-30
fi
Link Here
|
| 21 |
|
21 |
|
| 22 |
MY_P=uClibc-${PV} |
22 |
MY_P=uClibc-${PV} |
| 23 |
SVN_VER="" |
23 |
SVN_VER="" |
| 24 |
PATCH_VER="1.7" |
24 |
PATCH_VER="" |
| 25 |
DESCRIPTION="C library for developing embedded Linux systems" |
25 |
DESCRIPTION="C library for developing embedded Linux systems" |
| 26 |
HOMEPAGE="http://www.uclibc.org/" |
26 |
HOMEPAGE="http://www.uclibc.org/" |
| 27 |
SRC_URI="http://www.kernel.org/pub/linux/libs/uclibc/${MY_P}.tar.bz2 |
27 |
SRC_URI="mirror://kernel/linux/libs/uclibc/${MY_P}.tar.bz2 |
|
|
28 |
http://uclibc.org/downloads/${MY_P}.tar.bz2 |
| 28 |
nls? ( !userlocales? ( pregen? ( |
29 |
nls? ( !userlocales? ( pregen? ( |
| 29 |
x86? ( http://www.uclibc.org/downloads/uClibc-locale-030818.tgz ) |
30 |
x86? ( http://www.uclibc.org/downloads/uClibc-locale-030818.tgz ) |
| 30 |
) ) )" |
31 |
) ) )" |
|
Lines 55-63
alt_build_kprefix() {
Link Here
|
| 55 |
if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] \ |
56 |
if [[ ${CBUILD} == ${CHOST} && ${CTARGET} == ${CHOST} ]] \ |
| 56 |
|| [[ -n ${UCLIBC_AND_GLIBC} ]] |
57 |
|| [[ -n ${UCLIBC_AND_GLIBC} ]] |
| 57 |
then |
58 |
then |
| 58 |
echo /usr |
59 |
echo /usr/include |
| 59 |
else |
60 |
else |
| 60 |
echo /usr/${CTARGET}/usr |
61 |
echo /usr/${CTARGET}/usr/include |
| 61 |
fi |
62 |
fi |
| 62 |
} |
63 |
} |
| 63 |
just_headers() { |
64 |
just_headers() { |
|
Lines 70-77
uclibc_endian() {
Link Here
|
| 70 |
touch "${T}"/endian.s |
71 |
touch "${T}"/endian.s |
| 71 |
$(tc-getAS) "${T}"/endian.s -o "${T}"/endian.o |
72 |
$(tc-getAS) "${T}"/endian.s -o "${T}"/endian.o |
| 72 |
case $(file "${T}"/endian.o) in |
73 |
case $(file "${T}"/endian.o) in |
| 73 |
*" MSB "*) echo "big";; |
74 |
*" MSB "*) echo "BIG";; |
| 74 |
*" LSB "*) echo "little";; |
75 |
*" LSB "*) echo "LITTLE";; |
| 75 |
*) echo "NFC";; |
76 |
*) echo "NFC";; |
| 76 |
esac |
77 |
esac |
| 77 |
rm -f "${T}"/endian.{s,o} |
78 |
rm -f "${T}"/endian.{s,o} |
|
Lines 140-145
check_cpu_opts() {
Link Here
|
| 140 |
fi |
141 |
fi |
| 141 |
} |
142 |
} |
| 142 |
|
143 |
|
|
|
144 |
set_opt() { |
| 145 |
sed -i "/^\# $1 is not set/d; /^$1=.*/d" .config |
| 146 |
echo "$1=$2" >> .config |
| 147 |
} |
| 148 |
|
| 143 |
src_unpack() { |
149 |
src_unpack() { |
| 144 |
[[ -n ${ESVN_REPO_URI} ]] \ |
150 |
[[ -n ${ESVN_REPO_URI} ]] \ |
| 145 |
&& subversion_src_unpack \ |
151 |
&& subversion_src_unpack \ |
|
Lines 173-178
src_unpack() {
Link Here
|
| 173 |
epatch "${WORKDIR}"/patch/math |
179 |
epatch "${WORKDIR}"/patch/math |
| 174 |
fi |
180 |
fi |
| 175 |
|
181 |
|
|
|
182 |
epatch "${FILESDIR}/${P}-inet_network.patch" |
| 183 |
epatch "${FILESDIR}/${P}-net-tools_compile.patch" |
| 184 |
|
| 176 |
########## CPU SELECTION ########## |
185 |
########## CPU SELECTION ########## |
| 177 |
|
186 |
|
| 178 |
local target config_target |
187 |
local target config_target |
|
Lines 189-237
src_unpack() {
Link Here
|
| 189 |
x86) target="i386"; config_target="GENERIC_386";; |
198 |
x86) target="i386"; config_target="GENERIC_386";; |
| 190 |
*) die "$(tc-arch) lists no defaults :/";; |
199 |
*) die "$(tc-arch) lists no defaults :/";; |
| 191 |
esac |
200 |
esac |
| 192 |
sed -i -e "s:default TARGET_i386:default TARGET_${target}:" \ |
|
|
| 193 |
extra/Configs/Config.in |
| 194 |
sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \ |
201 |
sed -i -e "s:default CONFIG_${config_target}:default CONFIG_${UCLIBC_CPU:-${config_target}}:" \ |
| 195 |
extra/Configs/Config.${target} |
202 |
extra/Configs/Config.${target} |
|
|
203 |
sed -i -e "s:^HOSTCC.*=.*:HOSTCC=$(tc-getBUILD_CC):" Rules.mak |
| 196 |
|
204 |
|
| 197 |
########## CONFIG SETUP ########## |
205 |
########## CONFIG SETUP ########## |
| 198 |
|
206 |
|
| 199 |
make defconfig >/dev/null || die "could not config" |
207 |
make ARCH=${target} defconfig >/dev/null || die "could not config" |
| 200 |
|
208 |
|
| 201 |
for def in DO{DEBUG{,_PT},ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} ; do |
209 |
for def in DO{DEBUG{,_PT},ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} ; do |
| 202 |
sed -i -e "s:${def}=y:# ${def} is not set:" .config |
210 |
sed -i -e "s:${def}=y:# ${def} is not set:" .config |
| 203 |
done |
211 |
done |
| 204 |
if use debug ; then |
212 |
if use debug ; then |
| 205 |
#echo "SUPPORT_LD_DEBUG_EARLY=y" >> .config |
213 |
set_opt SUPPORT_LD_DEBUG y |
| 206 |
echo "SUPPORT_LD_DEBUG=y" >> .config |
214 |
set_opt DODEBUG y |
| 207 |
echo "DODEBUG=y" >> .config |
|
|
| 208 |
#echo "DODEBUG_PT=y" >> .config |
| 209 |
fi |
215 |
fi |
| 210 |
|
216 |
|
| 211 |
sed -i -e '/ARCH_.*_ENDIAN/d' .config |
217 |
sed -i -e '/ARCH_.*_ENDIAN/d' .config |
| 212 |
echo "ARCH_$(uclibc_endian | tr [a-z] [A-Z])_ENDIAN=y" >> .config |
218 |
set_opt "ARCH_WANTS_$(uclibc_endian | tr [a-z] [A-Z])_ENDIAN" y |
| 213 |
|
219 |
|
| 214 |
if [[ $(tc-is-softfloat) != "no" ]] ; then |
220 |
if [[ $(tc-is-softfloat) != "no" ]] ; then |
| 215 |
sed -i -e '/^HAS_FPU=y$/d' .config |
221 |
set_opt HAS_FPU n |
| 216 |
echo 'HAS_FPU=n' >> .config |
|
|
| 217 |
fi |
222 |
fi |
| 218 |
|
223 |
|
| 219 |
local moredefs="DL_FINI_CRT_COMPAT" |
224 |
local moredefs="COMPAT_ATEXIT" |
| 220 |
# We need todo this for a few months. .28 is a major upgrade. |
225 |
local compat_sym=atexit |
|
|
226 |
|
| 227 |
# We need todo this for a few months. .29 is a major upgrade. |
| 221 |
# Don't do it from cross-compiling case though |
228 |
# Don't do it from cross-compiling case though |
| 222 |
if ! use uclibc-compat ; then |
229 |
if ! use uclibc-compat ; then |
| 223 |
if [[ -z ${UCLIBC_AND_GLIBC} ]] && [[ -z ${UCLIBC_SCANNED_COMPAT} ]] && \ |
230 |
if [[ -z ${UCLIBC_AND_GLIBC} ]] && [[ -z ${UCLIBC_SCANNED_COMPAT} ]] && \ |
| 224 |
! just_headers && [[ ${CHOST} == ${CTARGET} ]] ; then |
231 |
! just_headers && [[ ${CHOST} == ${CTARGET} ]] ; then |
| 225 |
local fnames="" |
232 |
local fnames="" |
| 226 |
einfo "Doing a scanelf in paths for bins containing the __uClibc_start_main symbol" |
233 |
einfo "Doing a scanelf in paths for bins containing the ${compat_sym} symbol" |
| 227 |
fnames=$(scanelf -pyqs__uClibc_start_main -F%F#s) |
234 |
fnames=$(scanelf -pyqs${compat_sym} -F%F#s) |
| 228 |
if [[ -z ${fnames} ]] ; then |
235 |
if [[ -z ${fnames} ]] ; then |
| 229 |
einfo "This system is clean." |
236 |
einfo "This system is clean." |
| 230 |
einfo "To prevent the scanning of files again in the future you can export UCLIBC_SCANNED_COMPAT=1" |
237 |
einfo "To prevent the scanning of files again in the future you can export UCLIBC_SCANNED_COMPAT=1" |
| 231 |
moredefs="" |
238 |
moredefs="" |
| 232 |
else |
239 |
else |
| 233 |
ewarn "You need to remerge the packages that contain the following files before you can remerge ${P} without USE=uclibc-compat enabled." |
240 |
ewarn "You need to remerge the packages that contain the following files before you can remerge ${P} without USE=uclibc-compat enabled." |
| 234 |
ewarn "qfile ${fnames}" |
241 |
ewarn "qfile -Cq $(echo ${fnames}) | sort | uniq" |
| 235 |
echo |
242 |
echo |
| 236 |
ewarn "Leaving on ${moredefs}" |
243 |
ewarn "Leaving on ${moredefs}" |
| 237 |
fi |
244 |
fi |
|
Lines 239-266
src_unpack() {
Link Here
|
| 239 |
moredefs="" |
246 |
moredefs="" |
| 240 |
fi |
247 |
fi |
| 241 |
fi |
248 |
fi |
| 242 |
for def in ${moredefs} MALLOC_GLIBC_COMPAT DO_C99_MATH UCLIBC_HAS_{RPC,CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC,FTW} ; do |
249 |
for def in ${moredefs} MALLOC_GLIBC_COMPAT DO_C99_MATH UCLIBC_HAS_{RPC,FULL_RPC,CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC,FTW} ; do |
| 243 |
sed -i -e "s:# ${def} is not set:${def}=y:" .config |
250 |
set_opt "${def}" y |
| 244 |
done |
251 |
done |
| 245 |
echo "UCLIBC_HAS_FULL_RPC=y" >> .config |
252 |
set_opt UCLIBC_HAS_CTYPE_UNSAFE n |
| 246 |
echo "PTHREADS_DEBUG_SUPPORT=y" >> .config |
253 |
set_opt UCLIBC_HAS_REENTRANT_RPC n |
| 247 |
echo "UCLIBC_HAS_TZ_FILE_READ_MANY=n" >> .config |
254 |
set_opt PTHREADS_DEBUG_SUPPORT y |
|
|
255 |
set_opt UCLIBC_HAS_TZ_FILE_READ_MANY n |
| 256 |
set_opt UCLIBC_SUSV3_LEGACY y |
| 257 |
set_opt UCLIBC_SUSV3_LEGACY_MACROS y |
| 248 |
|
258 |
|
| 249 |
if use iconv ; then |
259 |
if use iconv ; then |
| 250 |
sed -i -e "s:# UCLIBC_HAS_LOCALE is not set:UCLIBC_HAS_LOCALE=y:" .config |
260 |
set_opt UCLIBC_HAS_LOCALE y |
| 251 |
echo "UCLIBC_HAS_XLOCALE=n" >> .config |
261 |
set_opt UCLIBC_HAS_XLOCALE n |
| 252 |
echo "UCLIBC_HAS_GLIBC_DIGIT_GROUPING=y" >> .config |
262 |
set_opt UCLIBC_HAS_GLIBC_DIGIT_GROUPING y |
| 253 |
echo "UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING=y" >> .config |
263 |
set_opt UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING y |
| 254 |
|
264 |
|
| 255 |
if use nls ; then |
265 |
if use nls ; then |
| 256 |
echo "UCLIBC_HAS_GETTEXT_AWARENESS=y" >> .config |
266 |
set_opt UCLIBC_HAS_GETTEXT_AWARENESS y |
| 257 |
else |
267 |
else |
| 258 |
echo "UCLIBC_HAS_GETTEXT_AWARENESS=n" >> .config |
268 |
set_opt UCLIBC_HAS_GETTEXT_AWARENESS n |
| 259 |
fi |
269 |
fi |
| 260 |
|
270 |
|
| 261 |
if use pregen ; then |
271 |
if use pregen ; then |
| 262 |
echo "UCLIBC_PREGENERATED_LOCALE_DATA=y" >> .config |
272 |
set_opt UCLIBC_PREGENERATED_LOCALE_DATA y |
| 263 |
echo "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA=y" >> .config |
273 |
set_opt UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA y |
| 264 |
if use userlocales ; then |
274 |
if use userlocales ; then |
| 265 |
cp "${DISTDIR}"/${MY_P}-user-locale.tar.gz \ |
275 |
cp "${DISTDIR}"/${MY_P}-user-locale.tar.gz \ |
| 266 |
extra/locale/uClibc-locale-030818.tgz \ |
276 |
extra/locale/uClibc-locale-030818.tgz \ |
|
Lines 271-324
src_unpack() {
Link Here
|
| 271 |
|| die "could not copy locale" |
281 |
|| die "could not copy locale" |
| 272 |
fi |
282 |
fi |
| 273 |
else |
283 |
else |
| 274 |
echo "UCLIBC_PREGENERATED_LOCALE_DATA=n" >> .config |
284 |
set_opt UCLIBC_PREGENERATED_LOCALE_DATA n |
| 275 |
fi |
285 |
fi |
| 276 |
else |
286 |
else |
| 277 |
echo "UCLIBC_HAS_LOCALE=n" >> .config |
287 |
set_opt UCLIBC_HAS_LOCALE n |
| 278 |
fi |
288 |
fi |
| 279 |
|
289 |
|
| 280 |
use ipv6 && sed -i -e "s:# UCLIBC_HAS_IPV6 is not set:UCLIBC_HAS_IPV6=y:" .config |
290 |
use ipv6 && set_opt UCLIBC_HAS_IPV6 y |
| 281 |
|
291 |
|
| 282 |
# uncomment if you miss wordexp (alsa-lib) |
292 |
use wordexp && set_opt UCLIBC_HAS_WORDEXP y |
| 283 |
use wordexp && sed -i -e "s:# UCLIBC_HAS_WORDEXP is not set:UCLIBC_HAS_WORDEXP=y:" .config |
|
|
| 284 |
|
293 |
|
| 285 |
# we need to do it independently of hardened to get ssp.c built into libc |
294 |
# we need to do it independently of hardened to get ssp.c built into libc |
| 286 |
sed -i -e "s:# UCLIBC_SECURITY.*:UCLIBC_SECURITY=y:" .config |
295 |
|
| 287 |
echo "UCLIBC_HAS_SSP=y" >> .config |
296 |
set_opt UCLIBC_HAS_SSP y |
| 288 |
echo "SSP_USE_ERANDOM=n" >> .config |
297 |
set_opt UCLIBC_HAS_SSP_COMPAT y |
| 289 |
echo "PROPOLICE_BLOCK_ABRT=n" >> .config |
298 |
set_opt UCLIBC_HAS_ARC4RANDOM y |
| 290 |
if use debug ; then |
299 |
set_opt PROPOLICE_BLOCK_ABRT n |
| 291 |
echo "PROPOLICE_BLOCK_SEGV=y" >> .config |
300 |
set_opt PROPOLICE_BLOCK_SEGV y |
| 292 |
echo "PROPOLICE_BLOCK_KILL=n" >> .config |
|
|
| 293 |
else |
| 294 |
echo "PROPOLICE_BLOCK_SEGV=n" >> .config |
| 295 |
echo "PROPOLICE_BLOCK_KILL=y" >> .config |
| 296 |
fi |
| 297 |
|
301 |
|
| 298 |
# arm/mips do not emit PT_GNU_STACK, but if we enable this here |
302 |
# arm/mips do not emit PT_GNU_STACK, but if we enable this here |
| 299 |
# it will be emitted as RWE, ppc has to be checked, x86 needs it |
303 |
# it will be emitted as RWE, ppc has to be checked, x86 needs it |
| 300 |
# this option should be used independently of hardened |
304 |
# this option should be used independently of hardened |
| 301 |
# relro could be also moved out of hardened |
305 |
# relro could be also moved out of hardened |
| 302 |
if has $(tc-arch) x86 ; then |
306 |
if has $(tc-arch) x86 ; then |
| 303 |
echo "UCLIBC_BUILD_NOEXECSTACK=y" >> .config |
307 |
set_opt UCLIBC_BUILD_NOEXECSTACK y |
| 304 |
else |
308 |
else |
| 305 |
echo "UCLIBC_BUILD_NOEXECSTACK=n" >> .config |
309 |
set_opt UCLIBC_BUILD_NOEXECSTACK n |
| 306 |
fi |
310 |
fi |
| 307 |
echo "UCLIBC_BUILD_RELRO=y" >> .config |
311 |
set_opt UCLIBC_BUILD_RELRO y |
| 308 |
if use hardened ; then |
312 |
if use hardened ; then |
| 309 |
if has $(tc-arch) ${PIE_STABLE} ; then |
313 |
if has $(tc-arch) ${PIE_STABLE} ; then |
| 310 |
echo "UCLIBC_BUILD_PIE=y" >> .config |
314 |
set_opt UCLIBC_BUILD_PIE y |
| 311 |
else |
315 |
else |
| 312 |
echo "UCLIBC_BUILD_PIE=n" >> .config |
316 |
set_opt UCLIBC_BUILD_PIE n |
| 313 |
fi |
317 |
fi |
| 314 |
echo "SSP_QUICK_CANARY=n" >> .config |
318 |
set_opt SSP_QUICK_CANARY n |
| 315 |
echo "UCLIBC_BUILD_SSP=y" >> .config |
319 |
set_opt UCLIBC_BUILD_SSP y |
| 316 |
echo "UCLIBC_BUILD_NOW=y" >> .config |
320 |
set_opt UCLIBC_BUILD_NOW y |
| 317 |
else |
321 |
else |
| 318 |
echo "UCLIBC_BUILD_PIE=n" >> .config |
322 |
set_opt UCLIBC_BUILD_PIE n |
| 319 |
echo "SSP_QUICK_CANARY=y" >> .config |
323 |
set_opt SSP_QUICK_CANARY y |
| 320 |
echo "UCLIBC_BUILD_SSP=n" >> .config |
324 |
set_opt UCLIBC_BUILD_SSP n |
| 321 |
echo "UCLIBC_BUILD_NOW=n" >> .config |
325 |
set_opt UCLIBC_BUILD_NOW n |
| 322 |
fi |
326 |
fi |
| 323 |
|
327 |
|
| 324 |
# Allow users some custom control over the config |
328 |
# Allow users some custom control over the config |
|
Lines 341-347
src_unpack() {
Link Here
|
| 341 |
type -p ${cross}ar > /dev/null || cross="" |
345 |
type -p ${cross}ar > /dev/null || cross="" |
| 342 |
sed -i \ |
346 |
sed -i \ |
| 343 |
-e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${cross}\":" \ |
347 |
-e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${cross}\":" \ |
| 344 |
-e "/^KERNEL_SOURCE/s:=.*:=\"$(alt_build_kprefix)\":" \ |
348 |
-e "/^KERNEL_HEADERS/s:=.*:=\"$(alt_build_kprefix)\":" \ |
| 345 |
-e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \ |
349 |
-e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/$(get_libdir)\":" \ |
| 346 |
-e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \ |
350 |
-e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" \ |
| 347 |
-e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \ |
351 |
-e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" \ |
|
Lines 390-398
src_compile() {
Link Here
|
| 390 |
fi |
394 |
fi |
| 391 |
|
395 |
|
| 392 |
emake || die "make failed" |
396 |
emake || die "make failed" |
| 393 |
[[ ${CTARGET} != ${CHOST} ]] && return 0 |
397 |
if [[ ${CTARGET} != ${CHOST} ]] ; then |
| 394 |
|
398 |
emake -C utils hostutils || die "make hostutils failed" |
| 395 |
if [[ ${CHOST} == *-uclibc ]] ; then |
399 |
elif [[ ${CHOST} == *-uclibc ]] ; then |
| 396 |
emake utils || die "make utils failed" |
400 |
emake utils || die "make utils failed" |
| 397 |
fi |
401 |
fi |
| 398 |
} |
402 |
} |
|
Lines 412-418
src_install() {
Link Here
|
| 412 |
|
416 |
|
| 413 |
local target="install" |
417 |
local target="install" |
| 414 |
just_headers && target="install_dev" |
418 |
just_headers && target="install_dev" |
| 415 |
make DESTDIR="${sysroot}" ${target} || die "install failed" |
419 |
emake DESTDIR="${sysroot}" ${target} || die "install failed" |
| 416 |
|
420 |
|
| 417 |
# remove files coming from kernel-headers |
421 |
# remove files coming from kernel-headers |
| 418 |
rm -rf "${sysroot}"/usr/include/{linux,asm*} |
422 |
rm -rf "${sysroot}"/usr/include/{linux,asm*} |
|
Lines 422-427
src_install() {
Link Here
|
| 422 |
# system headers correctly. See gcc/doc/gccinstall.info |
426 |
# system headers correctly. See gcc/doc/gccinstall.info |
| 423 |
if [[ ${CTARGET} != ${CHOST} ]] ; then |
427 |
if [[ ${CTARGET} != ${CHOST} ]] ; then |
| 424 |
dosym usr/include /usr/${CTARGET}/sys-include |
428 |
dosym usr/include /usr/${CTARGET}/sys-include |
|
|
429 |
newbin utils/ldconfig.host ${CTARGET}-ldconfig || die |
| 430 |
newbin utils/ldd.host ${CTARGET}-ldd || die |
| 425 |
return 0 |
431 |
return 0 |
| 426 |
fi |
432 |
fi |
| 427 |
|
433 |
|