1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # $Id$
|
---|
4 |
|
---|
5 | set +e
|
---|
6 |
|
---|
7 |
|
---|
8 | #----------------------------------#
|
---|
9 | validate_opt_settings() { # Show optimize setting and wait user agreement
|
---|
10 | #----------------------------------#
|
---|
11 | local OPT_VAR optVal
|
---|
12 |
|
---|
13 | echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
|
---|
14 | echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
|
---|
15 | echo -e "You should know what you are doing and be sure that the"
|
---|
16 | echo -e "optimization settings listed below are what you want.\n"
|
---|
17 | echo -e "If there are build issues or the system doesn't work as"
|
---|
18 | echo -e "expected, please rebuild without optimizations before"
|
---|
19 | echo -e "asking for support.${OFF}\n"
|
---|
20 |
|
---|
21 | echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
|
---|
22 | [[ "$MAKEFLAGS" != "unset" ]] && \
|
---|
23 | echo -e "DejaGNU, Gettext, and Groff will not use MAKEFLAGS\n"
|
---|
24 |
|
---|
25 | echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
---|
26 |
|
---|
27 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
28 | eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
---|
29 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
30 | done
|
---|
31 |
|
---|
32 | echo -e "\nOverridden packages:"
|
---|
33 | cat optimize/opt_override
|
---|
34 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
35 |
|
---|
36 | echo -n "Are you happy with these optimization settings? yes/no (no): "
|
---|
37 | read ANSWER
|
---|
38 | if [ x$ANSWER != "xyes" ] ; then
|
---|
39 | echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
|
---|
40 | exit 1
|
---|
41 | fi
|
---|
42 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
43 | }
|
---|
44 |
|
---|
45 | #----------------------------------#
|
---|
46 | wrt_optimize() { # Apply pkg specific opt's to build
|
---|
47 | #----------------------------------#
|
---|
48 | local pkg=$1
|
---|
49 | local optMode optVal OPT_VAR
|
---|
50 |
|
---|
51 | optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
52 | if [[ "$optMode" = "" ]] ; then
|
---|
53 | optMode=$DEF_OPT_MODE;
|
---|
54 | fi
|
---|
55 |
|
---|
56 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
57 | eval optVal=\$${OPT_VAR}_$optMode
|
---|
58 |
|
---|
59 | if [[ "$optVal" != "unset" ]]; then
|
---|
60 | (
|
---|
61 | cat << EOF
|
---|
62 | @echo "export $OPT_VAR=\"$optVal\"" >> envars
|
---|
63 | EOF
|
---|
64 | ) >> $MKFILE.tmp
|
---|
65 | else
|
---|
66 | continue
|
---|
67 | fi
|
---|
68 | done
|
---|
69 | }
|
---|
70 |
|
---|
71 | #----------------------------------#
|
---|
72 | wrt_makeflags() { # Apply MAKEFLAGS to build
|
---|
73 | #----------------------------------#
|
---|
74 | local pkg=$1
|
---|
75 |
|
---|
76 | case $pkg in
|
---|
77 | dejagnu | gettext | groff ) # Don't support well -jX for now
|
---|
78 | ;;
|
---|
79 | *)
|
---|
80 | if [[ "$MAKEFLAGS" != "unset" ]]; then
|
---|
81 | (
|
---|
82 | cat << EOF
|
---|
83 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
84 | EOF
|
---|
85 | ) >> $MKFILE.tmp
|
---|
86 | else
|
---|
87 | continue
|
---|
88 | fi
|
---|
89 | ;;
|
---|
90 | esac
|
---|
91 | }
|
---|