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 "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}\n"
|
---|
14 | echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
---|
15 |
|
---|
16 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
17 | eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
---|
18 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
19 | done
|
---|
20 |
|
---|
21 | echo -e "\nOverridden 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 |
|
---|
34 | #----------------------------------#
|
---|
35 | wrt_optimize() { # Apply pkg specific opt's to build
|
---|
36 | #----------------------------------#
|
---|
37 | local pkg=$1
|
---|
38 | local optMode optVal OPT_VAR
|
---|
39 |
|
---|
40 | optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
41 | if [[ "$optMode" = "" ]] ; then
|
---|
42 | optMode=$DEF_OPT_MODE;
|
---|
43 | fi
|
---|
44 |
|
---|
45 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
46 | eval optVal=\$${OPT_VAR}_$optMode
|
---|
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
|
---|
58 | }
|
---|
59 |
|
---|
60 | #----------------------------------#
|
---|
61 | wrt_makeflags() { # Apply MAKEFLAGS to build
|
---|
62 | #----------------------------------#
|
---|
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
|
---|
70 | (
|
---|
71 | cat << EOF
|
---|
72 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
73 | EOF
|
---|
74 | ) >> $MKFILE.tmp
|
---|
75 | else
|
---|
76 | continue
|
---|
77 | fi
|
---|
78 | ;;
|
---|
79 | esac
|
---|
80 | }
|
---|