1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs target util-linux build
|
---|
4 | # ---------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | # NOTE: this script defaults to installing into the new root ( ${LFS} ).
|
---|
12 | # work has to be done on configure to make it install to
|
---|
13 | # ${TGT_TOOLS}
|
---|
14 |
|
---|
15 | # NOTE: *** For gods sake ryan, fix the setting of CPU and ARCH ***
|
---|
16 |
|
---|
17 | cd ${SRC}
|
---|
18 | LOG=util-linux-target.log
|
---|
19 |
|
---|
20 | set_libdirname
|
---|
21 | setup_multiarch
|
---|
22 |
|
---|
23 | unpack_tarball util-linux-${UTILLINUX_VER} &&
|
---|
24 | cd ${PKGDIR}
|
---|
25 |
|
---|
26 | case ${UTILLINUX_VER} in
|
---|
27 | 2.12 | 2.12a )
|
---|
28 | case ${KERNEL_VER} in
|
---|
29 | 2.[56].* )
|
---|
30 | # Fixes for utillinux 2.12 + 2.12a for building against 2.6
|
---|
31 | # kernel headers
|
---|
32 | apply_patch util-linux-2.12a-kernel_headers-1
|
---|
33 | ;;
|
---|
34 | esac
|
---|
35 | ;;
|
---|
36 | 2.12[k-q] )
|
---|
37 | # fix cramfs, this fix will need to be tracked for later versions...
|
---|
38 | apply_patch util-linux-2.12q-cramfs-1
|
---|
39 | # fix sfdisk for mips n32/64 as n32/64 uses lseek, not llseek
|
---|
40 | apply_patch util-linux-2.12q-sfdisk_use_lseek_for_mips64-1
|
---|
41 | ;;
|
---|
42 | esac
|
---|
43 |
|
---|
44 | case ${UTILLINUX_VER} in
|
---|
45 | 2.12 | 2.12[a-m] )
|
---|
46 | # Patch to fix fdiskbsdlabel.h for m68k, also adds unistd.h to list
|
---|
47 | # of includes for swapon.c
|
---|
48 | apply_patch util-linux-2.12a-cross-lfs-fixes
|
---|
49 | ;;
|
---|
50 | 2.12* )
|
---|
51 | # Patch to fix fdiskbsdlabel.h for m68k
|
---|
52 | apply_patch util-linux-2.12n-cross-lfs-fixes
|
---|
53 | ;;
|
---|
54 | esac
|
---|
55 |
|
---|
56 | # Make FHS compliant
|
---|
57 | # Get list of files which reference etc/adjtime
|
---|
58 | filelist=`grep -l -d recurse etc/adjtime *`
|
---|
59 |
|
---|
60 | # Edit each file in turn
|
---|
61 | for file in ${filelist} ; do
|
---|
62 | test -f ${file}-ORIG ||
|
---|
63 | cp ${file} ${file}-ORIG
|
---|
64 | # Change instance of etc/adjtime to var/lib/hwclock/adjtime
|
---|
65 | sed 's%etc/adjtime%var/lib/hwclock/adjtime%' \
|
---|
66 | ${file}-ORIG > ${file}
|
---|
67 | done
|
---|
68 | mkdir -p ${LFS}/var/lib/hwclock
|
---|
69 |
|
---|
70 | if [ ! "${USE_SYSROOT}" = "Y" ]; then
|
---|
71 | echo " o Changing hard coded references to /usr/include to point at ${TGT_TOOLS}"
|
---|
72 | flist=`grep -d recurse -l /usr/include *`
|
---|
73 | for file in ${flist}; do
|
---|
74 | (
|
---|
75 | echo " - editing ${file}"
|
---|
76 | test -f ${file}-ORIG || cp ${file} ${file}-ORIG
|
---|
77 | sed 's@/usr/include@${TGT_TOOLS}/include@g' ${file}-ORIG > ${file}
|
---|
78 | )
|
---|
79 | done
|
---|
80 | fi
|
---|
81 |
|
---|
82 | # Optimization defaults to -O2
|
---|
83 | max_log_init Util-linux ${UTILLINUX_VER} "Final (shared)" ${CONFLOGS} ${LOG}
|
---|
84 | export CC="${TARGET}-gcc ${ARCH_CFLAGS}"
|
---|
85 |
|
---|
86 | # Here it is just plain ugly. We set CPU and ARCH to something that wont trigger
|
---|
87 | # anything in MCONFIG
|
---|
88 | export CPU=m68k
|
---|
89 | export ARCH=m68k
|
---|
90 | export DESTDIR=${LFS}
|
---|
91 |
|
---|
92 | ./configure \
|
---|
93 | >> ${LOGFILE} 2>&1 &&
|
---|
94 | echo " o Configure OK" &&
|
---|
95 |
|
---|
96 | # Don't build kill or sln
|
---|
97 | # (procps supplies kill and glibc supplies sln)
|
---|
98 | # No need to supply LDFLAGS="-s", taken care of during configure
|
---|
99 | #
|
---|
100 | # Optionally, for x86, unset CPUOPT (defaults to i486 if cpu not i386)
|
---|
101 | # or set specifically for your cpu type.
|
---|
102 | # See MCONFIG...
|
---|
103 | #
|
---|
104 | # also, build login by setting HAVE_SHADOW to no, this can be revisited
|
---|
105 | # if/when we cross-compile the shadow package
|
---|
106 |
|
---|
107 | min_log_init ${BUILDLOGS} &&
|
---|
108 | make HAVE_KILL=yes HAVE_SLN=yes HAVE_SHADOW=no CPUOPT="" \
|
---|
109 | >> ${LOGFILE} 2>&1 &&
|
---|
110 | echo " o Build OK" || barf
|
---|
111 |
|
---|
112 | min_log_init ${INSTLOGS} &&
|
---|
113 | echo Password:
|
---|
114 | su -c "export PATH=${PATH} ; make HAVE_KILL=yes HAVE_SLN=yes HAVE_SHADOW=no install" \
|
---|
115 | >> ${LOGFILE} 2>&1 &&
|
---|
116 | echo " o ALL OK" || barf
|
---|
117 |
|
---|