[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 |
|
---|
| 13 | echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}\n"
|
---|
| 14 | echo -e "DEF_OPT_LVL: ${L_arrow}${BOLD}${DEF_OPT_LVL}${OFF}${R_arrow}\n"
|
---|
| 15 |
|
---|
| 16 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
| 17 | eval optVal=\$${OPT_VAR}_${DEF_OPT_LVL}
|
---|
| 18 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
| 19 | done
|
---|
| 20 |
|
---|
| 21 | echo -e "\nOverrided packages:"
|
---|
| 22 | cat optimize/opt_override
|
---|
| 23 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
| 24 |
|
---|
| 25 | echo -n "Are you happy with these optimization settings? yes/no (no): "
|
---|
| 26 | read ANSWER
|
---|
| 27 | if [ x$ANSWER != "xyes" ] ; then
|
---|
| 28 | echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
|
---|
| 29 | exit 1
|
---|
| 30 | fi
|
---|
| 31 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
| 32 | }
|
---|
| 33 |
|
---|
[2c2471d] | 34 | #----------------------------------#
|
---|
| 35 | wrt_optimize() { # Apply pkg specific opt's to build
|
---|
| 36 | #----------------------------------#
|
---|
| 37 | local pkg=$1
|
---|
| 38 | local optLvl optVal OPT_VAR
|
---|
| 39 |
|
---|
| 40 | optLvl=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
| 41 | if [[ "$optLvl" = "" ]] ; then
|
---|
| 42 | optLvl=$DEF_OPT_LVL;
|
---|
| 43 | fi
|
---|
| 44 |
|
---|
| 45 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
| 46 | eval optVal=\$${OPT_VAR}_$optLvl
|
---|
| 47 |
|
---|
| 48 | if [[ "$optVal" != "unset" ]]; then
|
---|
| 49 | (
|
---|
| 50 | cat << EOF
|
---|
| 51 | @echo "export $OPT_VAR=\"$optVal\"" >> envars
|
---|
| 52 | EOF
|
---|
| 53 | ) >> $MKFILE.tmp
|
---|
| 54 | else
|
---|
| 55 | continue
|
---|
| 56 | fi
|
---|
| 57 | done
|
---|
[53bc10b] | 58 | }
|
---|
| 59 |
|
---|
| 60 | #----------------------------------#
|
---|
| 61 | wrt_makeflags() { # Apply MAKEFLAGS to build
|
---|
| 62 | #----------------------------------#
|
---|
| 63 | if [[ "$MAKEFLAGS" != "unset" ]]; then
|
---|
| 64 | (
|
---|
| 65 | cat << EOF
|
---|
| 66 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
| 67 | EOF
|
---|
| 68 | ) >> $MKFILE.tmp
|
---|
| 69 | else
|
---|
| 70 | continue
|
---|
| 71 | fi
|
---|
| 72 | }
|
---|