source: optimize/optimize_functions@ 9ef12f7

ablfs-more legacy trunk
Last change on this file since 9ef12f7 was 9ef12f7, checked in by Pierre Labastie <pierre@…>, 4 years ago

Use a private name for MAKEFLAGS in jhalfs, so that it does not propagate
to top make, when ticking "Run the makefile"

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[1b65a84]1#!/bin/bash
2
3# $Id$
4
5set +e
6
7
8#----------------------------------#
9validate_opt_settings() { # Show optimize setting and wait user agreement
10#----------------------------------#
11 local OPT_VAR optVal
12
13 echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
14 echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
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"
17 echo -e "If there are build issues or the system doesn't work as"
18 echo -e "expected, please rebuild without optimizations before"
19 echo -e "asking for support.${OFF}\n"
20
[9ef12f7]21 echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${JH_MAKEFLAGS}${OFF}${R_arrow}"
22 [ -n "$JH_MAKEFLAGS" ] && \
[1b65a84]23 echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
24
25 echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
26
27 for OPT_VAR in $ACTIVE_OPT_VARS ; do
28 eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
29 echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
30 done
31
32 echo -e "\nOverridden packages:"
33 cat optimize/opt_override
34 echo "${nl_}${SD_BORDER}${nl_}"
35
36 echo -n "Are you happy with these optimization settings? yes/no (no): "
37 read ANSWER
38 if [ x$ANSWER != "xyes" ] ; then
39 echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
[d023a35]40 exit
[1b65a84]41 fi
42 echo "${nl_}${SD_BORDER}${nl_}"
43}
44
45#----------------------------------#
46wrt_optimize() { # Apply pkg specific opt's to build
47#----------------------------------#
48 local pkg=$1
49 local optMode optVal OPT_VAR
50
51 optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
52 if [[ "$optMode" = "" ]] ; then
53 optMode=$DEF_OPT_MODE;
54 fi
55
56 for OPT_VAR in $ACTIVE_OPT_VARS ; do
57 eval optVal=\$${OPT_VAR}_$optMode
58
59 if [[ "$optVal" != "unset" ]]; then
60(
61cat << EOF
62 @echo "export $OPT_VAR=\"$optVal\"" >> envars
63EOF
64) >> $MKFILE.tmp
65 else
66 continue
67 fi
68 done
69}
70
71#----------------------------------#
72wrt_makeflags() { # Apply MAKEFLAGS to build
73#----------------------------------#
74 local pkg=$1
75 local MKF
76
[a96109a]77 if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
[1b65a84]78 MKF=unset
79 else
[9ef12f7]80 MKF=$JH_MAKEFLAGS
[1b65a84]81 fi
82
83 if [[ "$MKF" != "unset" ]]; then
84(
85cat << EOF
[9ef12f7]86 @echo "export MAKEFLAGS=\"$JH_MAKEFLAGS\"" >> envars
[1b65a84]87EOF
88) >> $MKFILE.tmp
89 fi
90}
Note: See TracBrowser for help on using the repository browser.