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 "\t\t${RED}${BOLD}WARNING:${OFF}\n"
|
---|
14 | echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
|
---|
15 | echo -e "You should to know what you are doing and be sure that"
|
---|
16 | echo -e "the optimization settings listed below is what you want.\n"
|
---|
17 | echo -e "If there are build issues or the system don't work as"
|
---|
18 | echo -e "expected, please rebuild without optimizations before"
|
---|
19 | echo -e "to ask for support.${OFF}\n"
|
---|
20 |
|
---|
21 | echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
|
---|
22 | echo -e "DejaGNU, Gettext, and Groff will not use MAKEFLAGS\n"
|
---|
23 | echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
---|
24 |
|
---|
25 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
26 | eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
---|
27 | echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
---|
28 | done
|
---|
29 |
|
---|
30 | echo -e "\nOverridden packages:"
|
---|
31 | cat optimize/opt_override
|
---|
32 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
33 |
|
---|
34 | echo -n "Are you happy with these optimization settings? yes/no (no): "
|
---|
35 | read ANSWER
|
---|
36 | if [ x$ANSWER != "xyes" ] ; then
|
---|
37 | echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
|
---|
38 | exit 1
|
---|
39 | fi
|
---|
40 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
41 | }
|
---|
42 |
|
---|
43 | #----------------------------------#
|
---|
44 | wrt_optimize() { # Apply pkg specific opt's to build
|
---|
45 | #----------------------------------#
|
---|
46 | local pkg=$1
|
---|
47 | local optMode optVal OPT_VAR
|
---|
48 |
|
---|
49 | optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
---|
50 | if [[ "$optMode" = "" ]] ; then
|
---|
51 | optMode=$DEF_OPT_MODE;
|
---|
52 | fi
|
---|
53 |
|
---|
54 | for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
---|
55 | eval optVal=\$${OPT_VAR}_$optMode
|
---|
56 |
|
---|
57 | if [[ "$optVal" != "unset" ]]; then
|
---|
58 | (
|
---|
59 | cat << EOF
|
---|
60 | @echo "export $OPT_VAR=\"$optVal\"" >> envars
|
---|
61 | EOF
|
---|
62 | ) >> $MKFILE.tmp
|
---|
63 | else
|
---|
64 | continue
|
---|
65 | fi
|
---|
66 | done
|
---|
67 | }
|
---|
68 |
|
---|
69 | #----------------------------------#
|
---|
70 | wrt_makeflags() { # Apply MAKEFLAGS to build
|
---|
71 | #----------------------------------#
|
---|
72 | local pkg=$1
|
---|
73 |
|
---|
74 | case $pkg in
|
---|
75 | dejagnu | gettext | groff ) # Don't support well -jX for now
|
---|
76 | ;;
|
---|
77 | *)
|
---|
78 | if [[ "$MAKEFLAGS" != "unset" ]]; then
|
---|
79 | (
|
---|
80 | cat << EOF
|
---|
81 | @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
---|
82 | EOF
|
---|
83 | ) >> $MKFILE.tmp
|
---|
84 | else
|
---|
85 | continue
|
---|
86 | fi
|
---|
87 | ;;
|
---|
88 | esac
|
---|
89 | }
|
---|