1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs native coreutils build
|
---|
4 | # --------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | #export COREUTILS_VER=5.2.1
|
---|
12 |
|
---|
13 | cd ${SRC}
|
---|
14 | LOG=coreutils-native.log
|
---|
15 |
|
---|
16 | set_libdirname
|
---|
17 | setup_multiarch
|
---|
18 |
|
---|
19 | unpack_tarball coreutils-${COREUTILS_VER}
|
---|
20 | cd ${PKGDIR}
|
---|
21 |
|
---|
22 | # If we don't want to conform to POSIX 200212L, override
|
---|
23 | # NOTE: This is coreutils 5.0 specific, later versions will have
|
---|
24 | # a configure/compile time option
|
---|
25 | case ${COREUTILS_VER} in
|
---|
26 | 5.1.7 | 5.[2-9]* ) ;;
|
---|
27 | * ) mv lib/posixver.c lib/posixver.c-ORIG
|
---|
28 | sed '/\/\* The POSIX version that utilities should conform to/i\
|
---|
29 | #undef _POSIX2_VERSION\
|
---|
30 | #define _POSIX2_VERSION 199209L\
|
---|
31 | ' lib/posixver.c-ORIG > lib/posixver.c
|
---|
32 | ;;
|
---|
33 | esac
|
---|
34 |
|
---|
35 | max_log_init Coreutils ${COREUTILS_VER} "native (shared)" ${CONFLOGS} ${LOG}
|
---|
36 | #env CFLAGS="-O2 -pipe ${TGT_CFLAGS}" ${extra_env} \
|
---|
37 | CC="${CC-gcc} ${ARCH_CFLAGS}" \
|
---|
38 | CFLAGS="-O2 -pipe ${TGT_CFLAGS}" DEFAULT_POSIX2_VERSION=199209 \
|
---|
39 | ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info \
|
---|
40 | >> ${LOGFILE} 2>&1 &&
|
---|
41 | echo " o Configure OK" || barf
|
---|
42 |
|
---|
43 | min_log_init ${BUILDLOGS} &&
|
---|
44 | make ${PMFLAGS} LDFLAGS="-s" \
|
---|
45 | >> ${LOGFILE} 2>&1 &&
|
---|
46 | echo " o Build OK" || barf
|
---|
47 |
|
---|
48 | min_log_init ${TESTLOGS} &&
|
---|
49 | echo -e "\n Root Tests \n------------" >> ${LOGFILE} &&
|
---|
50 | make check-root \
|
---|
51 | >> ${LOGFILE} 2>&1 &&
|
---|
52 | echo " o Root tests OK" || errmsg
|
---|
53 |
|
---|
54 | echo "plfstest:x:1000:plfstest" >> /etc/group
|
---|
55 |
|
---|
56 | echo -e "\n User Tests \n------------" >> ${LOGFILE} &&
|
---|
57 | su plfstest -c "env RUN_EXPENSIVE_TESTS=yes make check" \
|
---|
58 | >> ${LOGFILE} 2>&1 &&
|
---|
59 | echo " o User tests OK" || errmsg
|
---|
60 |
|
---|
61 | mv /etc/group /etc/Xgroup
|
---|
62 | grep -v plfstest /etc/Xgroup > /etc/group
|
---|
63 | rm -rf /etc/Xgroup
|
---|
64 | chmod 644 /etc/group
|
---|
65 |
|
---|
66 | min_log_init ${INSTLOGS} &&
|
---|
67 | make install \
|
---|
68 | >> ${LOGFILE} 2>&1 &&
|
---|
69 | echo " o ALL OK" || barf
|
---|
70 |
|
---|
71 | # Fileutils binaries
|
---|
72 | mv -f /usr/bin/{chgrp,chmod,chown,cp,dd,df,install} /bin
|
---|
73 | mv -f /usr/bin/{ln,ls,mkdir,mknod,mv,rm,rmdir,sync} /bin
|
---|
74 | # Create /usr/bin/install -> /bin/install symlink
|
---|
75 | ln -sf ../../bin/install /usr/bin
|
---|
76 |
|
---|
77 | # Textutils binaries
|
---|
78 | mv -f /usr/bin/{cat,head} /bin
|
---|
79 |
|
---|
80 | # Sh-utils binaries
|
---|
81 | mv -f /usr/bin/{basename,date,echo,false,pwd} /bin
|
---|
82 | mv -f /usr/bin/{sleep,stty,su,test,true,uname} /bin
|
---|
83 | mv -f /usr/bin/chroot /usr/sbin
|
---|
84 |
|
---|
85 | # For FHS compliance
|
---|
86 | ln -sf test "/bin/["
|
---|