source: optimize/optimize_functions@ da49058

experimental
Last change on this file since da49058 was d68d2c1, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Allow users to set MAKEFLAGS black-listed packages.

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[2c2471d]1#!/bin/bash
2
3# $Id$
4
5set +e
6
7
[066991c]8#----------------------------------#
9validate_opt_settings() { # Show optimize setting and wait user agreement
10#----------------------------------#
11 local OPT_VAR optVal
12
[01b0e92]13 echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
14 echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
[b5aa524]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"
[73d9790]17 echo -e "If there are build issues or the system doesn't work as"
[01b0e92]18 echo -e "expected, please rebuild without optimizations before"
[73d9790]19 echo -e "asking for support.${OFF}\n"
[01b0e92]20
21 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
[d68d2c1]22 [[ "$MAKEFLAGS" = "unset" ]] && echo
[b5aa524]23 [[ "$MAKEFLAGS" != "unset" ]] && \
[d68d2c1]24 echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
[b5aa524]25
[c205656]26 echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
[066991c]27
28 for OPT_VAR in $ACTIVE_OPT_VARS ; do
[c205656]29 eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
[066991c]30 echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
31 done
32
[c205656]33 echo -e "\nOverridden packages:"
[066991c]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 1
42 fi
43 echo "${nl_}${SD_BORDER}${nl_}"
44}
45
[2c2471d]46#----------------------------------#
47wrt_optimize() { # Apply pkg specific opt's to build
48#----------------------------------#
49 local pkg=$1
[c205656]50 local optMode optVal OPT_VAR
[2c2471d]51
[c205656]52 optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
53 if [[ "$optMode" = "" ]] ; then
54 optMode=$DEF_OPT_MODE;
[2c2471d]55 fi
56
57 for OPT_VAR in $ACTIVE_OPT_VARS ; do
[c205656]58 eval optVal=\$${OPT_VAR}_$optMode
[2c2471d]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
[53bc10b]70}
71
72#----------------------------------#
73wrt_makeflags() { # Apply MAKEFLAGS to build
74#----------------------------------#
[c205656]75 local pkg=$1
[d68d2c1]76 local MKF
[c205656]77
[d68d2c1]78 if [[ "$BLACK_LIST" =~ "$pkg" ]]; then
79 MKF=unset
80 else
81 MKF=$MAKEFLAGS
82 fi
83
84 if [[ "$MKF" != "unset" ]]; then
[53bc10b]85(
86cat << EOF
87 @echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
88EOF
89) >> $MKFILE.tmp
[d68d2c1]90 fi
[53bc10b]91}
Note: See TracBrowser for help on using the repository browser.