source: optimize/optimize_functions@ 066991c

experimental
Last change on this file since 066991c was 066991c, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added user validation for optimize settings.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5set +e
6
7
8#----------------------------------#
9validate_opt_settings() { # Show optimize setting and wait user agreement
10#----------------------------------#
11 local OPT_VAR optVal
12 local -r PARAM_VALS='${config_param}: ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
13
14 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}\n"
15 echo -e "DEF_OPT_LVL: ${L_arrow}${BOLD}${DEF_OPT_LVL}${OFF}${R_arrow}\n"
16
17 for OPT_VAR in $ACTIVE_OPT_VARS ; do
18 eval optVal=\$${OPT_VAR}_${DEF_OPT_LVL}
19 echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
20 done
21
22 echo -e "\nOverrided packages:"
23 cat optimize/opt_override
24 echo "${nl_}${SD_BORDER}${nl_}"
25
26 echo -n "Are you happy with these optimization settings? yes/no (no): "
27 read ANSWER
28 if [ x$ANSWER != "xyes" ] ; then
29 echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
30 exit 1
31 fi
32 echo "${nl_}${SD_BORDER}${nl_}"
33}
34
35#----------------------------------#
36wrt_optimize() { # Apply pkg specific opt's to build
37#----------------------------------#
38 local pkg=$1
39 local optLvl optVal OPT_VAR
40
41 optLvl=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
42 if [[ "$optLvl" = "" ]] ; then
43 optLvl=$DEF_OPT_LVL;
44 fi
45
46 for OPT_VAR in $ACTIVE_OPT_VARS ; do
47 eval optVal=\$${OPT_VAR}_$optLvl
48
49 if [[ "$optVal" != "unset" ]]; then
50(
51cat << EOF
52 @echo "export $OPT_VAR=\"$optVal\"" >> envars
53EOF
54) >> $MKFILE.tmp
55 else
56 continue
57 fi
58 done
59}
60
61#----------------------------------#
62wrt_makeflags() { # Apply MAKEFLAGS to build
63#----------------------------------#
64 if [[ "$MAKEFLAGS" != "unset" ]]; then
65(
66cat << EOF
67 @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
68EOF
69) >> $MKFILE.tmp
70 else
71 continue
72 fi
73}
Note: See TracBrowser for help on using the repository browser.