1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs target bash build
|
---|
4 | # ---------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG=bash-target.log
|
---|
13 |
|
---|
14 | unpack_tarball bash-${BASH_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 | case ${BASH_VER} in
|
---|
31 | 2.05b )
|
---|
32 | # Apply published official patches fro bash-2.05b
|
---|
33 | apply_patch bash-2.05b-gnu_fixes-2
|
---|
34 | if [ x${TGT_ARCH} = xm68k ]; then
|
---|
35 | cat >config.cache <<END
|
---|
36 | ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
|
---|
37 | bash_cv_dup2_broken=${bash_cv_dup2_broken=no}
|
---|
38 | bash_cv_func_sigsetjmp=${bash_cv_func_sigsetjmp=present}
|
---|
39 | bash_cv_func_strcoll_broken=${bash_cv_func_strcoll_broken=yes}
|
---|
40 | bash_cv_getcwd_calls_popen=${bash_cv_getcwd_calls_popen=no}
|
---|
41 | bash_cv_getenv_redef=${bash_cv_getenv_redef=yes}
|
---|
42 | bash_cv_have_mbstate_t=${bash_cv_have_mbstate_t=yes}
|
---|
43 | bash_cv_job_control_missing=${bash_cv_job_control_missing=present}
|
---|
44 | bash_cv_must_reinstall_sighandlers=${bash_cv_must_reinstall_sighandlers=no}
|
---|
45 | bash_cv_pgrp_pipe=${bash_cv_pgrp_pipe=no}
|
---|
46 | bash_cv_printf_a_format=${bash_cv_printf_a_format=yes}
|
---|
47 | bash_cv_sys_named_pipes=${bash_cv_sys_named_pipes=present}
|
---|
48 | bash_cv_sys_siglist=${bash_cv_sys_siglist=yes}
|
---|
49 | bash_cv_ulimit_maxfds=${bash_cv_ulimit_maxfds=yes}
|
---|
50 | bash_cv_under_sys_siglist=${bash_cv_under_sys_siglist=yes}
|
---|
51 | bash_cv_opendir_not_robust=${bash_cv_opendir_not_robust=no}
|
---|
52 | bash_cv_unusable_rtsigs=${bash_cv_unusable_rtsigs=no}
|
---|
53 | END
|
---|
54 | else
|
---|
55 | cat >config.cache <<END
|
---|
56 | bash_cv_have_mbstate_t=${bash_cv_have_mbstate_t=yes}
|
---|
57 | END
|
---|
58 | fi
|
---|
59 |
|
---|
60 | # If using gcc-3.4.x, patch some syntax gcc-3.4 doesn't like
|
---|
61 | # TODO: Get gcc version from cross-gcc itself
|
---|
62 | case ${GCC_VER} in
|
---|
63 | 3.4* )
|
---|
64 | apply_patch bash-2.05b-gcc34-1
|
---|
65 | ;;
|
---|
66 | esac
|
---|
67 | ;;
|
---|
68 | 3.0 )
|
---|
69 | # Reported on bug-bash by Tim Waugh <twaugh@redhat.com>
|
---|
70 | # http://lists.gnu.org/archive/html/bug-bash/2004-09/msg00081.html
|
---|
71 | apply_patch bash-3.0-fixes-1
|
---|
72 | apply_patch bash-3.0-avoid_WCONTINUED-1
|
---|
73 | ;;
|
---|
74 | esac
|
---|
75 |
|
---|
76 | # Patch Makefile.in to use ${TARGET}-size instead of size
|
---|
77 | test -f Makefile.in-ORIG ||
|
---|
78 | mv Makefile.in Makefile.in-ORIG
|
---|
79 |
|
---|
80 | # Following defaults to powerpc if doing ppc* build...
|
---|
81 | #sed 's@size \$(Program)@\$(MACHTYPE)-&@g' Makefile.in-ORIG > Makefile.in
|
---|
82 | sed "s@size \$(Program)@${TARGET}-&@g" Makefile.in-ORIG > Makefile.in
|
---|
83 |
|
---|
84 | max_log_init Bash ${BASH_VER} "target (shared)" ${CONFLOGS} ${LOG}
|
---|
85 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \
|
---|
86 | CXX="${TARGET}-g++ ${ARCH_CFLAGS}" \
|
---|
87 | AR="${TARGET}-ar" RANLIB="${TARGET}-ranlib" \
|
---|
88 | CFLAGS="-O2 -pipe ${TGT_CFLAGS}" \
|
---|
89 | CXXFLAGS="-O2 -pipe ${TGT_CFLAGS}" \
|
---|
90 | ./configure --prefix=${BUILD_PREFIX} \
|
---|
91 | --host=${TARGET} --with-curses --cache-file=config.cache \
|
---|
92 | --without-bash-malloc \
|
---|
93 | >> ${LOGFILE} 2>&1 &&
|
---|
94 | echo " o Configure OK" &&
|
---|
95 |
|
---|
96 | # Don't build bash with parallelism, race conditions cause version.h
|
---|
97 | # not to be created
|
---|
98 | min_log_init ${BUILDLOGS} &&
|
---|
99 | make LDFLAGS="-s" \
|
---|
100 | >> ${LOGFILE} 2>&1 &&
|
---|
101 | echo " o Build OK" &&
|
---|
102 |
|
---|
103 | min_log_init ${INSTLOGS} &&
|
---|
104 | make ${INSTALL_OPTIONS} install \
|
---|
105 | >> ${LOGFILE} 2>&1 &&
|
---|
106 | echo " o ALL OK" || barf
|
---|
107 |
|
---|
108 | ln -sf bash ${INSTALL_PREFIX}/bin/sh
|
---|