[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"
|
---|
[c205656] | 14 | echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
---|
[066991c] | 15 |
|
---|
| 16 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
[c205656] | 17 | eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
---|
[066991c] | 18 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
| 19 | done
|
---|
| 20 |
|
---|
[c205656] | 21 | echo -e "\nOverridden packages:"
|
---|
[066991c] | 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
|
---|
[c205656] | 38 | local optMode optVal OPT_VAR
|
---|
[2c2471d] | 39 |
|
---|
[c205656] | 40 | optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
| 41 | if [[ "$optMode" = "" ]] ; then
|
---|
| 42 | optMode=$DEF_OPT_MODE;
|
---|
[2c2471d] | 43 | fi
|
---|
| 44 |
|
---|
| 45 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
[c205656] | 46 | eval optVal=\$${OPT_VAR}_$optMode
|
---|
[2c2471d] | 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 | #----------------------------------#
|
---|
[c205656] | 63 | local pkg=$1
|
---|
| 64 |
|
---|
| 65 | case $pkg in
|
---|
| 66 | gettext | groff ) # Don't support -jX for now
|
---|
| 67 | ;;
|
---|
| 68 | *)
|
---|
| 69 | if [[ "$MAKEFLAGS" != "unset" ]]; then
|
---|
[53bc10b] | 70 | (
|
---|
| 71 | cat << EOF
|
---|
| 72 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
| 73 | EOF
|
---|
| 74 | ) >> $MKFILE.tmp
|
---|
[c205656] | 75 | else
|
---|
| 76 | continue
|
---|
| 77 | fi
|
---|
| 78 | ;;
|
---|
| 79 | esac
|
---|
[53bc10b] | 80 | }
|
---|