source: optimize/optimize_functions@ 875366f

ablfs-more trunk
Last change on this file since 875366f was 86debb0, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

optimize_functions: change wrt_makeflags parameters

In order to be able to pass NINJAJOBS=1 when optimize is 0, we
add two paramters to this function. The three parameters are
then:

  • the name of the package (tested against opt_override)
  • MAKEFLAGS for this package
  • NINJAJOBS for this package
  • Property mode set to 100644
File size: 2.3 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 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}"
20 [ -n "$JH_MAKEFLAGS" ] && \
21 echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
22
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
39 fi
40 echo "${nl_}${SD_BORDER}${nl_}"
41}
42
43#----------------------------------#
44wrt_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(
59cat << EOF
60 @echo "export $OPT_VAR=\"$optVal\"" >> envars
61EOF
62) >> $MKFILE.tmp
63 else
64 continue
65 fi
66 done
67}
68
69#----------------------------------#
70wrt_makeflags() { # Apply MAKEFLAGS to build
71#----------------------------------#
72 local pkg=$1
73 local MKF=$2
74 local NJJ=$3
75
76 if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
77 MKF="-j1"
78 NJJ="1"
79 fi
80
81(
82cat << EOF
83 @echo "export MAKEFLAGS=\"$MKF\"" >> envars
84 @echo "export NINJAJOBS=\"$NJJ\"" >> envars
85EOF
86) >> $MKFILE.tmp
87}
Note: See TracBrowser for help on using the repository browser.