1 | #!/bin/bash |
---|
2 | |
---|
3 | # cross-lfs target coreutils build |
---|
4 | # -------------------------------- |
---|
5 | # $LastChangedBy$ |
---|
6 | # $LastChangedDate$ |
---|
7 | # $LastChangedRevision$ |
---|
8 | # $HeadURL$ |
---|
9 | # |
---|
10 | |
---|
11 | cd ${SRC} |
---|
12 | LOG=coreutils-target.log |
---|
13 | |
---|
14 | unpack_tarball coreutils-${COREUTILS_VER} |
---|
15 | cd ${PKGDIR} |
---|
16 | |
---|
17 | set_libdirname |
---|
18 | setup_multiarch |
---|
19 | |
---|
20 | if [ "${USE_SYSROOT}" = "Y" ]; then |
---|
21 | BUILD_PREFIX=/usr |
---|
22 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}" |
---|
23 | INSTALL_OPTIONS="DESTDIR=${LFS}" |
---|
24 | else |
---|
25 | BUILD_PREFIX=${TGT_TOOLS} |
---|
26 | INSTALL_PREFIX="${TGT_TOOLS}" |
---|
27 | INSTALL_OPTIONS="" |
---|
28 | fi |
---|
29 | |
---|
30 | # If we don't want to conform to POSIX 200212L, override |
---|
31 | # NOTE: This is coreutils 5.0 specific, later versions will have |
---|
32 | # a configure/compile time option |
---|
33 | case ${COREUTILS_VER} in |
---|
34 | 5.1.7 | 5.[2-9]* ) ;; |
---|
35 | * ) mv lib/posixver.c lib/posixver.c-ORIG |
---|
36 | sed '/\/\* The POSIX version that utilities should conform to/i\ |
---|
37 | #undef _POSIX2_VERSION\ |
---|
38 | #define _POSIX2_VERSION 199209L\ |
---|
39 | ' lib/posixver.c-ORIG > lib/posixver.c |
---|
40 | ;; |
---|
41 | esac |
---|
42 | |
---|
43 | # Cannot check whether we have a working getline in glibc when |
---|
44 | # cross compiling. Say yes here as we will get failure on x86_64 |
---|
45 | # where getline is type _IO_ssize_t in stdio.h (long with x86_64) |
---|
46 | # and the provided getline in coreutils (well gnulib) is type int. |
---|
47 | echo "am_cv_func_working_getline=yes" >> config.cache |
---|
48 | |
---|
49 | # UTILS_OPEN_MAX does not get defined when cross-compiling as |
---|
50 | # it is an AC_RUN test used to determine roughly how many open |
---|
51 | # FD's a process can have. |
---|
52 | # We will set it to 1024 (NR_OPEN in /usr/include/linux/limits.h ) |
---|
53 | echo "utils_cv_sys_open_max=1024" >> config.cache |
---|
54 | |
---|
55 | # if target is same as build host, adjust build slightly to avoid running |
---|
56 | # configure checks which we cannot run |
---|
57 | if [ "${TARGET}" = "${BUILD}" ]; then |
---|
58 | BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'` |
---|
59 | fi |
---|
60 | |
---|
61 | max_log_init Coreutils ${COREUTILS_VER} "target (shared)" ${CONFLOGS} ${LOG} |
---|
62 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \ |
---|
63 | CFLAGS="-O2 -pipe ${TGT_CFLAGS}" DEFAULT_POSIX2_VERSION=199209 \ |
---|
64 | ./configure --prefix=${BUILD_PREFIX} \ |
---|
65 | --build=${BUILD} --host=${TARGET} --cache-file=config.cache \ |
---|
66 | >> ${LOGFILE} 2>&1 && |
---|
67 | echo " o Configure OK" && |
---|
68 | |
---|
69 | min_log_init ${BUILDLOGS} && |
---|
70 | make ${PMFLAGS} LDFLAGS="-s" \ |
---|
71 | >> ${LOGFILE} 2>&1 && |
---|
72 | echo " o Build OK" && |
---|
73 | |
---|
74 | min_log_init ${INSTLOGS} && |
---|
75 | echo Password: && |
---|
76 | su -c "make ${INSTALL_OPTIONS} install" \ |
---|
77 | >> ${LOGFILE} 2>&1 && |
---|
78 | echo " o ALL OK" || barf |
---|
79 | |
---|