1 | #!/bin/bash |
---|
2 | |
---|
3 | # cross-lfs target e2fsprogs build |
---|
4 | # -------------------------------- |
---|
5 | # $LastChangedBy$ |
---|
6 | # $LastChangedDate$ |
---|
7 | # $LastChangedRevision$ |
---|
8 | # $HeadURL$ |
---|
9 | # |
---|
10 | |
---|
11 | # NOTE: This installs to the target root, |
---|
12 | # NOT to ${TGT_TOOLS} |
---|
13 | # |
---|
14 | # NOTE: also requires gettext built native on the build host |
---|
15 | |
---|
16 | |
---|
17 | cd ${SRC} |
---|
18 | LOG=e2fsprogs-target.log |
---|
19 | set_libdirname |
---|
20 | setup_multiarch |
---|
21 | |
---|
22 | if [ "${USE_SYSROOT}" = "Y" ]; then |
---|
23 | BUILD_PREFIX=/usr |
---|
24 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}" |
---|
25 | INSTALL_OPTIONS="DESTDIR=${LFS}" |
---|
26 | extra_conf="--with-root-prefix=\"\"" |
---|
27 | else |
---|
28 | BUILD_PREFIX=${TGT_TOOLS} |
---|
29 | INSTALL_PREFIX="${TGT_TOOLS}" |
---|
30 | INSTALL_OPTIONS="" |
---|
31 | fi |
---|
32 | |
---|
33 | unpack_tarball e2fsprogs-${E2FSPROGS_VER} |
---|
34 | |
---|
35 | cd ${PKGDIR} |
---|
36 | # Apply patch for HTREE problem posted by GS 3/19/2003 |
---|
37 | #apply_patch e2fsprogs-${E2FSPROGS_VER} |
---|
38 | |
---|
39 | case ${KERNEL_VER} in |
---|
40 | 2.6* ) |
---|
41 | # patch util.c to remove SCSI_BLOCK_MAJOR references |
---|
42 | # SCSI_DISK_MAJOR is no longer defined in linux/major.h for 2.6 kernel |
---|
43 | # TODO: check future e2fsprogs versions to see if this is fixed |
---|
44 | case ${E2FSPROGS_VER} in |
---|
45 | 1.34* ) |
---|
46 | # check if SCSI_DISK_MAJOR defined in linux/major.h |
---|
47 | grep SCSI_DISK_MAJOR ${INSTALL_PREFIX}/include/linux/major.h > /dev/null 2>&1 || |
---|
48 | apply_patch e2fsprogs-${E2FSPROGS_VER}-2.6.0hdr-fix |
---|
49 | ;; |
---|
50 | esac |
---|
51 | ;; |
---|
52 | esac |
---|
53 | |
---|
54 | |
---|
55 | case ${E2FSPROGS_VER} in |
---|
56 | 1.35 ) |
---|
57 | # Fix some permissions issues when building the e2fsprogs 1.35 tarball |
---|
58 | # as a normal user. Need to check if previous versions are affected |
---|
59 | chmod 755 configure |
---|
60 | chmod 644 po/* |
---|
61 | ;; |
---|
62 | 1.37 ) |
---|
63 | # Fix braindead error in e2p tests where include paths aren't |
---|
64 | # being passed |
---|
65 | if [ ! -f lib/e2p/Makefile.in-ORIG ]; then |
---|
66 | mv lib/e2p/Makefile.in lib/e2p/Makefile.in-ORIG |
---|
67 | fi |
---|
68 | |
---|
69 | sed 's@-DTEST_PROGRAM@$(ALL_CFLAGS) &@g' \ |
---|
70 | lib/e2p/Makefile.in-ORIG > lib/e2p/Makefile.in |
---|
71 | ;; |
---|
72 | esac |
---|
73 | |
---|
74 | # Edit configure so libdir and root_libdir point at */lib64 . |
---|
75 | # Also handles additional_libdir (used if--with-libiconv-prefix is set, |
---|
76 | # if we did set it (which we dont) we'd want the 64bit version anyway) ... |
---|
77 | chmod 755 configure |
---|
78 | test -f configure-ORIG || |
---|
79 | cp -p configure configure-ORIG |
---|
80 | |
---|
81 | sed "/libdir=.*\/lib/s@/lib@/${libdirname}@g" \ |
---|
82 | configure-ORIG > configure |
---|
83 | |
---|
84 | # We need to check if the build OS has a <getopt.h>. |
---|
85 | # If it doesn't, and HAVE_GETOPT_H is defined, util/subst.c will barf |
---|
86 | # (its compiled with BUILD_CC ie: the hosts cc). This is the case building |
---|
87 | # linux from solaris. Hack util/subst.c where necessary |
---|
88 | |
---|
89 | # TODO: actually try to compile something... |
---|
90 | if [ ! -f /usr/include/getopt.h ]; then |
---|
91 | test -f util/subst.c-ORIG || |
---|
92 | mv util/subst.c util/subst.c-ORIG |
---|
93 | |
---|
94 | # This will avoid the problem. |
---|
95 | # Ideally the build-host would have a separate define than for |
---|
96 | # the target, one day I may even patch it so it does... |
---|
97 | sed 's@HAVE_GETOPT_H@HOST_&@g' \ |
---|
98 | util/subst.c-ORIG > util/subst.c |
---|
99 | fi |
---|
100 | |
---|
101 | cd ${SRC} |
---|
102 | test -d ${SRC}/e2fsprogs-${E2FSPROGS_VER}-build && |
---|
103 | rm -rf ${SRC}/e2fsprogs-${E2FSPROGS_VER}-build |
---|
104 | |
---|
105 | mkdir ${SRC}/e2fsprogs-${E2FSPROGS_VER}-build && |
---|
106 | cd ${SRC}/e2fsprogs-${E2FSPROGS_VER}-build |
---|
107 | |
---|
108 | # When cross-compiling configure cannot determine sizes and assumes |
---|
109 | # short=2, int=4, long=4, long long=8 |
---|
110 | # This may not be correct for certain architectures, override here |
---|
111 | case ${TGT_ARCH} in |
---|
112 | ppc64 | powerpc64 ) |
---|
113 | # TODO: what is size of long long on ppc64? |
---|
114 | echo "ac_cv_sizeof_long_long=8" >> config.cache |
---|
115 | echo "ac_cv_sizeof_long=8" >> config.cache |
---|
116 | echo "ac_cv_sizeof_int=4" >> config.cache |
---|
117 | echo "ac_cv_sizeof_short=2" >> config.cache |
---|
118 | extra_conf="${extra_conf} --cache-file=config.cache" |
---|
119 | ;; |
---|
120 | esac |
---|
121 | |
---|
122 | max_log_init E2fsprogs ${E2FSPROGS_VER} "Final (shared)" ${CONFLOGS} ${LOG} |
---|
123 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \ |
---|
124 | AR="${TARGET}-ar" RANLIB="${TARGET}-ranlib" \ |
---|
125 | LD="${TARGET}-ld" STRIP="${TARGET}-strip" \ |
---|
126 | CFLAGS="-O2 -pipe" ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \ |
---|
127 | --host=${TARGET} --enable-elf-shlibs ${extra_conf} \ |
---|
128 | >> ${LOGFILE} 2>&1 && |
---|
129 | echo " o Configure OK" && |
---|
130 | |
---|
131 | min_log_init ${BUILDLOGS} && |
---|
132 | make CC="${TARGET}-gcc ${ARCH_CFLAGS}" LDFLAGS="-s" \ |
---|
133 | >> ${LOGFILE} 2>&1 && |
---|
134 | echo " o Build OK" && |
---|
135 | |
---|
136 | min_log_init ${INSTLOGS} && |
---|
137 | make ${INSTALL_OPTIONS} install \ |
---|
138 | >> ${LOGFILE} 2>&1 && |
---|
139 | make ${INSTALL_OPTIONS} install-libs \ |
---|
140 | >> ${LOGFILE} 2>&1 && |
---|
141 | echo " o ALL OK" || barf |
---|
142 | |
---|
143 | if [ ! "${USE_SYSROOT}" = "Y" ]; then |
---|
144 | # if ${LFS}/sbin doesn't exist, create it |
---|
145 | set -x |
---|
146 | if [ ! -d ${LFS}/sbin ]; then |
---|
147 | mkdir -p ${LFS}/sbin |
---|
148 | fi |
---|
149 | |
---|
150 | # Install these for the benefit of init scripts. |
---|
151 | # Should be overwritten in ch 6. |
---|
152 | cd ${LFS}/sbin |
---|
153 | ln -sf ..${TGT_TOOLS}/sbin/fsck.ext2 . |
---|
154 | ln -sf ..${TGT_TOOLS}/sbin/fsck.ext3 . |
---|
155 | ln -sf ..${TGT_TOOLS}/sbin/e2fsck . |
---|
156 | set +x |
---|
157 | fi |
---|