[1b65a84] | 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 |
|
---|
[9ef12f7] | 21 | echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}"
|
---|
| 22 | [ -n "$JH_MAKEFLAGS" ] && \
|
---|
[1b65a84] | 23 | echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\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_}"
|
---|
[d023a35] | 40 | exit
|
---|
[1b65a84] | 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 | local MKF
|
---|
| 76 |
|
---|
[a96109a] | 77 | if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
|
---|
[1b65a84] | 78 | MKF=unset
|
---|
| 79 | else
|
---|
[9ef12f7] | 80 | MKF=$JH_MAKEFLAGS
|
---|
[1b65a84] | 81 | fi
|
---|
| 82 |
|
---|
| 83 | if [[ "$MKF" != "unset" ]]; then
|
---|
| 84 | (
|
---|
| 85 | cat << EOF
|
---|
[9ef12f7] | 86 | @echo "export MAKEFLAGS=\"$JH_MAKEFLAGS\"" >> envars
|
---|
[1b65a84] | 87 | EOF
|
---|
| 88 | ) >> $MKFILE.tmp
|
---|
| 89 | fi
|
---|
| 90 | }
|
---|