[2c2471d] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # $Id$
|
---|
| 4 |
|
---|
| 5 | set +e
|
---|
| 6 |
|
---|
| 7 |
|
---|
[066991c] | 8 | #----------------------------------#
|
---|
| 9 | validate_opt_settings() { # Show optimize setting and wait user agreement
|
---|
| 10 | #----------------------------------#
|
---|
| 11 | local OPT_VAR optVal
|
---|
| 12 |
|
---|
[01b0e92] | 13 | echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
|
---|
| 14 | echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
|
---|
[b5aa524] | 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"
|
---|
[73d9790] | 17 | echo -e "If there are build issues or the system doesn't work as"
|
---|
[01b0e92] | 18 | echo -e "expected, please rebuild without optimizations before"
|
---|
[73d9790] | 19 | echo -e "asking for support.${OFF}\n"
|
---|
[01b0e92] | 20 |
|
---|
| 21 | echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
|
---|
[b5aa524] | 22 | [[ "$MAKEFLAGS" != "unset" ]] && \
|
---|
[01b0e92] | 23 | echo -e "DejaGNU, Gettext, and Groff will not use MAKEFLAGS\n"
|
---|
[b5aa524] | 24 |
|
---|
[c205656] | 25 | echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
---|
[066991c] | 26 |
|
---|
| 27 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
[c205656] | 28 | eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
---|
[066991c] | 29 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
| 30 | done
|
---|
| 31 |
|
---|
[c205656] | 32 | echo -e "\nOverridden packages:"
|
---|
[066991c] | 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 |
|
---|
[2c2471d] | 45 | #----------------------------------#
|
---|
| 46 | wrt_optimize() { # Apply pkg specific opt's to build
|
---|
| 47 | #----------------------------------#
|
---|
| 48 | local pkg=$1
|
---|
[c205656] | 49 | local optMode optVal OPT_VAR
|
---|
[2c2471d] | 50 |
|
---|
[c205656] | 51 | optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
| 52 | if [[ "$optMode" = "" ]] ; then
|
---|
| 53 | optMode=$DEF_OPT_MODE;
|
---|
[2c2471d] | 54 | fi
|
---|
| 55 |
|
---|
| 56 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
[c205656] | 57 | eval optVal=\$${OPT_VAR}_$optMode
|
---|
[2c2471d] | 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
|
---|
[53bc10b] | 69 | }
|
---|
| 70 |
|
---|
| 71 | #----------------------------------#
|
---|
| 72 | wrt_makeflags() { # Apply MAKEFLAGS to build
|
---|
| 73 | #----------------------------------#
|
---|
[c205656] | 74 | local pkg=$1
|
---|
| 75 |
|
---|
| 76 | case $pkg in
|
---|
[024e3de] | 77 | dejagnu | gettext | groff ) # Don't support well -jX for now
|
---|
[c205656] | 78 | ;;
|
---|
| 79 | *)
|
---|
| 80 | if [[ "$MAKEFLAGS" != "unset" ]]; then
|
---|
[53bc10b] | 81 | (
|
---|
| 82 | cat << EOF
|
---|
| 83 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
| 84 | EOF
|
---|
| 85 | ) >> $MKFILE.tmp
|
---|
[c205656] | 86 | else
|
---|
| 87 | continue
|
---|
| 88 | fi
|
---|
| 89 | ;;
|
---|
| 90 | esac
|
---|
[53bc10b] | 91 | }
|
---|