Applied optimization and makeflags patches from Jeremy Byron.
Renamed some files.
This commit is contained in:
parent
708a612891
commit
c205656895
14 changed files with 112 additions and 131 deletions
|
@ -184,7 +184,7 @@ temptools_Makefiles() { #
|
|||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
#
|
||||
wrt_run_as_su "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -256,7 +256,7 @@ boot_Makefiles() { #
|
|||
# Insert instructions for unpacking the package and changing directories
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
#
|
||||
# Select a script execution method
|
||||
case $this_script in
|
||||
|
@ -327,7 +327,7 @@ chroot_Makefiles() { #
|
|||
*util-linux) wrt_unpack "$name-$vrs.tar.*" ;;
|
||||
*) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
#
|
||||
# Select a script execution method
|
||||
|
@ -388,7 +388,7 @@ testsuite_tools_Makefiles() { #
|
|||
tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
||||
*) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
#
|
||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -443,7 +443,7 @@ bm_testsuite_tools_Makefiles() { #
|
|||
tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
||||
*) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
#
|
||||
wrt_run_as_root2 "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -542,7 +542,7 @@ final_system_Makefiles() { #
|
|||
if [ "$vrs" != "" ] ; then
|
||||
FILE="$name-$vrs.tar.*"
|
||||
wrt_unpack2 "$FILE"
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
#
|
||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||
|
@ -645,7 +645,7 @@ bm_final_system_Makefiles() { #
|
|||
if [ "$vrs" != "" ] ; then
|
||||
FILE="$name-$vrs.tar.*"
|
||||
wrt_unpack3 "$FILE"
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
#
|
||||
wrt_run_as_root2 "${this_script}" "${file}"
|
||||
|
|
|
@ -142,7 +142,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
|||
esac
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
wrt_unpack "$FILE"
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
case $this_script in
|
||||
|
@ -309,7 +309,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
|
|||
esac
|
||||
wrt_unpack2 "$FILE"
|
||||
wrt_target_vars
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
case $this_script in
|
||||
|
|
|
@ -112,7 +112,7 @@ chapter5_Makefiles() {
|
|||
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
wrt_unpack "$FILE"
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
# Insert date and disk usage at the top of the log file, the script run
|
||||
|
@ -216,7 +216,7 @@ chapter6_Makefiles() {
|
|||
if [ "$vrs" != "" ] ; then
|
||||
FILE="$name-$vrs.tar.*"
|
||||
wrt_unpack2 "$FILE"
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags
|
||||
[[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
# In the mount of kernel filesystems we need to set LFS
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
MAKEFLAGS="-j3"
|
||||
|
||||
#--- Default optimization mode
|
||||
# This level is overridden by definitions in opt_override;
|
||||
# This mode is overridden by definitions in opt_override;
|
||||
# in this way, packages can be tuned independently. For example,
|
||||
# if you have trouble building a package in mode defOpt, add
|
||||
# the package to opt_override with a different mode.
|
||||
DEF_OPT_LVL=defOpt
|
||||
DEF_OPT_MODE=O3pipe
|
||||
|
||||
|
||||
#--- Active optimization variables
|
||||
|
@ -28,11 +28,12 @@ ACTIVE_OPT_VARS="CFLAGS CXXFLAGS LDFLAGS \
|
|||
|
||||
#--- Load optimization modes
|
||||
# To add modes, create a working template..
|
||||
# cp opt_config.d/defOpt opt_config.d/newMode
|
||||
# cp opt_config.d/O3pipe opt_config.d/newMode
|
||||
# ..and edit it as desired.
|
||||
#
|
||||
# To inherit another mode and add to it, see opt_config.d/defOpt_march
|
||||
# as an example. Given opt_config.d/modeA_modeB_modeC, modeB inherits
|
||||
# To inherit another mode and add to it, see opt_config.d/O3pipe_march
|
||||
# or opt_config.d/defOpt_fPIC as examples for two different ways of
|
||||
# doing it. Given opt_config.d/modeA_modeB_modeC, modeB inherits
|
||||
# the optimizations of modeA by sourcing it, and modeC inherits those
|
||||
# of modeB (which includes those of modeA).
|
||||
#
|
||||
|
|
20
optimize/opt_config.d/O3pipe
Normal file
20
optimize/opt_config.d/O3pipe
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
#$Id$
|
||||
#
|
||||
#####
|
||||
#
|
||||
# MODE O3pipe configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
CFLAGS_O3pipe="-O3 -pipe"
|
||||
CXXFLAGS_O3pipe=$CFLAGS_O3pipe
|
||||
LDFLAGS_O3pipe="unset"
|
||||
|
||||
OTHER_CFLAGS_O3pipe=$CFLAGS_O3pipe
|
||||
OTHER_CXXFLAGS_O3pipe=$CXXFLAGS_O3pipe
|
||||
OTHER_LDFLAGS_O3pipe=$LDFLAGS_O3pipe
|
23
optimize/opt_config.d/O3pipe_march
Normal file
23
optimize/opt_config.d/O3pipe_march
Normal file
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
#$Id$
|
||||
#
|
||||
#####
|
||||
#
|
||||
# MODE O3pipe_march configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
# Inherit optimizations from O3pipe
|
||||
source optimize/opt_config.d/O3pipe
|
||||
|
||||
CFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
||||
CXXFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
||||
LDFLAGS_O3pipe_march=$LDFLAGS_O3pipe
|
||||
|
||||
OTHER_CFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
||||
OTHER_CXXFLAGS_O3pipe_march=$CXXFLAGS_O3pipe" -march=pentium4"
|
||||
OTHER_LDFLAGS_O3pipe_march=$LDFLAGS_O3pipe
|
|
@ -1,56 +0,0 @@
|
|||
#
|
||||
#$Id$
|
||||
#
|
||||
#####
|
||||
#
|
||||
# MODE Zlib configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
# Inherit optimizations from DEF_OPT_LVL
|
||||
source optimize/opt_config.d/$DEF_OPT_LVL
|
||||
|
||||
eval CFLAGS_Zlib_base=\$CFLAGS_${DEF_OPT_LVL}
|
||||
eval CXXFLAGS_Zlib_base=\$CXXFLAGS_${DEF_OPT_LVL}
|
||||
eval LDFLAGS_Zlib_base=\$LDFLAGS_${DEF_OPT_LVL}
|
||||
|
||||
eval OTHER_CFLAGS_Zlib_base=\$CFLAGS_${DEF_OPT_LVL}
|
||||
eval OTHER_CXXFLAGS_Zlib_base=\$OTHER_CXXFLAGS_${DEF_OPT_LVL}
|
||||
eval OTHER_LDFLAGS_Zlib_base=\$OTHER_LDFLAGS_${DEF_OPT_LVL}
|
||||
|
||||
# Set the actual values for Zlib mode
|
||||
if [[ "$CFLAGS_Zlib_base" != "unset" ]]; then
|
||||
CFLAGS_Zlib=$CFLAGS_Zlib_base" -fPIC"
|
||||
else
|
||||
CFLAGS_Zlib="unset"
|
||||
fi
|
||||
if [[ "$CXXFLAGS_Zlib_base" != "unset" ]]; then
|
||||
CXXFLAGS_Zlib=$CXXFLAGS_Zlib_base" -fPIC"
|
||||
else
|
||||
CXXFLAGS_Zlib="unset"
|
||||
fi
|
||||
if [[ "$LDFLAGS_Zlib_base" != "unset" ]]; then
|
||||
LDFLAGS_Zlib=$LDFLAGS_Zlib_base
|
||||
else
|
||||
LDFLAGS_Zlib="unset"
|
||||
fi
|
||||
|
||||
if [[ "$OTHER_CFLAGS_Zlib_base" != "unset" ]]; then
|
||||
OTHER_CFLAGS_Zlib=$OTHER_CFLAGS_Zlib_base" -fPIC"
|
||||
else
|
||||
OTHER_CFLAGS_Zlib="unset"
|
||||
fi
|
||||
if [[ "$OTHER_CXXFLAGS_Zlib_base" != "unset" ]]; then
|
||||
OTHER_CXXFLAGS_Zlib=$OTHER_CXXFLAGS_Zlib_base" -fPIC"
|
||||
else
|
||||
OTHER_CXXFLAGS_Zlib="unset"
|
||||
fi
|
||||
if [[ "$OTHER_LDFLAGS_Zlib_base" != "unset" ]]; then
|
||||
OTHER_LDFLAGS_Zlib=$OTHER_LDFLAGS_Zlib_base
|
||||
else
|
||||
OTHER_LDFLAGS_Zlib="unset"
|
||||
fi
|
|
@ -1,20 +0,0 @@
|
|||
#
|
||||
#$Id$
|
||||
#
|
||||
#####
|
||||
#
|
||||
# MODE defOpt configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
CFLAGS_defOpt="-O3 -pipe"
|
||||
CXXFLAGS_defOpt=$CFLAGS_defOpt
|
||||
LDFLAGS_defOpt="unset"
|
||||
|
||||
OTHER_CFLAGS_defOpt=$CFLAGS_defOpt
|
||||
OTHER_CXXFLAGS_defOpt=$CXXFLAGS_defOpt
|
||||
OTHER_LDFLAGS_defOpt=$LDFLAGS_defOpt
|
28
optimize/opt_config.d/defOpt_fPIC
Normal file
28
optimize/opt_config.d/defOpt_fPIC
Normal file
|
@ -0,0 +1,28 @@
|
|||
#####
|
||||
#
|
||||
# MODE defOpt_fPIC configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
# Inherit optimizations from DEF_OPT_MODE
|
||||
source optimize/opt_config.d/${DEF_OPT_MODE}
|
||||
|
||||
# Append " -fPIC" to default *C{,XX}FLAGS and retain other defaults
|
||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
||||
case $OPT_VAR in
|
||||
CFLAGS | CXXFLAGS | OTHER_CFLAGS | OTHER_CXXFLAGS)
|
||||
if [[ "$(eval "echo \$${OPT_VAR}_${DEF_OPT_MODE}")" != "unset" ]] ; then
|
||||
eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}\" -fPIC\"
|
||||
else
|
||||
eval ${OPT_VAR}_defOpt_fPIC="unset"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}
|
||||
;;
|
||||
esac
|
||||
done
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
#$Id$
|
||||
#
|
||||
#####
|
||||
#
|
||||
# MODE defOpt_march configuration
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
# instead of just set to null.
|
||||
#
|
||||
#####
|
||||
|
||||
# Inherit optimizations from defOpt
|
||||
source optimize/opt_config.d/defOpt
|
||||
|
||||
CFLAGS_defOpt_march=$CFLAGS_defOpt" -march=pentium4"
|
||||
CXXFLAGS_defOpt_march=$CFLAGS_defOpt" -march=pentium4"
|
||||
LDFLAGS_defOpt_march=$LDFLAGS_defOpt
|
||||
|
||||
OTHER_CFLAGS_defOpt_march=$CFLAGS_defOpt" -march=pentium4"
|
||||
OTHER_CXXFLAGS_defOpt_march=$CXXFLAGS_defOpt" -march=pentium4"
|
||||
OTHER_LDFLAGS_defOpt_march=$LDFLAGS_defOpt
|
|
@ -10,7 +10,7 @@
|
|||
# of packages known to have build or runtime failure.
|
||||
#
|
||||
# Also, if you what to use MAKEFLAGS but no build
|
||||
# optimizations, set this mode in DEF_OPT_LVL
|
||||
# optimizations, set this mode in DEF_OPT_MODE
|
||||
#
|
||||
# Usage: - Apply optimization string to each variable
|
||||
# - "unset" will cause the variable to be not set
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#
|
||||
#####
|
||||
#
|
||||
# NOTE: If using this mode in DEF_OPT_LVL (alone or combined with
|
||||
# other mode) please set STRIP=0 in common/config
|
||||
# NOTE: If using this mode in DEF_OPT_MODE (alone or combined with
|
||||
# other modes) please set STRIP=0 in common/config
|
||||
#
|
||||
CFLAGS_noSymbols="-s"
|
||||
CXXFLAGS_noSymbols=$CFLAGS_noSymbols
|
||||
|
|
|
@ -2,4 +2,4 @@ binutils noOpt
|
|||
gcc noOpt
|
||||
glibc noOpt
|
||||
grub noOpt
|
||||
zlib Zlib
|
||||
zlib defOpt_fPIC
|
||||
|
|
|
@ -11,14 +11,14 @@ validate_opt_settings() { # Show optimize setting and wait user agreeme
|
|||
local OPT_VAR optVal
|
||||
|
||||
echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}\n"
|
||||
echo -e "DEF_OPT_LVL: ${L_arrow}${BOLD}${DEF_OPT_LVL}${OFF}${R_arrow}\n"
|
||||
echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
||||
|
||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
||||
eval optVal=\$${OPT_VAR}_${DEF_OPT_LVL}
|
||||
eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
||||
echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
||||
done
|
||||
|
||||
echo -e "\nOverrided packages:"
|
||||
echo -e "\nOverridden packages:"
|
||||
cat optimize/opt_override
|
||||
echo "${nl_}${SD_BORDER}${nl_}"
|
||||
|
||||
|
@ -35,15 +35,15 @@ validate_opt_settings() { # Show optimize setting and wait user agreeme
|
|||
wrt_optimize() { # Apply pkg specific opt's to build
|
||||
#----------------------------------#
|
||||
local pkg=$1
|
||||
local optLvl optVal OPT_VAR
|
||||
local optMode optVal OPT_VAR
|
||||
|
||||
optLvl=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
||||
if [[ "$optLvl" = "" ]] ; then
|
||||
optLvl=$DEF_OPT_LVL;
|
||||
optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
||||
if [[ "$optMode" = "" ]] ; then
|
||||
optMode=$DEF_OPT_MODE;
|
||||
fi
|
||||
|
||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
||||
eval optVal=\$${OPT_VAR}_$optLvl
|
||||
eval optVal=\$${OPT_VAR}_$optMode
|
||||
|
||||
if [[ "$optVal" != "unset" ]]; then
|
||||
(
|
||||
|
@ -60,13 +60,21 @@ EOF
|
|||
#----------------------------------#
|
||||
wrt_makeflags() { # Apply MAKEFLAGS to build
|
||||
#----------------------------------#
|
||||
if [[ "$MAKEFLAGS" != "unset" ]]; then
|
||||
local pkg=$1
|
||||
|
||||
case $pkg in
|
||||
gettext | groff ) # Don't support -jX for now
|
||||
;;
|
||||
*)
|
||||
if [[ "$MAKEFLAGS" != "unset" ]]; then
|
||||
(
|
||||
cat << EOF
|
||||
@echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
else
|
||||
continue
|
||||
fi
|
||||
else
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Reference in a new issue