2006-05-06 12:35:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
|
|
|
|
2006-05-06 17:52:27 +02:00
|
|
|
#----------------------------------#
|
|
|
|
validate_opt_settings() { # Show optimize setting and wait user agreement
|
|
|
|
#----------------------------------#
|
|
|
|
local OPT_VAR optVal
|
|
|
|
|
2006-05-08 20:55:31 +02:00
|
|
|
echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
|
|
|
|
echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
|
2006-05-08 21:42:27 +02:00
|
|
|
echo -e "You should know what you are doing and be sure that the"
|
|
|
|
echo -e "optimization settings listed below are what you want.\n"
|
2006-05-08 21:12:35 +02:00
|
|
|
echo -e "If there are build issues or the system doesn't work as"
|
2006-05-08 20:55:31 +02:00
|
|
|
echo -e "expected, please rebuild without optimizations before"
|
2006-05-08 21:12:35 +02:00
|
|
|
echo -e "asking for support.${OFF}\n"
|
2006-05-08 20:55:31 +02:00
|
|
|
|
|
|
|
echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
|
2006-05-11 21:15:34 +02:00
|
|
|
[[ "$MAKEFLAGS" = "unset" ]] && echo
|
2006-05-08 21:42:27 +02:00
|
|
|
[[ "$MAKEFLAGS" != "unset" ]] && \
|
2006-05-11 21:15:34 +02:00
|
|
|
echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
|
2006-05-08 21:42:27 +02:00
|
|
|
|
2006-05-08 20:10:58 +02:00
|
|
|
echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
2006-05-06 17:52:27 +02:00
|
|
|
|
|
|
|
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
2006-05-08 20:10:58 +02:00
|
|
|
eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
2006-05-06 17:52:27 +02:00
|
|
|
echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
|
|
|
done
|
|
|
|
|
2006-05-08 20:10:58 +02:00
|
|
|
echo -e "\nOverridden packages:"
|
2006-05-06 17:52:27 +02:00
|
|
|
cat optimize/opt_override
|
|
|
|
echo "${nl_}${SD_BORDER}${nl_}"
|
|
|
|
|
|
|
|
echo -n "Are you happy with these optimization settings? yes/no (no): "
|
|
|
|
read ANSWER
|
|
|
|
if [ x$ANSWER != "xyes" ] ; then
|
|
|
|
echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "${nl_}${SD_BORDER}${nl_}"
|
|
|
|
}
|
|
|
|
|
2006-05-06 12:35:19 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_optimize() { # Apply pkg specific opt's to build
|
|
|
|
#----------------------------------#
|
|
|
|
local pkg=$1
|
2006-05-08 20:10:58 +02:00
|
|
|
local optMode optVal OPT_VAR
|
2006-05-06 12:35:19 +02:00
|
|
|
|
2006-05-08 20:10:58 +02:00
|
|
|
optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
|
|
|
if [[ "$optMode" = "" ]] ; then
|
|
|
|
optMode=$DEF_OPT_MODE;
|
2006-05-06 12:35:19 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
2006-05-08 20:10:58 +02:00
|
|
|
eval optVal=\$${OPT_VAR}_$optMode
|
2006-05-06 12:35:19 +02:00
|
|
|
|
|
|
|
if [[ "$optVal" != "unset" ]]; then
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@echo "export $OPT_VAR=\"$optVal\"" >> envars
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
done
|
2006-05-06 13:06:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_makeflags() { # Apply MAKEFLAGS to build
|
|
|
|
#----------------------------------#
|
2006-05-08 20:10:58 +02:00
|
|
|
local pkg=$1
|
2006-05-11 21:15:34 +02:00
|
|
|
local MKF
|
2006-05-08 20:10:58 +02:00
|
|
|
|
2007-09-19 18:50:48 +02:00
|
|
|
if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
|
2006-05-11 21:15:34 +02:00
|
|
|
MKF=unset
|
|
|
|
else
|
|
|
|
MKF=$MAKEFLAGS
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$MKF" != "unset" ]]; then
|
2006-05-06 13:06:07 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
2006-05-11 21:15:34 +02:00
|
|
|
fi
|
2006-05-06 13:06:07 +02:00
|
|
|
}
|