source: optimize/optimize_functions@ 619b313

ablfs-more legacy trunk
Last change on this file since 619b313 was d023a35, checked in by Pierre Labastie <pierre@…>, 11 years ago

Exit without error if the user answers no

  • Property mode set to 100644
File size: 2.3 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
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 know what you are doing and be sure that the"
16 echo -e "optimization settings listed below are what you want.\n"
17 echo -e "If there are build issues or the system doesn't work as"
18 echo -e "expected, please rebuild without optimizations before"
19 echo -e "asking for support.${OFF}\n"
20
21 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
22 [[ "$MAKEFLAGS" = "unset" ]] && echo
23 [[ "$MAKEFLAGS" != "unset" ]] && \
24 echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
25
26 echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
27
28 for OPT_VAR in $ACTIVE_OPT_VARS ; do
29 eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
30 echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
31 done
32
33 echo -e "\nOverridden packages:"
34 cat optimize/opt_override
35 echo "${nl_}${SD_BORDER}${nl_}"
36
37 echo -n "Are you happy with these optimization settings? yes/no (no): "
38 read ANSWER
39 if [ x$ANSWER != "xyes" ] ; then
40 echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
41 exit
42 fi
43 echo "${nl_}${SD_BORDER}${nl_}"
44}
45
46#----------------------------------#
47wrt_optimize() { # Apply pkg specific opt's to build
48#----------------------------------#
49 local pkg=$1
50 local optMode optVal OPT_VAR
51
52 optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
53 if [[ "$optMode" = "" ]] ; then
54 optMode=$DEF_OPT_MODE;
55 fi
56
57 for OPT_VAR in $ACTIVE_OPT_VARS ; do
58 eval optVal=\$${OPT_VAR}_$optMode
59
60 if [[ "$optVal" != "unset" ]]; then
61(
62cat << EOF
63 @echo "export $OPT_VAR=\"$optVal\"" >> envars
64EOF
65) >> $MKFILE.tmp
66 else
67 continue
68 fi
69 done
70}
71
72#----------------------------------#
73wrt_makeflags() { # Apply MAKEFLAGS to build
74#----------------------------------#
75 local pkg=$1
76 local MKF
77
78 if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
79 MKF=unset
80 else
81 MKF=$MAKEFLAGS
82 fi
83
84 if [[ "$MKF" != "unset" ]]; then
85(
86cat << EOF
87 @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
88EOF
89) >> $MKFILE.tmp
90 fi
91}
Note: See TracBrowser for help on using the repository browser.