source: optimize/optimize_functions

trunk
Last change on this file was 645ec47, checked in by Pierre Labastie <pierre.labastie@…>, 13 months ago

Reorganize advanced options in Config.in

  • Put parallelization menu first
  • Fix the logic for variable definitions in this menu
  • change jhalfs to reflect the separation of optimization and parallelization
  • validate new variables
  • remove MAKEFLAGS from the validation of optimize variables
  • also remove the black list, which has not been used in years.
  • Property mode set to 100644
File size: 2.2 KB
Line 
1#!/bin/bash
2
3set +e
4
5
6#----------------------------------#
7validate_opt_settings() { # Show optimize setting and wait user agreement
8#----------------------------------#
9 local OPT_VAR optVal
10
11 echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
12 echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
13 echo -e "You should know what you are doing and be sure that the"
14 echo -e "optimization settings listed below are what you want.\n"
15 echo -e "If there are build issues or the system doesn't work as"
16 echo -e "expected, please rebuild without optimizations before"
17 echo -e "asking for support.${OFF}\n"
18
19# [ -n "$JH_MAKEFLAGS" ] && \
20# echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
21
22 echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
23
24 for OPT_VAR in $ACTIVE_OPT_VARS ; do
25 eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
26 echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
27 done
28
29 echo -e "\nOverridden packages:"
30 cat optimize/opt_override
31 echo "${nl_}${SD_BORDER}${nl_}"
32
33 echo -n "Are you happy with these optimization settings? yes/no (no): "
34 read ANSWER
35 if [ x$ANSWER != "xyes" ] ; then
36 echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
37 exit
38 fi
39 echo "${nl_}${SD_BORDER}${nl_}"
40}
41
42#----------------------------------#
43wrt_optimize() { # Apply pkg specific opt's to build
44#----------------------------------#
45 local pkg=$1
46 local optMode optVal OPT_VAR
47
48 optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
49 if [[ "$optMode" = "" ]] ; then
50 optMode=$DEF_OPT_MODE;
51 fi
52
53 for OPT_VAR in $ACTIVE_OPT_VARS ; do
54 eval optVal=\$${OPT_VAR}_$optMode
55
56 if [[ "$optVal" != "unset" ]]; then
57(
58cat << EOF
59 @echo "export $OPT_VAR=\"$optVal\"" >> envars
60EOF
61) >> $MKFILE.tmp
62 else
63 continue
64 fi
65 done
66}
67
68#----------------------------------#
69wrt_makeflags() { # Apply MAKEFLAGS to build
70#----------------------------------#
71 local pkg=$1
72 local MKF=$2
73 local NJJ=$3
74
75 if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
76 MKF="-j1"
77 NJJ="1"
78 fi
79
80(
81cat << EOF
82 @echo "export MAKEFLAGS=\"$MKF\"" >> envars
83 @echo "export NINJAJOBS=\"$NJJ\"" >> envars
84EOF
85) >> $MKFILE.tmp
86}
Note: See TracBrowser for help on using the repository browser.