[Lunar-commits] Removed all the tabs from the plugins.
Terry Chan
tchan at lunar-linux.org
Mon Dec 10 18:45:26 CET 2007
commit dbf7899f925e73edb5573e3ef84a7300dc55a704
Author: Terry Chan <tchan at lunar-linux.org>
Date: Mon Dec 10 11:45:26 2007 -0600
Removed all the tabs from the plugins.
---
archive/rpmunpack/plugin.d/unpack-rpm.plugin | 32 +-
archive/unzip/plugin.d/unpack-zip.plugin | 32 +-
compilers/gcc/plugin.d/optimize-gcc_4_2.plugin | 960 ++++++++++----------
compilers/gcc2/plugin.d/optimize-gcc_2_95_3.plugin | 440 +++++-----
compilers/gcc3/plugin.d/optimize-gcc_3_4.plugin | 952 ++++++++++----------
devel/binutils/plugin.d/optimize-gnu_ld.plugin | 134 ++--
devel/bzr/plugin.d/download-bzr.plugin | 11 +-
devel/cvs/plugin.d/download-cvs.plugin | 12 +-
devel/git/plugin.d/download-git.plugin | 11 +-
devel/make/plugin.d/optimize-gnu_make.plugin | 94 +-
devel/subversion/plugin.d/download-svn.plugin | 11 +-
distributed/distcc/plugin.d/optimize-distcc.plugin | 140 ++--
libs/gpgme/plugin.d/verify-gpg.plugin | 18 +-
utils/ccache/plugin.d/optimize-ccache.plugin | 104 +--
utils/grub/plugin.d/bootloader-grub.plugin | 241 +++---
utils/lilo/plugin.d/bootloader-lilo.plugin | 213 +++---
utils/lunar-tools/plugin.d/lids.plugin | 44 +-
17 files changed, 1718 insertions(+), 1731 deletions(-)
diff --git a/archive/rpmunpack/plugin.d/unpack-rpm.plugin b/archive/rpmunpack/plugin.d/unpack-rpm.plugin
index d0d9179..054c723 100644
--- a/archive/rpmunpack/plugin.d/unpack-rpm.plugin
+++ b/archive/rpmunpack/plugin.d/unpack-rpm.plugin
@@ -11,22 +11,22 @@
plugin_unpack_rpm() {
- case $1 in
- *.rpm)
- if [ ! -x /usr/bin/rpmunpack ]; then
- message "${PROBLEM_COLOR}! Cannot unpack rpm files without ${MODULE_COLOR}rpmunpack${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
- exit 1
- fi
- debug_msg "Unpacking rpm file \"$1\""
- rpmunpack < $1 | gzip -d | cpio -idm || return 1
- ;;
- *)
- # fallback: we don't know what to do!
- return 2
- ;;
- esac
- # return success!
- return 0
+ case $1 in
+ *.rpm)
+ if [ ! -x /usr/bin/rpmunpack ]; then
+ message "${PROBLEM_COLOR}! Cannot unpack rpm files without ${MODULE_COLOR}rpmunpack${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+ exit 1
+ fi
+ debug_msg "Unpacking rpm file \"$1\""
+ rpmunpack < $1 | gzip -d | cpio -idm || return 1
+ ;;
+ *)
+ # fallback: we don't know what to do!
+ return 2
+ ;;
+ esac
+ # return success!
+ return 0
}
diff --git a/archive/unzip/plugin.d/unpack-zip.plugin b/archive/unzip/plugin.d/unpack-zip.plugin
index fdef219..03b7062 100644
--- a/archive/unzip/plugin.d/unpack-zip.plugin
+++ b/archive/unzip/plugin.d/unpack-zip.plugin
@@ -11,22 +11,22 @@
plugin_unpack_zip() {
- case $1 in
- *.zip)
- if [ ! -x /usr/bin/unzip ]; then
- message "${PROBLEM_COLOR}! Cannot unpack zip-files without ${MODULE_COLOR}unzip${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
- exit 1
- fi
- debug_msg "Unpacking zip file \"$1\""
- unzip -q -o $1 || return 1
- ;;
- *)
- # fallback: we don't know what to do!
- return 2
- ;;
- esac
- # return success!
- return 0
+ case $1 in
+ *.zip)
+ if [ ! -x /usr/bin/unzip ]; then
+ message "${PROBLEM_COLOR}! Cannot unpack zip-files without ${MODULE_COLOR}unzip${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+ exit 1
+ fi
+ debug_msg "Unpacking zip file \"$1\""
+ unzip -q -o $1 || return 1
+ ;;
+ *)
+ # fallback: we don't know what to do!
+ return 2
+ ;;
+ esac
+ # return success!
+ return 0
}
diff --git a/compilers/gcc/plugin.d/optimize-gcc_4_2.plugin b/compilers/gcc/plugin.d/optimize-gcc_4_2.plugin
index c09fd69..8220ab2 100644
--- a/compilers/gcc/plugin.d/optimize-gcc_4_2.plugin
+++ b/compilers/gcc/plugin.d/optimize-gcc_4_2.plugin
@@ -4,171 +4,171 @@
plugin_compiler_gcc_4_2_optimize()
{
- if [ "${LUNAR_COMPILER:-GCC_4_2}" != "GCC_4_2" ]; then
- return 2
- fi
-
- debug_msg "plugin_compiler_gcc_4_2_optimize($@)"
- if [ -f /etc/lunar/local/optimizations.GCC_4_2 ]; then
- . /etc/lunar/local/optimizations.GCC_4_2
- fi
+ if [ "${LUNAR_COMPILER:-GCC_4_2}" != "GCC_4_2" ]; then
+ return 2
+ fi
- # some local macro's
- cflags_add()
- {
- CFLAGS="$CFLAGS $@"
- }
+ debug_msg "plugin_compiler_gcc_4_2_optimize($@)"
+ if [ -f /etc/lunar/local/optimizations.GCC_4_2 ]; then
+ . /etc/lunar/local/optimizations.GCC_4_2
+ fi
- cxxflags_add()
- {
- CXXFLAGS="$CXXFLAGS $@"
- }
+ # some local macro's
+ cflags_add()
+ {
+ CFLAGS="$CFLAGS $@"
+ }
- cppflags_add()
- {
- CPPFLAGS="$CPPFLAGS $@"
- }
-
- c_cxx_flags_add()
- {
- cflags_add $@
- cxxflags_add $@
- }
+ cxxflags_add()
+ {
+ CXXFLAGS="$CXXFLAGS $@"
+ }
- # CFLAGS/CXXFLAGS - base optimization
- case $BOPT in
- None) c_cxx_flags_add "-O0" ;;
- Small) c_cxx_flags_add "-Os" ;;
- Fast) c_cxx_flags_add "-O1" ;;
- Faster) c_cxx_flags_add "-O2" ;;
- Fastest) c_cxx_flags_add "-O3" ;;
- esac
+ cppflags_add()
+ {
+ CPPFLAGS="$CPPFLAGS $@"
+ }
- # CFLAGS -march cpu-specific optimization
- if [ -n "$CPU" ]; then
- c_cxx_flags_add "-march=$CPU"
- fi
+ c_cxx_flags_add()
+ {
+ cflags_add $@
+ cxxflags_add $@
+ }
- # GCC specific extra optimizations
- for SP in ${SPD[@]}; do
- case $SP in
- Speedy) c_cxx_flags_add "-funroll-loops" ;;
- Regparm) c_cxx_flags_add "-mregparm=3" ;;
- Risky) c_cxx_flags_add "-ffast-math" ;;
- Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
- Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
- Profiling)
- c_cxx_flags_add "-fprofile-arcs"
- set_local_config "KEEP_SOURCE" "on"
- ;;
- Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
- Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
- Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
- Float) c_cxx_flags_add "-ffloat-store" ;;
- Address) c_cxx_flags_add "-fforce-addr" ;;
- Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
- Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
- Doubles) c_cxx_flags_add "-malign-double" ;;
- Tracer) c_cxx_flags_add "-ftracer" ;;
- Blocks) c_cxx_flags_add "-freorder-blocks" ;;
- esac
- done
+ # CFLAGS/CXXFLAGS - base optimization
+ case $BOPT in
+ None) c_cxx_flags_add "-O0" ;;
+ Small) c_cxx_flags_add "-Os" ;;
+ Fast) c_cxx_flags_add "-O1" ;;
+ Faster) c_cxx_flags_add "-O2" ;;
+ Fastest) c_cxx_flags_add "-O3" ;;
+ esac
- # STACK - kind of dangerous - shouldn't we just remove this?
- if (( STACK > 0 )) ; then
- c_cxx_flags_add "-mpreferred-stack-boundary=$STACK"
- cppflags_add "-mpreferred-stack-boundary=$STACK"
- fi
+ # CFLAGS -march cpu-specific optimization
+ if [ -n "$CPU" ]; then
+ c_cxx_flags_add "-march=$CPU"
+ fi
- for XTR in ${XTRA[@]}; do
- case $XTR in
- MMX) c_cxx_flags_add "-mmmx" ;;
- SSE) c_cxx_flags_add "-msse" ;;
- SSE2) c_cxx_flags_add "-msse2" ;;
- SSE3) c_cxx_flags_add "-msse3" ;;
- dnow) c_cxx_flags_add "-m3dnow" ;;
- Altivec) c_cxx_flags_add "-maltivec" ;;
- esac
- done
+ # GCC specific extra optimizations
+ for SP in ${SPD[@]}; do
+ case $SP in
+ Speedy) c_cxx_flags_add "-funroll-loops" ;;
+ Regparm) c_cxx_flags_add "-mregparm=3" ;;
+ Risky) c_cxx_flags_add "-ffast-math" ;;
+ Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
+ Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
+ Profiling)
+ c_cxx_flags_add "-fprofile-arcs"
+ set_local_config "KEEP_SOURCE" "on"
+ ;;
+ Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
+ Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
+ Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
+ Float) c_cxx_flags_add "-ffloat-store" ;;
+ Address) c_cxx_flags_add "-fforce-addr" ;;
+ Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
+ Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
+ Doubles) c_cxx_flags_add "-malign-double" ;;
+ Tracer) c_cxx_flags_add "-ftracer" ;;
+ Blocks) c_cxx_flags_add "-freorder-blocks" ;;
+ esac
+ done
- case $FPM in
- x387) c_cxx_flags_add "-mfpmath=387" ;;
- SSE) c_cxx_flags_add "-mfpmath=sse" ;;
- Both) c_cxx_flags_add "-mfpmath=sse,387" ;;
- esac
+ # STACK - kind of dangerous - shouldn't we just remove this?
+ if (( STACK > 0 )) ; then
+ c_cxx_flags_add "-mpreferred-stack-boundary=$STACK"
+ cppflags_add "-mpreferred-stack-boundary=$STACK"
+ fi
- for OPT in ${CC_OPTS[@]}; do
- case $OPT in
- Deprecated)
- cxxflags_add "-Wno-deprecated"
- ;;
- Debug)
- c_cxx_flags_add "-g"
- ;;
- Pipe)
- c_cxx_flags_add "-pipe"
- ;;
- esac
- done
+ for XTR in ${XTRA[@]}; do
+ case $XTR in
+ MMX) c_cxx_flags_add "-mmmx" ;;
+ SSE) c_cxx_flags_add "-msse" ;;
+ SSE2) c_cxx_flags_add "-msse2" ;;
+ SSE3) c_cxx_flags_add "-msse3" ;;
+ dnow) c_cxx_flags_add "-m3dnow" ;;
+ Altivec) c_cxx_flags_add "-maltivec" ;;
+ esac
+ done
- CC=gcc
- CXX=g++
- CPP=cpp
+ case $FPM in
+ x387) c_cxx_flags_add "-mfpmath=387" ;;
+ SSE) c_cxx_flags_add "-mfpmath=sse" ;;
+ Both) c_cxx_flags_add "-mfpmath=sse,387" ;;
+ esac
- export CFLAGS CXXFLAGS CPPFLAGS
- export CC CXX CPP
+ for OPT in ${CC_OPTS[@]}; do
+ case $OPT in
+ Deprecated)
+ cxxflags_add "-Wno-deprecated"
+ ;;
+ Debug)
+ c_cxx_flags_add "-g"
+ ;;
+ Pipe)
+ c_cxx_flags_add "-pipe"
+ ;;
+ esac
+ done
- verbose_msg "CC=\"$CC\""
- verbose_msg "CXX=\"$CXX\""
- verbose_msg "CPP=\"$CPP\""
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
- verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
+ CC=gcc
+ CXX=g++
+ CPP=cpp
- return 2
+ export CFLAGS CXXFLAGS CPPFLAGS
+ export CC CXX CPP
+
+ verbose_msg "CC=\"$CC\""
+ verbose_msg "CXX=\"$CXX\""
+ verbose_msg "CPP=\"$CPP\""
+ verbose_msg "CFLAGS=\"$CFLAGS\""
+ verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
+ verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
+
+ return 2
}
plugin_compiler_gcc_4_2_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the plugin
- # identifier which can be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "GCC_4_2"
- echo "GNU C Compiler suite version 4.2.x"
- return 2
- elif [ "$1" != "GCC_4_2" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the plugin
+ # identifier which can be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "GCC_4_2"
+ echo "GNU C Compiler suite version 4.2.x"
+ return 2
+ elif [ "$1" != "GCC_4_2" ]; then
+ # we don't display anything when the user selected a
+ # different menu
+ return 2
+ fi
- # now we are done with determining if we are really the menu
- # that the user wants - so we can display it
- menu()
- {
- unset RESULT
- if [ "$1" == "checklist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- elif [ "$1" == "radiolist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- fi
- RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
- return 0
- }
+ # now we are done with determining if we are really the menu
+ # that the user wants - so we can display it
+ menu()
+ {
+ unset RESULT
+ if [ "$1" == "checklist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ elif [ "$1" == "radiolist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ fi
+ RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
+ return 0
+ }
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat >/etc/lunar/local/optimizations.GCC_4_2 <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat >/etc/lunar/local/optimizations.GCC_4_2 <<EOF
CPU=$CPU
BOPT=$BOPT
SPD=( $(echo ${SPD[@]} ) )
@@ -177,346 +177,346 @@ FPM=$FPM
CC_OPTS=( $(echo ${CC_OPTS[@]} ) )
STACK=$STACK
EOF
- }
+ }
+
+ if [ -f /etc/lunar/local/optimizations.GCC_4_2 ]; then
+ . /etc/lunar/local/optimizations.GCC_4_2
+ fi
+
+ export IFS=$'\t\n'
+ TITLE="Lunar Compiler Optimizations"
- if [ -f /etc/lunar/local/optimizations.GCC_4_2 ]; then
- . /etc/lunar/local/optimizations.GCC_4_2
- fi
-
- export IFS=$'\t\n'
- TITLE="Lunar Compiler Optimizations"
-
- SAFE_OPTIMIZATIONS=${SAFE_OPTIMIZATIONS:-on}
+ SAFE_OPTIMIZATIONS=${SAFE_OPTIMIZATIONS:-on}
- while true; do
- unset OPTIONS
- IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_4_2" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
- DEFAULT=${CHOICE:-safe}
- CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
- echo "default"
- echo "Set this compiler as default [$IS_DEFAULT]"
- echo "Enables you to substitute the default C compiler"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "safe"
- echo "Turn on optimization safety [$SAFE_OPTIMIZATIONS]"
- echo "Only allow safe optimizations (removes dangerous settings!)"
- else
- echo "safe"
- echo "Turn off optimization safety [$SAFE_OPTIMIZATIONS]"
- echo "Allow potentially unsafe optimizations (DANGEROUS!)"
- fi
- echo "bopt"
- echo "Base speed optimization [$BOPT]"
- echo "Select the base optimization from -Os, -O0, -O1 etc"
- echo "cpu"
- echo "CPU selection [$CPU]"
- echo "Select the target CPU type"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "xtra"
- echo "CPU extensions [${XTRA[@]}]"
- echo "Select CPU extensions"
- echo "spd"
- echo "Specialized optimizations [${SPD[@]}]"
- echo "Select specific compiler flags for expensive and risky optimizations"
- echo "fpm"
- echo "Floating point optimizations [$FPM]"
- echo "enable specific floating point optimizations"
- fi
- echo "cc_opt"
- echo "General C/C++ options [${CC_OPTS[@]}]"
- echo "Select named pipes, warnings on deprecated symbols"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "stack"
- echo "Stack [$STACK]"
- echo "Set the stack size"
- fi) `
- if [ $? != 0 ]; then
- save_optimizations
- set_local_config SAFE_OPTIMIZATIONS $SAFE_OPTIMIZATIONS
- return
- fi
+ while true; do
+ unset OPTIONS
+ IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_4_2" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
+ DEFAULT=${CHOICE:-safe}
+ CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
+ echo "default"
+ echo "Set this compiler as default [$IS_DEFAULT]"
+ echo "Enables you to substitute the default C compiler"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "safe"
+ echo "Turn on optimization safety [$SAFE_OPTIMIZATIONS]"
+ echo "Only allow safe optimizations (removes dangerous settings!)"
+ else
+ echo "safe"
+ echo "Turn off optimization safety [$SAFE_OPTIMIZATIONS]"
+ echo "Allow potentially unsafe optimizations (DANGEROUS!)"
+ fi
+ echo "bopt"
+ echo "Base speed optimization [$BOPT]"
+ echo "Select the base optimization from -Os, -O0, -O1 etc"
+ echo "cpu"
+ echo "CPU selection [$CPU]"
+ echo "Select the target CPU type"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "xtra"
+ echo "CPU extensions [${XTRA[@]}]"
+ echo "Select CPU extensions"
+ echo "spd"
+ echo "Specialized optimizations [${SPD[@]}]"
+ echo "Select specific compiler flags for expensive and risky optimizations"
+ echo "fpm"
+ echo "Floating point optimizations [$FPM]"
+ echo "enable specific floating point optimizations"
+ fi
+ echo "cc_opt"
+ echo "General C/C++ options [${CC_OPTS[@]}]"
+ echo "Select named pipes, warnings on deprecated symbols"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "stack"
+ echo "Stack [$STACK]"
+ echo "Set the stack size"
+ fi) `
+ if [ $? != 0 ]; then
+ save_optimizations
+ set_local_config SAFE_OPTIMIZATIONS $SAFE_OPTIMIZATIONS
+ return
+ fi
- case $CHOICE in
- default)
- if [ "$IS_DEFAULT" != "DEFAULT" ]; then
- set_local_config LUNAR_COMPILER GCC_4_2
- $DIALOG --msgbox "Gcc 4.2 is now the default compiler!" 6 60
- fi
- ;;
- safe)
- if [ "$SAFE_OPTIMIZATIONS" == "off" ]; then
- SAFE_OPTIMIZATIONS=on
- unset SPD XTRA STACK
- FPM=("None")
- BOPT=${BOPT//Fastest/Faster}
- else
- $DIALOG --defaultno --yes-label "No" --no-label "Yes" --colors --yesno " \Z1*** WARNING ***\n\n\ZnPlease read this carefully. You are about to turn off the optimization safety. This means that you can possibly turn on compiler or linker optimizations that can and will break your box. Not only will the problem most likely occur only days, weeks or months after you turn this switch, but also it can corrupt all your personal data, make your machine unbootable, and cause serious personal distress, headache, loss of vision, heart failure, loss of income, or otherwise very bad things. Before you turn off this option, please think for yourself for a minute and ask yourself: Is it worth it?\n\nOnly use safe optimizations?" 20 70
- if [ $? == 0 ]; then
- SAFE_OPTIMIZATIONS=off
- fi
- fi
- ;;
- bopt)
- OPTIONS=(
- "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
- "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
- "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
- "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
- "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
- )
- menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
- BOPT=$RESULT
- ;;
- cpu)
- case $PLATFORM in
- x86)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "i386" "i386" $( [ "$CPU" == "i386" ] && echo "on" || echo "off" ) "i386 processors"
- "i486" "i486" $( [ "$CPU" == "i486" ] && echo "on" || echo "off" ) "i486 processors"
- "i586" "i586 (Pentium)" $( [ "$CPU" == "i586" ] && echo "on" || echo "off" ) "i586 processors, identical to 'pentium'"
- "pentium-mmx" "pentium-mmx" $( [ "$CPU" == "pentium-mmx" ] && echo "on" || echo "off" ) "Pentium processors with mmx"
- "i686" "i686 (PentiumPro)" $( [ "$CPU" == "i686" ] && echo "on" || echo "off" ) "i686 processors, identical to 'pentiumpro'"
- "pentium2" "P2" $( [ "$CPU" == "pentium2" ] && echo "on" || echo "off" ) "Pentium II processors"
- "pentium3" "P3 (Celeron)" $( [ "$CPU" == "pentium3" ] && echo "on" || echo "off" ) "Pentium III processors"
- "pentium3m" "P3 mobile (Celeron)" $( [ "$CPU" == "pentium3m" ] && echo "on" || echo "off" ) "Pentium III Mobile processors"
- "pentium-m" "P3 mobile (Celeron) Low power version" $( [ "$CPU" == "pentium-m" ] && echo "on" || echo "off" ) "Pentium III Mobile processor - low power versions"
- "pentium4" "P4" $( [ "$CPU" == "pentium4" ] && echo "on" || echo "off" ) "Pentium 4 processors"
- "pentium4m" "P4 mobile" $( [ "$CPU" == "pentium4m" ] && echo "on" || echo "off" ) "Pentium 4 mobile processors"
- "prescott" "Xeon" $( [ "$CPU" == "prescott" ] && echo "on" || echo "off" ) "Newer Xeons with sse3"
- "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
- "k6" "k6" $( [ "$CPU" == "k6" ] && echo "on" || echo "off" ) "AMD K6 processors"
- "k6-2" "k6-2" $( [ "$CPU" == "k6-2" ] && echo "on" || echo "off" ) "AMD K6-2 processors"
- "k6-3" "k6-3" $( [ "$CPU" == "k6-3" ] && echo "on" || echo "off" ) "AMD K6-3 processors"
- "athlon" "athlon" $( [ "$CPU" == "athlon" ] && echo "on" || echo "off" ) "AMD Athlon processors"
- "athlon-tbird" "athlon-tbird" $( [ "$CPU" == "athlon-tbird" ] && echo "on" || echo "off" ) "AMD Athlon Thunderbird processors"
- "athlon-4" "athlon-4" $( [ "$CPU" == "athlon-4" ] && echo "on" || echo "off" ) "AMD Athlon 4 processors"
- "athlon-xp" "athlon-xp" $( [ "$CPU" == "athlon-xp" ] && echo "on" || echo "off" ) "AMD Athlon XP processors"
- "athlon-mp" "athlon-mp" $( [ "$CPU" == "athlon-mp" ] && echo "on" || echo "off" ) "AMD athlon MP processors"
- "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
- "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
- "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
- "athlon-fx" "athlon-fx" $( [ "$CPU" == "athlon-fx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
- "winchip-c6" "winchip-c6" $( [ "$CPU" == "winchip-c6" ] && echo "on" || echo "off" ) "IDT Winchip C6 CPU (a 486)"
- "winchip2" "winchip2" $( [ "$CPU" == "winchip2" ] && echo "on" || echo "off" ) "IDT Winchip2 CPU (a 486)"
- "c3" "c3" $( [ "$CPU" == "c3" ] && echo "on" || echo "off" ) "Via C3 CPU with MMX and 3dNOW"
- "c3-2" "c3-2" $( [ "$CPU" == "c3-2" ] && echo "on" || echo "off" ) "Via C3-2 CPU with MMX and SSE"
- )
- ;;
- Alpha)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "ev4" "ev4" $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" ) "Alpha EV4 (21064)"
- "ev45" "ev45" $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" ) "Alpha EV45 (21064a)"
- "ev5" "ev5" $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" ) "Alpha EV5 (21164)"
- "ev56" "ev56" $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" ) "Alpha EV56 (21164a)"
- "pca56" "pca56" $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" ) "Alpha pca56 (21164PC)"
- "ev6" "ev6" $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" ) "Alpha EV6 (21264)"
- "ev67" "ev67" $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" ) "Alpha EV67 (21264a)"
- "ev68" "ev68" $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" ) "Alpha EV68 (21264b)"
- )
- ;;
- PowerPC)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "common" "common" $( [ "$CPU" == "common" ] && echo "on" || echo "off" ) "Common PowerPC"
- "rios" "rios" $( [ "$CPU" == "rios" ] && echo "on" || echo "off" ) "Rios PowerPC"
- "rios1" "rios1" $( [ "$CPU" == "rios1" ] && echo "on" || echo "off" ) "Rios1 PowerPC"
- "rsc" "rsc" $( [ "$CPU" == "rsc" ] && echo "on" || echo "off" ) "RSC PowerPC"
- "rios2" "rios2" $( [ "$CPU" == "rios2" ] && echo "on" || echo "off" ) "Rios2 PowerPC"
- "rs64a" "rs64a" $( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" ) "RS64a PowerPC"
- "403" "403" $( [ "$CPU" == "403" ] && echo "on" || echo "off" ) "403 PowerPC"
- "505" "505" $( [ "$CPU" == "505" ] && echo "on" || echo "off" ) "505 PowerPC"
- "601" "601" $( [ "$CPU" == "601" ] && echo "on" || echo "off" ) "601 PowerPC"
- "602" "602" $( [ "$CPU" == "602" ] && echo "on" || echo "off" ) "602 PowerPC"
- "603" "603" $( [ "$CPU" == "603" ] && echo "on" || echo "off" ) "603 PowerPC"
- "603a" "603a" $( [ "$CPU" == "603a" ] && echo "on" || echo "off" ) "603a PowerPC"
- "604" "604" $( [ "$CPU" == "604" ] && echo "on" || echo "off" ) "604 PowerPC"
- "604e" "604e" $( [ "$CPU" == "604e" ] && echo "on" || echo "off" ) "604e PowerPC"
- "620" "620" $( [ "$CPU" == "620" ] && echo "on" || echo "off" ) "620 PowerPC"
- "630" "630" $( [ "$CPU" == "630" ] && echo "on" || echo "off" ) "630 PowerPC"
- "740" "740" $( [ "$CPU" == "740" ] && echo "on" || echo "off" ) "740 PowerPC"
- "7400" "7400" $( [ "$CPU" == "7400" ] && echo "on" || echo "off" ) "7400 PowerPC"
- "7450" "7450" $( [ "$CPU" == "7450" ] && echo "on" || echo "off" ) "7450 PowerPC"
- "750" "750" $( [ "$CPU" == "750" ] && echo "on" || echo "off" ) "750 PowerPC"
- "801" "801" $( [ "$CPU" == "801" ] && echo "on" || echo "off" ) "801 PowerPC"
- "821" "821" $( [ "$CPU" == "821" ] && echo "on" || echo "off" ) "821 PowerPC"
- "823" "823" $( [ "$CPU" == "823" ] && echo "on" || echo "off" ) "823 PowerPC"
- "Power" "Power" $( [ "$CPU" == "Power" ] && echo "on" || echo "off" ) "Power PowerPC"
- "Power2" "Power2" $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" ) "Power2 PowerPC"
- "PowerPC" "PowerPC" $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "IBM and Apple hardware (Power and PowerPC)"
- )
- ;;
- SPARC)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "v7" "v7" $( [ "$CPU" == "v7" ] && echo "on" || echo "off" ) "V7 SPARC"
- "cypress" "cypress" $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" ) "Cypress SPARC"
- "v8" "v8" $( [ "$CPU" == "v8" ] && echo "on" || echo "off" ) "V8 SPARC"
- "supersparc" "supersparc" $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" ) "SuperSPARC"
- "sparclite" "sparclite" $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" ) "SPARCLite"
- "hypersparc" "hypersparc" $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" ) "HyperSPARC"
- "sparclite86x" "sparclite86x" $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "SPARCLite86x"
- "f930" "f930" $( [ "$CPU" == "f930" ] && echo "on" || echo "off" ) "f930 SPARC"
- "f934" "f934" $( [ "$CPU" == "f934" ] && echo "on" || echo "off" ) "f934 SPARC"
- "sparclet" "sparclet" $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" ) "SPARCLet"
- "tsc701" "tsc701" $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" ) "tsc701"
- "v9" "v9" $( [ "$CPU" == "v9" ] && echo "on" || echo "off" ) "V9 SPARC"
- "ultrasparc" "ultrasparc" $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" ) "ULTRASPARC"
- )
- ;;
- x86_64)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "x86-64" "x86-64" $( [ "$CPU" == "x86-64" ] && echo "on" || echo "off" ) "Both AMD64 and Intel EM64T machines"
- "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
- "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
- "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
- "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
- "athlon-fx" "athlon-fx" $( [ "$CPU" == "athlon-fx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
- )
- ;;
- esac
- menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1). If you are unsure, use $(arch) - anything higher is not safe." &&
- CPU=$RESULT
- ;;
- spd)
- OPTIONS=(
- "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
- "Regparm" "-mregparm=3" $( echo ${SPD[@]} | grep -q "Regparm" && echo "on" || echo "off" ) "Pass up to 3 function arguments in registers instead of stack"
- "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
- "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
- "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
- "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
- "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
- "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
- "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
- "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
- "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
- "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
- "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
- "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
- "Tracer" "-ftracer" $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" ) "Perform tail duplication to enlarge superblock size."
- "Blocks" "-freorder-blocks" $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" ) "Reorder basic blocks in order to reduce number of taken branches."
- )
- menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information. None of these options are safe!" &&
- SPD=($RESULT)
- ;;
- fpm)
- OPTIONS=(
- "None" "Use compiler default" $([ "$FPM" == "None" ] && echo "on" || echo "off" ) "Use compiler default"
- )
- case $PLATFORM in
- x86|x86_64)
- if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
- OPTIONS=(
- ${OPTIONS[@]}
- "x387" "Floating point coprocessor" $([ "$FPM" == "x387" ] && echo "on" || echo "off" ) "Classic 387 or higher Floating Point Co-Processor"
- )
- fi
- if grep -qw sse /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE" "Streaming SIMD Extensions" $([ "$FPM" == "SSE" ] && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data)"
- )
- fi
- if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
- OPTIONS=(
- ${OPTIONS[@]}
- "Both" "x387 and SSE" $([ "$FPM" == "Both" ] && echo "on" || echo "off" ) "Both SSE and 387"
- )
- fi
- ;;
- PowerPC)
- if grep -qw altivec /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "Altivec" "PowerPC only" $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" ) "Altivec"
- )
- fi
- ;;
- esac
- unset FLAGS
- for EXT in fpu sse altivec ; do
- if grep -qw "$EXT" /proc/cpuinfo ; then
- FLAGS="$FLAGS $EXT"
- fi
- done
- FLAGS=${FLAGS/fpu/387}
- FLAGS=${FLAGS/387 sse/387 and sse (both)}
- menu radiolist "Select available Floating Point Math compile extensions. The kernel reports that this system has: $FLAGS. None of these are safe." &&
- FPM=$RESULT
- ;;
- xtra)
- unset OPTIONS
- case $PLATFORM in
- x86|x86_64)
- if grep -qw mmx /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "MMX" "MMX" $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" ) "Multi-Media instruction code eXtensions"
- )
- fi
- if grep -qw sse /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE" "SSE" $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions"
- )
- fi
- if grep -qw sse2 /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE2" "SSE2" $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v2"
- )
- fi
- if grep -qw pni /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE3" "SSE3" $( echo ${XTRA[@]} | grep -q "SSE3" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v3"
- )
- fi
- if grep -qw 3dnow /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "dnow" "3dnow" $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" ) "3dnow"
- )
- fi
- ;;
- PowerPC)
- if grep -qw altivec /proc/cpuinfo; then
- OPTIONS=(
- "Altivec" "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" ) "Altivec"
- )
- fi
- ;;
- esac
- unset FLAGS
- for EXT in mmx sse sse2 pni 3dnow altivec ; do
- if grep -qw "$EXT" /proc/cpuinfo ; then
- echo $EXT
- FLAGS="$FLAGS $EXT"
- fi
- done
- FLAGS=${FLAGS/pni/sse3}
- menu checklist "Select compiler use of extra instruction sets. The kernel reports that this system has: $FLAGS. None of these are safe." &&
- XTRA=($RESULT)
- ;;
- cc_opt)
- OPTIONS=(
- "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -qw "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
- "Debug" "-g" $( echo ${CC_OPTS[@]} | grep -qw "Debug" && echo "on" || echo "off" ) "Add debug symbols"
- "Pipe" "-pipe (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -qw "Pipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
- )
- menu checklist "General C/C++ compiler settings" &&
- CC_OPTS=($RESULT)
- ;;
- stack)
- STACK=`$DIALOG --nocancel --inputbox "Enter the number to set the stack to, leave empty for default. Only used on x86 platform. Not safe" 0 55 $STACK`
- ;;
- esac
- done
+ case $CHOICE in
+ default)
+ if [ "$IS_DEFAULT" != "DEFAULT" ]; then
+ set_local_config LUNAR_COMPILER GCC_4_2
+ $DIALOG --msgbox "Gcc 4.2 is now the default compiler!" 6 60
+ fi
+ ;;
+ safe)
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ]; then
+ SAFE_OPTIMIZATIONS=on
+ unset SPD XTRA STACK
+ FPM=("None")
+ BOPT=${BOPT//Fastest/Faster}
+ else
+ $DIALOG --defaultno --yes-label "No" --no-label "Yes" --colors --yesno " \Z1*** WARNING ***\n\n\ZnPlease read this carefully. You are about to turn off the optimization safety. This means that you can possibly turn on compiler or linker optimizations that can and will break your box. Not only will the problem most likely occur only days, weeks or months after you turn this switch, but also it can corrupt all your personal data, make your machine unbootable, and cause serious personal distress, headache, loss of vision, heart failure, loss of income, or otherwise very bad things. Before you turn off this option, please think for yourself for a minute and ask yourself: Is it worth it?\n\nOnly use safe optimizations?" 20 70
+ if [ $? == 0 ]; then
+ SAFE_OPTIMIZATIONS=off
+ fi
+ fi
+ ;;
+ bopt)
+ OPTIONS=(
+ "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
+ "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
+ "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
+ "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
+ "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
+ )
+ menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
+ BOPT=$RESULT
+ ;;
+ cpu)
+ case $PLATFORM in
+ x86)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "i386" "i386" $( [ "$CPU" == "i386" ] && echo "on" || echo "off" ) "i386 processors"
+ "i486" "i486" $( [ "$CPU" == "i486" ] && echo "on" || echo "off" ) "i486 processors"
+ "i586" "i586 (Pentium)" $( [ "$CPU" == "i586" ] && echo "on" || echo "off" ) "i586 processors, identical to 'pentium'"
+ "pentium-mmx" "pentium-mmx" $( [ "$CPU" == "pentium-mmx" ] && echo "on" || echo "off" ) "Pentium processors with mmx"
+ "i686" "i686 (PentiumPro)" $( [ "$CPU" == "i686" ] && echo "on" || echo "off" ) "i686 processors, identical to 'pentiumpro'"
+ "pentium2" "P2" $( [ "$CPU" == "pentium2" ] && echo "on" || echo "off" ) "Pentium II processors"
+ "pentium3" "P3 (Celeron)" $( [ "$CPU" == "pentium3" ] && echo "on" || echo "off" ) "Pentium III processors"
+ "pentium3m" "P3 mobile (Celeron)" $( [ "$CPU" == "pentium3m" ] && echo "on" || echo "off" ) "Pentium III Mobile processors"
+ "pentium-m" "P3 mobile (Celeron) Low power version" $( [ "$CPU" == "pentium-m" ] && echo "on" || echo "off" ) "Pentium III Mobile processor - low power versions"
+ "pentium4" "P4" $( [ "$CPU" == "pentium4" ] && echo "on" || echo "off" ) "Pentium 4 processors"
+ "pentium4m" "P4 mobile" $( [ "$CPU" == "pentium4m" ] && echo "on" || echo "off" ) "Pentium 4 mobile processors"
+ "prescott" "Xeon" $( [ "$CPU" == "prescott" ] && echo "on" || echo "off" ) "Newer Xeons with sse3"
+ "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
+ "k6" "k6" $( [ "$CPU" == "k6" ] && echo "on" || echo "off" ) "AMD K6 processors"
+ "k6-2" "k6-2" $( [ "$CPU" == "k6-2" ] && echo "on" || echo "off" ) "AMD K6-2 processors"
+ "k6-3" "k6-3" $( [ "$CPU" == "k6-3" ] && echo "on" || echo "off" ) "AMD K6-3 processors"
+ "athlon" "athlon" $( [ "$CPU" == "athlon" ] && echo "on" || echo "off" ) "AMD Athlon processors"
+ "athlon-tbird" "athlon-tbird" $( [ "$CPU" == "athlon-tbird" ] && echo "on" || echo "off" ) "AMD Athlon Thunderbird processors"
+ "athlon-4" "athlon-4" $( [ "$CPU" == "athlon-4" ] && echo "on" || echo "off" ) "AMD Athlon 4 processors"
+ "athlon-xp" "athlon-xp" $( [ "$CPU" == "athlon-xp" ] && echo "on" || echo "off" ) "AMD Athlon XP processors"
+ "athlon-mp" "athlon-mp" $( [ "$CPU" == "athlon-mp" ] && echo "on" || echo "off" ) "AMD athlon MP processors"
+ "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
+ "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
+ "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
+ "athlon-fx" "athlon-fx" $( [ "$CPU" == "athlon-fx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
+ "winchip-c6" "winchip-c6" $( [ "$CPU" == "winchip-c6" ] && echo "on" || echo "off" ) "IDT Winchip C6 CPU (a 486)"
+ "winchip2" "winchip2" $( [ "$CPU" == "winchip2" ] && echo "on" || echo "off" ) "IDT Winchip2 CPU (a 486)"
+ "c3" "c3" $( [ "$CPU" == "c3" ] && echo "on" || echo "off" ) "Via C3 CPU with MMX and 3dNOW"
+ "c3-2" "c3-2" $( [ "$CPU" == "c3-2" ] && echo "on" || echo "off" ) "Via C3-2 CPU with MMX and SSE"
+ )
+ ;;
+ Alpha)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "ev4" "ev4" $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" ) "Alpha EV4 (21064)"
+ "ev45" "ev45" $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" ) "Alpha EV45 (21064a)"
+ "ev5" "ev5" $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" ) "Alpha EV5 (21164)"
+ "ev56" "ev56" $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" ) "Alpha EV56 (21164a)"
+ "pca56" "pca56" $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" ) "Alpha pca56 (21164PC)"
+ "ev6" "ev6" $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" ) "Alpha EV6 (21264)"
+ "ev67" "ev67" $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" ) "Alpha EV67 (21264a)"
+ "ev68" "ev68" $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" ) "Alpha EV68 (21264b)"
+ )
+ ;;
+ PowerPC)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "common" "common" $( [ "$CPU" == "common" ] && echo "on" || echo "off" ) "Common PowerPC"
+ "rios" "rios" $( [ "$CPU" == "rios" ] && echo "on" || echo "off" ) "Rios PowerPC"
+ "rios1" "rios1" $( [ "$CPU" == "rios1" ] && echo "on" || echo "off" ) "Rios1 PowerPC"
+ "rsc" "rsc" $( [ "$CPU" == "rsc" ] && echo "on" || echo "off" ) "RSC PowerPC"
+ "rios2" "rios2" $( [ "$CPU" == "rios2" ] && echo "on" || echo "off" ) "Rios2 PowerPC"
+ "rs64a" "rs64a" $( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" ) "RS64a PowerPC"
+ "403" "403" $( [ "$CPU" == "403" ] && echo "on" || echo "off" ) "403 PowerPC"
+ "505" "505" $( [ "$CPU" == "505" ] && echo "on" || echo "off" ) "505 PowerPC"
+ "601" "601" $( [ "$CPU" == "601" ] && echo "on" || echo "off" ) "601 PowerPC"
+ "602" "602" $( [ "$CPU" == "602" ] && echo "on" || echo "off" ) "602 PowerPC"
+ "603" "603" $( [ "$CPU" == "603" ] && echo "on" || echo "off" ) "603 PowerPC"
+ "603a" "603a" $( [ "$CPU" == "603a" ] && echo "on" || echo "off" ) "603a PowerPC"
+ "604" "604" $( [ "$CPU" == "604" ] && echo "on" || echo "off" ) "604 PowerPC"
+ "604e" "604e" $( [ "$CPU" == "604e" ] && echo "on" || echo "off" ) "604e PowerPC"
+ "620" "620" $( [ "$CPU" == "620" ] && echo "on" || echo "off" ) "620 PowerPC"
+ "630" "630" $( [ "$CPU" == "630" ] && echo "on" || echo "off" ) "630 PowerPC"
+ "740" "740" $( [ "$CPU" == "740" ] && echo "on" || echo "off" ) "740 PowerPC"
+ "7400" "7400" $( [ "$CPU" == "7400" ] && echo "on" || echo "off" ) "7400 PowerPC"
+ "7450" "7450" $( [ "$CPU" == "7450" ] && echo "on" || echo "off" ) "7450 PowerPC"
+ "750" "750" $( [ "$CPU" == "750" ] && echo "on" || echo "off" ) "750 PowerPC"
+ "801" "801" $( [ "$CPU" == "801" ] && echo "on" || echo "off" ) "801 PowerPC"
+ "821" "821" $( [ "$CPU" == "821" ] && echo "on" || echo "off" ) "821 PowerPC"
+ "823" "823" $( [ "$CPU" == "823" ] && echo "on" || echo "off" ) "823 PowerPC"
+ "Power" "Power" $( [ "$CPU" == "Power" ] && echo "on" || echo "off" ) "Power PowerPC"
+ "Power2" "Power2" $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" ) "Power2 PowerPC"
+ "PowerPC" "PowerPC" $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "IBM and Apple hardware (Power and PowerPC)"
+ )
+ ;;
+ SPARC)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "v7" "v7" $( [ "$CPU" == "v7" ] && echo "on" || echo "off" ) "V7 SPARC"
+ "cypress" "cypress" $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" ) "Cypress SPARC"
+ "v8" "v8" $( [ "$CPU" == "v8" ] && echo "on" || echo "off" ) "V8 SPARC"
+ "supersparc" "supersparc" $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" ) "SuperSPARC"
+ "sparclite" "sparclite" $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" ) "SPARCLite"
+ "hypersparc" "hypersparc" $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" ) "HyperSPARC"
+ "sparclite86x" "sparclite86x" $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "SPARCLite86x"
+ "f930" "f930" $( [ "$CPU" == "f930" ] && echo "on" || echo "off" ) "f930 SPARC"
+ "f934" "f934" $( [ "$CPU" == "f934" ] && echo "on" || echo "off" ) "f934 SPARC"
+ "sparclet" "sparclet" $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" ) "SPARCLet"
+ "tsc701" "tsc701" $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" ) "tsc701"
+ "v9" "v9" $( [ "$CPU" == "v9" ] && echo "on" || echo "off" ) "V9 SPARC"
+ "ultrasparc" "ultrasparc" $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" ) "ULTRASPARC"
+ )
+ ;;
+ x86_64)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "x86-64" "x86-64" $( [ "$CPU" == "x86-64" ] && echo "on" || echo "off" ) "Both AMD64 and Intel EM64T machines"
+ "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
+ "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
+ "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
+ "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
+ "athlon-fx" "athlon-fx" $( [ "$CPU" == "athlon-fx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
+ )
+ ;;
+ esac
+ menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1). If you are unsure, use $(arch) - anything higher is not safe." &&
+ CPU=$RESULT
+ ;;
+ spd)
+ OPTIONS=(
+ "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
+ "Regparm" "-mregparm=3" $( echo ${SPD[@]} | grep -q "Regparm" && echo "on" || echo "off" ) "Pass up to 3 function arguments in registers instead of stack"
+ "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
+ "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
+ "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
+ "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
+ "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
+ "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
+ "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
+ "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
+ "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
+ "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
+ "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
+ "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
+ "Tracer" "-ftracer" $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" ) "Perform tail duplication to enlarge superblock size."
+ "Blocks" "-freorder-blocks" $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" ) "Reorder basic blocks in order to reduce number of taken branches."
+ )
+ menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information. None of these options are safe!" &&
+ SPD=($RESULT)
+ ;;
+ fpm)
+ OPTIONS=(
+ "None" "Use compiler default" $([ "$FPM" == "None" ] && echo "on" || echo "off" ) "Use compiler default"
+ )
+ case $PLATFORM in
+ x86|x86_64)
+ if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "x387" "Floating point coprocessor" $([ "$FPM" == "x387" ] && echo "on" || echo "off" ) "Classic 387 or higher Floating Point Co-Processor"
+ )
+ fi
+ if grep -qw sse /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE" "Streaming SIMD Extensions" $([ "$FPM" == "SSE" ] && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data)"
+ )
+ fi
+ if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "Both" "x387 and SSE" $([ "$FPM" == "Both" ] && echo "on" || echo "off" ) "Both SSE and 387"
+ )
+ fi
+ ;;
+ PowerPC)
+ if grep -qw altivec /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "Altivec" "PowerPC only" $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" ) "Altivec"
+ )
+ fi
+ ;;
+ esac
+ unset FLAGS
+ for EXT in fpu sse altivec ; do
+ if grep -qw "$EXT" /proc/cpuinfo ; then
+ FLAGS="$FLAGS $EXT"
+ fi
+ done
+ FLAGS=${FLAGS/fpu/387}
+ FLAGS=${FLAGS/387 sse/387 and sse (both)}
+ menu radiolist "Select available Floating Point Math compile extensions. The kernel reports that this system has: $FLAGS. None of these are safe." &&
+ FPM=$RESULT
+ ;;
+ xtra)
+ unset OPTIONS
+ case $PLATFORM in
+ x86|x86_64)
+ if grep -qw mmx /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "MMX" "MMX" $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" ) "Multi-Media instruction code eXtensions"
+ )
+ fi
+ if grep -qw sse /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE" "SSE" $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions"
+ )
+ fi
+ if grep -qw sse2 /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE2" "SSE2" $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v2"
+ )
+ fi
+ if grep -qw pni /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE3" "SSE3" $( echo ${XTRA[@]} | grep -q "SSE3" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v3"
+ )
+ fi
+ if grep -qw 3dnow /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "dnow" "3dnow" $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" ) "3dnow"
+ )
+ fi
+ ;;
+ PowerPC)
+ if grep -qw altivec /proc/cpuinfo; then
+ OPTIONS=(
+ "Altivec" "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" ) "Altivec"
+ )
+ fi
+ ;;
+ esac
+ unset FLAGS
+ for EXT in mmx sse sse2 pni 3dnow altivec ; do
+ if grep -qw "$EXT" /proc/cpuinfo ; then
+ echo $EXT
+ FLAGS="$FLAGS $EXT"
+ fi
+ done
+ FLAGS=${FLAGS/pni/sse3}
+ menu checklist "Select compiler use of extra instruction sets. The kernel reports that this system has: $FLAGS. None of these are safe." &&
+ XTRA=($RESULT)
+ ;;
+ cc_opt)
+ OPTIONS=(
+ "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -qw "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
+ "Debug" "-g" $( echo ${CC_OPTS[@]} | grep -qw "Debug" && echo "on" || echo "off" ) "Add debug symbols"
+ "Pipe" "-pipe (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -qw "Pipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
+ )
+ menu checklist "General C/C++ compiler settings" &&
+ CC_OPTS=($RESULT)
+ ;;
+ stack)
+ STACK=`$DIALOG --nocancel --inputbox "Enter the number to set the stack to, leave empty for default. Only used on x86 platform. Not safe" 0 55 $STACK`
+ ;;
+ esac
+ done
- save_optimizations
+ save_optimizations
}
diff --git a/compilers/gcc2/plugin.d/optimize-gcc_2_95_3.plugin b/compilers/gcc2/plugin.d/optimize-gcc_2_95_3.plugin
index f717e15..4acd6d4 100644
--- a/compilers/gcc2/plugin.d/optimize-gcc_2_95_3.plugin
+++ b/compilers/gcc2/plugin.d/optimize-gcc_2_95_3.plugin
@@ -4,254 +4,254 @@
plugin_compiler_gcc_2_95_3_optimize()
{
- if [ "$LUNAR_COMPILER" != "GCC_2_95_3" ]; then
- return 2
- fi
-
- debug_msg "plugin_compiler_gcc_2_95_3_optimize($@)"
- if [ -f /etc/lunar/local/optimizations.GCC_2_95_3 ]; then
- . /etc/lunar/local/optimizations.GCC_2_95_3
- fi
+ if [ "$LUNAR_COMPILER" != "GCC_2_95_3" ]; then
+ return 2
+ fi
- # some local macro's
- cflags_add()
- {
- CFLAGS="$CFLAGS $@"
- }
+ debug_msg "plugin_compiler_gcc_2_95_3_optimize($@)"
+ if [ -f /etc/lunar/local/optimizations.GCC_2_95_3 ]; then
+ . /etc/lunar/local/optimizations.GCC_2_95_3
+ fi
- cxxflags_add()
- {
- CXXFLAGS="$CXXFLAGS $@"
- }
+ # some local macro's
+ cflags_add()
+ {
+ CFLAGS="$CFLAGS $@"
+ }
- cppflags_add()
- {
- CPPFLAGS="$CPPFLAGS $@"
- }
-
- c_cxx_flags_add()
- {
- cflags_add $@
- cxxflags_add $@
- }
+ cxxflags_add()
+ {
+ CXXFLAGS="$CXXFLAGS $@"
+ }
- # CFLAGS/CXXFLAGS - base optimization
- case $BOPT in
- None) c_cxx_flags_add "-O0" ;;
- Small) c_cxx_flags_add "-Os" ;;
- Fast) c_cxx_flags_add "-O1" ;;
- Faster) c_cxx_flags_add "-O2" ;;
- Fastest) c_cxx_flags_add "-O3" ;;
- esac
+ cppflags_add()
+ {
+ CPPFLAGS="$CPPFLAGS $@"
+ }
- # CFLAGS -march cpu-specific optimization
- if [ -n "$CPU" ]; then
- c_cxx_flags_add "-m$CPU"
- fi
+ c_cxx_flags_add()
+ {
+ cflags_add $@
+ cxxflags_add $@
+ }
- # GCC specific extra optimizations
- for SP in ${SPD[@]}; do
- case $SP in
- Speedy) c_cxx_flags_add "-funroll-loops" ;;
- Risky) c_cxx_flags_add "-ffast-math" ;;
- Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
- Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
- Profiling)
- c_cxx_flags_add "-fprofile-arcs"
- set_local_config "KEEP_SOURCE" "on"
- ;;
- Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
- Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
- Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
- Float) c_cxx_flags_add "-ffloat-store" ;;
- Address) c_cxx_flags_add "-fforce-addr" ;;
- Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
- Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
- Doubles) c_cxx_flags_add "-malign-double" ;;
- Tracer) c_cxx_flags_add "-ftracer" ;;
- Blocks) c_cxx_flags_add "-freorder-blocks" ;;
- esac
- done
+ # CFLAGS/CXXFLAGS - base optimization
+ case $BOPT in
+ None) c_cxx_flags_add "-O0" ;;
+ Small) c_cxx_flags_add "-Os" ;;
+ Fast) c_cxx_flags_add "-O1" ;;
+ Faster) c_cxx_flags_add "-O2" ;;
+ Fastest) c_cxx_flags_add "-O3" ;;
+ esac
+
+ # CFLAGS -march cpu-specific optimization
+ if [ -n "$CPU" ]; then
+ c_cxx_flags_add "-m$CPU"
+ fi
+
+ # GCC specific extra optimizations
+ for SP in ${SPD[@]}; do
+ case $SP in
+ Speedy) c_cxx_flags_add "-funroll-loops" ;;
+ Risky) c_cxx_flags_add "-ffast-math" ;;
+ Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
+ Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
+ Profiling)
+ c_cxx_flags_add "-fprofile-arcs"
+ set_local_config "KEEP_SOURCE" "on"
+ ;;
+ Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
+ Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
+ Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
+ Float) c_cxx_flags_add "-ffloat-store" ;;
+ Address) c_cxx_flags_add "-fforce-addr" ;;
+ Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
+ Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
+ Doubles) c_cxx_flags_add "-malign-double" ;;
+ Tracer) c_cxx_flags_add "-ftracer" ;;
+ Blocks) c_cxx_flags_add "-freorder-blocks" ;;
+ esac
+ done
- for OPT in ${CC_OPTS[@]}; do
- case $OPT in
- Deprecated)
- cflags_add "-Wno-deprecated"
- cppflags_add "-Wno-deprecated"
- ;;
- ccpipe)
- COPT="$COPT -pipe"
- ;;
- cxxpipe)
- CCOPT="$CCOPT -pipe"
- ;;
- esac
- done
+ for OPT in ${CC_OPTS[@]}; do
+ case $OPT in
+ Deprecated)
+ cflags_add "-Wno-deprecated"
+ cppflags_add "-Wno-deprecated"
+ ;;
+ ccpipe)
+ COPT="$COPT -pipe"
+ ;;
+ cxxpipe)
+ CCOPT="$CCOPT -pipe"
+ ;;
+ esac
+ done
- export COMPILER_PATH=/opt/lunar/gcc/2.95/bin
+ export COMPILER_PATH=/opt/lunar/gcc/2.95/bin
- CC=gcc
- CXX=g++
- CPP=cpp
+ CC=gcc
+ CXX=g++
+ CPP=cpp
- export COPT CCOPT
- export CFLAGS CXXFLAGS CPPFLAGS
- export CC CXX CPP
+ export COPT CCOPT
+ export CFLAGS CXXFLAGS CPPFLAGS
+ export CC CXX CPP
- verbose_msg "CC=\"$CC\""
- verbose_msg "CXX=\"$CXX\""
- verbose_msg "CPP=\"$CPP\""
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
- verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
+ verbose_msg "CC=\"$CC\""
+ verbose_msg "CXX=\"$CXX\""
+ verbose_msg "CPP=\"$CPP\""
+ verbose_msg "CFLAGS=\"$CFLAGS\""
+ verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
+ verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
- return 2
+ return 2
}
plugin_compiler_gcc_2_95_3_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the plugin
- # identifier which can be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "GCC_2_95_3"
- echo "GNU C Compiler suite version 2.95.x"
- return 2
- elif [ "$1" != "GCC_2_95_3" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the plugin
+ # identifier which can be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "GCC_2_95_3"
+ echo "GNU C Compiler suite version 2.95.x"
+ return 2
+ elif [ "$1" != "GCC_2_95_3" ]; then
+ # we don't display anything when the user selected a
+ # different menu
+ return 2
+ fi
- # now we are done with determining if we are really the menu
- # that the user wants - so we can display it
- menu()
- {
- unset RESULT
- if [ "$1" == "checklist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- elif [ "$1" == "radiolist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- fi
- RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
- return 0
- }
+ # now we are done with determining if we are really the menu
+ # that the user wants - so we can display it
+ menu()
+ {
+ unset RESULT
+ if [ "$1" == "checklist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ elif [ "$1" == "radiolist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ fi
+ RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
+ return 0
+ }
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat >/etc/lunar/local/optimizations.GCC_2_95_3 <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat >/etc/lunar/local/optimizations.GCC_2_95_3 <<EOF
PLATFORM=$PLATFORM
CPU=$CPU
BOPT=$BOPT
SPD=( $(echo ${SPD[@]} ) )
CC_OPTS=( $(echo ${CC_OPTS[@]} ) )
EOF
- }
+ }
+
+ if [ -f /etc/lunar/local/optimizations.GCC_2_95_3 ]; then
+ . /etc/lunar/local/optimizations.GCC_2_95_3
+ fi
+
+ export IFS=$'\t\n'
+ TITLE="Lunar Compiler Optimizations"
- if [ -f /etc/lunar/local/optimizations.GCC_2_95_3 ]; then
- . /etc/lunar/local/optimizations.GCC_2_95_3
- fi
-
- export IFS=$'\t\n'
- TITLE="Lunar Compiler Optimizations"
-
- while true; do
- unset OPTIONS
- IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_2_95_3" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
- DEFAULT=${CHOICE:-safe}
- CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
- echo "default"
- echo "Set this compiler as default [$IS_DEFAULT]"
- echo "Enables you to substitute the default C compiler"
- echo "bopt"
- echo "Base speed optimization [$BOPT]"
- echo "Select the base optimization from -Os, -O0, -O1 etc"
- echo "cpu"
- echo "CPU selection [$CPU]"
- echo "Select the target CPU type"
- echo "spd"
- echo "Specialized optimizations [${SPD[@]}]"
- echo "Select specific compiler flags for expensive and risky optimizations"
- echo "cc_opt"
- echo "General C/C++ options [${CC_OPTS[@]}]"
- echo "Select named pipes, warnings on deprecated symbols"
- ) `
- if [ $? != 0 ]; then
- save_optimizations
- return
- fi
+ while true; do
+ unset OPTIONS
+ IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_2_95_3" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
+ DEFAULT=${CHOICE:-safe}
+ CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
+ echo "default"
+ echo "Set this compiler as default [$IS_DEFAULT]"
+ echo "Enables you to substitute the default C compiler"
+ echo "bopt"
+ echo "Base speed optimization [$BOPT]"
+ echo "Select the base optimization from -Os, -O0, -O1 etc"
+ echo "cpu"
+ echo "CPU selection [$CPU]"
+ echo "Select the target CPU type"
+ echo "spd"
+ echo "Specialized optimizations [${SPD[@]}]"
+ echo "Select specific compiler flags for expensive and risky optimizations"
+ echo "cc_opt"
+ echo "General C/C++ options [${CC_OPTS[@]}]"
+ echo "Select named pipes, warnings on deprecated symbols"
+ ) `
+ if [ $? != 0 ]; then
+ save_optimizations
+ return
+ fi
- case $CHOICE in
- default)
- if [ "$IS_DEFAULT" != "DEFAULT" ]; then
- set_local_config LUNAR_COMPILER GCC_2_95_3
- $DIALOG --msgbox "Gcc 2.95 is now the default compiler!" 6 60
- fi
- ;;
- bopt)
- OPTIONS=(
- "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
- "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
- "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
- "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
- "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
- )
- menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
- BOPT=$RESULT
- ;;
- cpu)
- case $PLATFORM in
- x86)
- OPTIONS=(
- "386" "386" $( [ "$CPU" == "386" ] && echo "on" || echo "off" ) "386 processors"
- "486" "486" $( [ "$CPU" == "486" ] && echo "on" || echo "off" ) "486 processors"
- )
- ;;
- esac
- menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1)" &&
- CPU=$RESULT
- ;;
- spd)
- OPTIONS=(
- "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
- "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
- "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
- "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
- "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
- "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
- "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
- "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
- "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
- "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
- "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
- "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
- "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
- )
- menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information" &&
- SPD=($RESULT)
- ;;
- cc_opt)
- OPTIONS=(
- "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -q "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
- "ccpipe" "-pipe for C (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -q "ccpipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
- "cxxpipe" "-pipe for C++ (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -q "cxxpipe" && echo "on" || echo "off" ) "Enable c++ to use named pipes."
- )
- menu checklist "General C/C++ compiler settings" &&
- CC_OPTS=($RESULT)
- ;;
- esac
- done
+ case $CHOICE in
+ default)
+ if [ "$IS_DEFAULT" != "DEFAULT" ]; then
+ set_local_config LUNAR_COMPILER GCC_2_95_3
+ $DIALOG --msgbox "Gcc 2.95 is now the default compiler!" 6 60
+ fi
+ ;;
+ bopt)
+ OPTIONS=(
+ "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
+ "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
+ "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
+ "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
+ "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
+ )
+ menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
+ BOPT=$RESULT
+ ;;
+ cpu)
+ case $PLATFORM in
+ x86)
+ OPTIONS=(
+ "386" "386" $( [ "$CPU" == "386" ] && echo "on" || echo "off" ) "386 processors"
+ "486" "486" $( [ "$CPU" == "486" ] && echo "on" || echo "off" ) "486 processors"
+ )
+ ;;
+ esac
+ menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1)" &&
+ CPU=$RESULT
+ ;;
+ spd)
+ OPTIONS=(
+ "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
+ "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
+ "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
+ "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
+ "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
+ "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
+ "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
+ "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
+ "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
+ "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
+ "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
+ "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
+ "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
+ )
+ menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information" &&
+ SPD=($RESULT)
+ ;;
+ cc_opt)
+ OPTIONS=(
+ "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -q "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
+ "ccpipe" "-pipe for C (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -q "ccpipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
+ "cxxpipe" "-pipe for C++ (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -q "cxxpipe" && echo "on" || echo "off" ) "Enable c++ to use named pipes."
+ )
+ menu checklist "General C/C++ compiler settings" &&
+ CC_OPTS=($RESULT)
+ ;;
+ esac
+ done
- save_optimizations
+ save_optimizations
}
diff --git a/compilers/gcc3/plugin.d/optimize-gcc_3_4.plugin b/compilers/gcc3/plugin.d/optimize-gcc_3_4.plugin
index 0dfc2f8..2fa14d9 100644
--- a/compilers/gcc3/plugin.d/optimize-gcc_3_4.plugin
+++ b/compilers/gcc3/plugin.d/optimize-gcc_3_4.plugin
@@ -4,171 +4,169 @@
plugin_compiler_gcc_3_4_optimize()
{
- if [ "${LUNAR_COMPILER:-GCC_3_4}" != "GCC_3_4" ]; then
- return 2
- fi
-
- debug_msg "plugin_compiler_gcc_3_4_optimize($@)"
- if [ -f /etc/lunar/local/optimizations.GCC_3_4 ]; then
- . /etc/lunar/local/optimizations.GCC_3_4
- fi
+ if [ "${LUNAR_COMPILER:-GCC_3_4}" != "GCC_3_4" ]; then
+ return 2
+ fi
- # some local macro's
- cflags_add()
- {
- CFLAGS="$CFLAGS $@"
- }
+ debug_msg "plugin_compiler_gcc_3_4_optimize($@)"
+ if [ -f /etc/lunar/local/optimizations.GCC_3_4 ]; then
+ . /etc/lunar/local/optimizations.GCC_3_4
+ fi
- cxxflags_add()
- {
- CXXFLAGS="$CXXFLAGS $@"
- }
+ # some local macro's
+ cflags_add()
+ {
+ CFLAGS="$CFLAGS $@"
+ }
- cppflags_add()
- {
- CPPFLAGS="$CPPFLAGS $@"
- }
-
- c_cxx_flags_add()
- {
- cflags_add $@
- cxxflags_add $@
- }
+ cxxflags_add()
+ {
+ CXXFLAGS="$CXXFLAGS $@"
+ }
- # CFLAGS/CXXFLAGS - base optimization
- case $BOPT in
- None) c_cxx_flags_add "-O0" ;;
- Small) c_cxx_flags_add "-Os" ;;
- Fast) c_cxx_flags_add "-O1" ;;
- Faster) c_cxx_flags_add "-O2" ;;
- Fastest) c_cxx_flags_add "-O3" ;;
- esac
+ cppflags_add()
+ {
+ CPPFLAGS="$CPPFLAGS $@"
+ }
- # CFLAGS -march cpu-specific optimization
- if [ -n "$CPU" ]; then
- c_cxx_flags_add "-march=$CPU"
- fi
+ c_cxx_flags_add()
+ {
+ cflags_add $@
+ cxxflags_add $@
+ }
- # GCC specific extra optimizations
- for SP in ${SPD[@]}; do
- case $SP in
- Speedy) c_cxx_flags_add "-funroll-loops" ;;
- Regparm) c_cxx_flags_add "-mregparm=3" ;;
- Risky) c_cxx_flags_add "-ffast-math" ;;
- Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
- Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
- Profiling)
- c_cxx_flags_add "-fprofile-arcs"
- set_local_config "KEEP_SOURCE" "on"
- ;;
- Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
- Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
- Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
- Float) c_cxx_flags_add "-ffloat-store" ;;
- Address) c_cxx_flags_add "-fforce-addr" ;;
- Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
- Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
- Doubles) c_cxx_flags_add "-malign-double" ;;
- Tracer) c_cxx_flags_add "-ftracer" ;;
- Blocks) c_cxx_flags_add "-freorder-blocks" ;;
- esac
- done
+ # CFLAGS/CXXFLAGS - base optimization
+ case $BOPT in
+ None) c_cxx_flags_add "-O0" ;;
+ Small) c_cxx_flags_add "-Os" ;;
+ Fast) c_cxx_flags_add "-O1" ;;
+ Faster) c_cxx_flags_add "-O2" ;;
+ Fastest) c_cxx_flags_add "-O3" ;;
+ esac
- # STACK - kind of dangerous - shouldn't we just remove this?
- if (( STACK > 0 )) ; then
- c_cxx_flags_add "-mpreferred-stack-boundary=$STACK"
- cppflags_add "-mpreferred-stack-boundary=$STACK"
- fi
+ # CFLAGS -march cpu-specific optimization
+ if [ -n "$CPU" ]; then
+ c_cxx_flags_add "-march=$CPU"
+ fi
- for XTR in ${XTRA[@]}; do
- case $XTR in
- MMX) c_cxx_flags_add "-mmmx" ;;
- SSE) c_cxx_flags_add "-msse" ;;
- SSE2) c_cxx_flags_add "-msse2" ;;
- SSE3) c_cxx_flags_add "-msse3" ;;
- dnow) c_cxx_flags_add "-m3dnow" ;;
- Altivec) c_cxx_flags_add "-maltivec" ;;
- esac
- done
+ # GCC specific extra optimizations
+ for SP in ${SPD[@]}; do
+ case $SP in
+ Speedy) c_cxx_flags_add "-funroll-loops" ;;
+ Regparm) c_cxx_flags_add "-mregparm=3" ;;
+ Risky) c_cxx_flags_add "-ffast-math" ;;
+ Pointers) c_cxx_flags_add "-fomit-frame-pointer" ;;
+ Siblings) c_cxx_flags_add "-foptimize-sibling-calls" ;;
+ Profiling)
+ c_cxx_flags_add "-fprofile-arcs"
+ set_local_config "KEEP_SOURCE" "on"
+ ;;
+ Branching) c_cxx_flags_add "-fbranch-probabilities" ;;
+ Aliasing) c_cxx_flags_add "-fstrict-aliasing" ;;
+ Cprop) c_cxx_flags_add "-fno-cprop-registers" ;;
+ Float) c_cxx_flags_add "-ffloat-store" ;;
+ Address) c_cxx_flags_add "-fforce-addr" ;;
+ Align) c_cxx_flags_add "-falign-functions -falign-loops -falign-jumps" ;;
+ Expensive) c_cxx_flags_add "-fexpensive-optimizations" ;;
+ Doubles) c_cxx_flags_add "-malign-double" ;;
+ Tracer) c_cxx_flags_add "-ftracer" ;;
+ Blocks) c_cxx_flags_add "-freorder-blocks" ;;
+ esac
+ done
- case $FPM in
- x387) c_cxx_flags_add "-mfpmath=387" ;;
- SSE) c_cxx_flags_add "-mfpmath=sse" ;;
- Both) c_cxx_flags_add "-mfpmath=sse,387" ;;
- esac
+ # STACK - kind of dangerous - shouldn't we just remove this?
+ if (( STACK > 0 )) ; then
+ c_cxx_flags_add "-mpreferred-stack-boundary=$STACK"
+ cppflags_add "-mpreferred-stack-boundary=$STACK"
+ fi
- for OPT in ${CC_OPTS[@]}; do
- case $OPT in
- Deprecated)
- cxxflags_add "-Wno-deprecated"
- ;;
- Debug)
- c_cxx_flags_add "-g"
- ;;
- Pipe)
- c_cxx_flags_add "-pipe"
- ;;
- esac
- done
+ for XTR in ${XTRA[@]}; do
+ case $XTR in
+ MMX) c_cxx_flags_add "-mmmx" ;;
+ SSE) c_cxx_flags_add "-msse" ;;
+ SSE2) c_cxx_flags_add "-msse2" ;;
+ SSE3) c_cxx_flags_add "-msse3" ;;
+ dnow) c_cxx_flags_add "-m3dnow" ;;
+ Altivec) c_cxx_flags_add "-maltivec" ;;
+ esac
+ done
- CC=gcc
- CXX=g++
- CPP=cpp
+ case $FPM in
+ x387) c_cxx_flags_add "-mfpmath=387" ;;
+ SSE) c_cxx_flags_add "-mfpmath=sse" ;;
+ Both) c_cxx_flags_add "-mfpmath=sse,387" ;;
+ esac
- export CFLAGS CXXFLAGS CPPFLAGS
- export CC CXX CPP
+ for OPT in ${CC_OPTS[@]}; do
+ case $OPT in
+ Deprecated)
+ cxxflags_add "-Wno-deprecated"
+ ;;
+ Debug)
+ c_cxx_flags_add "-g"
+ ;;
+ Pipe)
+ c_cxx_flags_add "-pipe"
+ ;;
+ esac
+ done
- verbose_msg "CC=\"$CC\""
- verbose_msg "CXX=\"$CXX\""
- verbose_msg "CPP=\"$CPP\""
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
- verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
+ CC=gcc
+ CXX=g++
+ CPP=cpp
- return 2
+ export CFLAGS CXXFLAGS CPPFLAGS
+ export CC CXX CPP
+
+ verbose_msg "CC=\"$CC\""
+ verbose_msg "CXX=\"$CXX\""
+ verbose_msg "CPP=\"$CPP\""
+ verbose_msg "CFLAGS=\"$CFLAGS\""
+ verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
+ verbose_msg "CPPFLAGS=\"$CPPFLAGS\""
+
+ return 2
}
plugin_compiler_gcc_3_4_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the plugin
- # identifier which can be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "GCC_3_4"
- echo "GNU C Compiler suite version 3.4.x"
- return 2
- elif [ "$1" != "GCC_3_4" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the plugin
+ # identifier which can be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "GCC_3_4"
+ echo "GNU C Compiler suite version 3.4.x"
+ return 2
+ elif [ "$1" != "GCC_3_4" ]; then
+ # we don't display anything when the user selected a different menu
+ return 2
+ fi
- # now we are done with determining if we are really the menu
- # that the user wants - so we can display it
- menu()
- {
- unset RESULT
- if [ "$1" == "checklist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- elif [ "$1" == "radiolist" ]; then
- RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
- if [ $? != 0 ]; then
- return 1
- fi
- fi
- RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
- return 0
- }
+ # now we are done with determining if we are really the menu that the user wants - so we can display it
+ menu()
+ {
+ unset RESULT
+ if [ "$1" == "checklist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --separate-output --checklist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ elif [ "$1" == "radiolist" ]; then
+ RESULT=`$DIALOG --no-cancel --item-help --radiolist "$2" 0 0 0 "${OPTIONS[@]}"`
+ if [ $? != 0 ]; then
+ return 1
+ fi
+ fi
+ RESULT=$(echo $RESULT | sed -e 's:^"::' -e 's:"$::')
+ return 0
+ }
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat >/etc/lunar/local/optimizations.GCC_3_4 <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat >/etc/lunar/local/optimizations.GCC_3_4 <<EOF
CPU=$CPU
BOPT=$BOPT
SPD=( $(echo ${SPD[@]} ) )
@@ -177,343 +175,343 @@ FPM=$FPM
CC_OPTS=( $(echo ${CC_OPTS[@]} ) )
STACK=$STACK
EOF
- }
+ }
+
+ if [ -f /etc/lunar/local/optimizations.GCC_3_4 ]; then
+ . /etc/lunar/local/optimizations.GCC_3_4
+ fi
+
+ export IFS=$'\t\n'
+ TITLE="Lunar Compiler Optimizations"
- if [ -f /etc/lunar/local/optimizations.GCC_3_4 ]; then
- . /etc/lunar/local/optimizations.GCC_3_4
- fi
-
- export IFS=$'\t\n'
- TITLE="Lunar Compiler Optimizations"
-
- SAFE_OPTIMIZATIONS=${SAFE_OPTIMIZATIONS:-on}
+ SAFE_OPTIMIZATIONS=${SAFE_OPTIMIZATIONS:-on}
- while true; do
- unset OPTIONS
- IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_3_4" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
- DEFAULT=${CHOICE:-safe}
- CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
- echo "default"
- echo "Set this compiler as default [$IS_DEFAULT]"
- echo "Enables you to substitute the default C compiler"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "safe"
- echo "Turn on optimization safety [$SAFE_OPTIMIZATIONS]"
- echo "Only allow safe optimizations (removes dangerous settings!)"
- else
- echo "safe"
- echo "Turn off optimization safety [$SAFE_OPTIMIZATIONS]"
- echo "Allow potentially unsafe optimizations (DANGEROUS!)"
- fi
- echo "bopt"
- echo "Base speed optimization [$BOPT]"
- echo "Select the base optimization from -Os, -O0, -O1 etc"
- echo "cpu"
- echo "CPU selection [$CPU]"
- echo "Select the target CPU type"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "xtra"
- echo "CPU extensions [${XTRA[@]}]"
- echo "Select CPU extensions"
- echo "spd"
- echo "Specialized optimizations [${SPD[@]}]"
- echo "Select specific compiler flags for expensive and risky optimizations"
- echo "fpm"
- echo "Floating point optimizations [$FPM]"
- echo "enable specific floating point optimizations"
- fi
- echo "cc_opt"
- echo "General C/C++ options [${CC_OPTS[@]}]"
- echo "Select named pipes, warnings on deprecated symbols"
- if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
- echo "stack"
- echo "Stack [$STACK]"
- echo "Set the stack size"
- fi) `
- if [ $? != 0 ]; then
- save_optimizations
- set_local_config SAFE_OPTIMIZATIONS $SAFE_OPTIMIZATIONS
- return
- fi
+ while true; do
+ unset OPTIONS
+ IS_DEFAULT=$([ `get_local_config LUNAR_COMPILER` == "GCC_3_4" ] && echo DEFAULT || get_local_config LUNAR_COMPILER)
+ DEFAULT=${CHOICE:-safe}
+ CHOICE=`$DIALOG --title "$TITLE" --ok-label "Select" --cancel-label "Close" --default-item "$DEFAULT" --item-help --menu "" 0 0 0 $(
+ echo "default"
+ echo "Set this compiler as default [$IS_DEFAULT]"
+ echo "Enables you to substitute the default C compiler"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "safe"
+ echo "Turn on optimization safety [$SAFE_OPTIMIZATIONS]"
+ echo "Only allow safe optimizations (removes dangerous settings!)"
+ else
+ echo "safe"
+ echo "Turn off optimization safety [$SAFE_OPTIMIZATIONS]"
+ echo "Allow potentially unsafe optimizations (DANGEROUS!)"
+ fi
+ echo "bopt"
+ echo "Base speed optimization [$BOPT]"
+ echo "Select the base optimization from -Os, -O0, -O1 etc"
+ echo "cpu"
+ echo "CPU selection [$CPU]"
+ echo "Select the target CPU type"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "xtra"
+ echo "CPU extensions [${XTRA[@]}]"
+ echo "Select CPU extensions"
+ echo "spd"
+ echo "Specialized optimizations [${SPD[@]}]"
+ echo "Select specific compiler flags for expensive and risky optimizations"
+ echo "fpm"
+ echo "Floating point optimizations [$FPM]"
+ echo "enable specific floating point optimizations"
+ fi
+ echo "cc_opt"
+ echo "General C/C++ options [${CC_OPTS[@]}]"
+ echo "Select named pipes, warnings on deprecated symbols"
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ] ; then
+ echo "stack"
+ echo "Stack [$STACK]"
+ echo "Set the stack size"
+ fi) `
+ if [ $? != 0 ]; then
+ save_optimizations
+ set_local_config SAFE_OPTIMIZATIONS $SAFE_OPTIMIZATIONS
+ return
+ fi
- case $CHOICE in
- default)
- if [ "$IS_DEFAULT" != "DEFAULT" ]; then
- set_local_config LUNAR_COMPILER GCC_3_4
- $DIALOG --msgbox "Gcc 3.4 is now the default compiler!" 6 60
- fi
- ;;
- safe)
- if [ "$SAFE_OPTIMIZATIONS" == "off" ]; then
- SAFE_OPTIMIZATIONS=on
- unset SPD XTRA STACK
- FPM=("None")
- BOPT=${BOPT//Fastest/Faster}
- else
- $DIALOG --defaultno --yes-label "No" --no-label "Yes" --colors --yesno " \Z1*** WARNING ***\n\n\ZnPlease read this carefully. You are about to turn off the optimization safety. This means that you can possibly turn on compiler or linker optimizations that can and will break your box. Not only will the problem most likely occur only days, weeks or months after you turn this switch, but also it can corrupt all your personal data, make your machine unbootable, and cause serious personal distress, headache, loss of vision, heart failure, loss of income, or otherwise very bad things. Before you turn off this option, please think for yourself for a minute and ask yourself: Is it worth it?\n\nOnly use safe optimizations?" 20 70
- if [ $? == 0 ]; then
- SAFE_OPTIMIZATIONS=off
- fi
- fi
- ;;
- bopt)
- OPTIONS=(
- "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
- "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
- "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
- "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
- "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
- )
- menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
- BOPT=$RESULT
- ;;
- cpu)
- case $PLATFORM in
- x86)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "i386" "i386" $( [ "$CPU" == "i386" ] && echo "on" || echo "off" ) "i386 processors"
- "i486" "i486" $( [ "$CPU" == "i486" ] && echo "on" || echo "off" ) "i486 processors"
- "i586" "i586 (Pentium)" $( [ "$CPU" == "i586" ] && echo "on" || echo "off" ) "i586 processors, identical to 'pentium'"
- "pentium-mmx" "pentium-mmx" $( [ "$CPU" == "pentium-mmx" ] && echo "on" || echo "off" ) "Pentium processors with mmx"
- "i686" "i686 (PentiumPro)" $( [ "$CPU" == "i686" ] && echo "on" || echo "off" ) "i686 processors, identical to 'pentiumpro'"
- "pentium2" "P2" $( [ "$CPU" == "pentium2" ] && echo "on" || echo "off" ) "Pentium II processors"
- "pentium3" "P3 (Celeron)" $( [ "$CPU" == "pentium3" ] && echo "on" || echo "off" ) "Pentium III processors"
- "pentium3m" "P3 mobile (Celeron)" $( [ "$CPU" == "pentium3m" ] && echo "on" || echo "off" ) "Pentium III Mobile processors"
- "pentium-m" "P3 mobile (Celeron) Low power version" $( [ "$CPU" == "pentium-m" ] && echo "on" || echo "off" ) "Pentium III Mobile processor - low power versions"
- "pentium4" "P4" $( [ "$CPU" == "pentium4" ] && echo "on" || echo "off" ) "Pentium 4 processors"
- "pentium4m" "P4 mobile" $( [ "$CPU" == "pentium4m" ] && echo "on" || echo "off" ) "Pentium 4 mobile processors"
- "prescott" "Xeon" $( [ "$CPU" == "prescott" ] && echo "on" || echo "off" ) "Newer Xeons with sse3"
- "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
- "k6" "k6" $( [ "$CPU" == "k6" ] && echo "on" || echo "off" ) "AMD K6 processors"
- "k6-2" "k6-2" $( [ "$CPU" == "k6-2" ] && echo "on" || echo "off" ) "AMD K6-2 processors"
- "k6-3" "k6-3" $( [ "$CPU" == "k6-3" ] && echo "on" || echo "off" ) "AMD K6-3 processors"
- "athlon" "athlon" $( [ "$CPU" == "athlon" ] && echo "on" || echo "off" ) "AMD Athlon processors"
- "athlon-tbird" "athlon-tbird" $( [ "$CPU" == "athlon-tbird" ] && echo "on" || echo "off" ) "AMD Athlon Thunderbird processors"
- "athlon-4" "athlon-4" $( [ "$CPU" == "athlon-4" ] && echo "on" || echo "off" ) "AMD Athlon 4 processors"
- "athlon-xp" "athlon-xp" $( [ "$CPU" == "athlon-xp" ] && echo "on" || echo "off" ) "AMD Athlon XP processors"
- "athlon-mp" "athlon-mp" $( [ "$CPU" == "athlon-mp" ] && echo "on" || echo "off" ) "AMD athlon MP processors"
- "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
- "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
- "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
- "athlonfx" "athlonfx" $( [ "$CPU" == "athlonfx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
- "winchip-c6" "winchip-c6" $( [ "$CPU" == "winchip-c6" ] && echo "on" || echo "off" ) "IDT Winchip C6 CPU (a 486)"
- "winchip2" "winchip2" $( [ "$CPU" == "winchip2" ] && echo "on" || echo "off" ) "IDT Winchip2 CPU (a 486)"
- "c3" "c3" $( [ "$CPU" == "c3" ] && echo "on" || echo "off" ) "Via C3 CPU with MMX and 3dNOW"
- "c3-2" "c3-2" $( [ "$CPU" == "c3-2" ] && echo "on" || echo "off" ) "Via C3-2 CPU with MMX and SSE"
- )
- ;;
- Alpha)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "ev4" "ev4" $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" ) "Alpha EV4 (21064)"
- "ev45" "ev45" $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" ) "Alpha EV45 (21064a)"
- "ev5" "ev5" $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" ) "Alpha EV5 (21164)"
- "ev56" "ev56" $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" ) "Alpha EV56 (21164a)"
- "pca56" "pca56" $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" ) "Alpha pca56 (21164PC)"
- "ev6" "ev6" $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" ) "Alpha EV6 (21264)"
- "ev67" "ev67" $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" ) "Alpha EV67 (21264a)"
- "ev68" "ev68" $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" ) "Alpha EV68 (21264b)"
- )
- ;;
- PowerPC)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "common" "common" $( [ "$CPU" == "common" ] && echo "on" || echo "off" ) "Common PowerPC"
- "rios" "rios" $( [ "$CPU" == "rios" ] && echo "on" || echo "off" ) "Rios PowerPC"
- "rios1" "rios1" $( [ "$CPU" == "rios1" ] && echo "on" || echo "off" ) "Rios1 PowerPC"
- "rsc" "rsc" $( [ "$CPU" == "rsc" ] && echo "on" || echo "off" ) "RSC PowerPC"
- "rios2" "rios2" $( [ "$CPU" == "rios2" ] && echo "on" || echo "off" ) "Rios2 PowerPC"
- "rs64a" "rs64a" $( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" ) "RS64a PowerPC"
- "403" "403" $( [ "$CPU" == "403" ] && echo "on" || echo "off" ) "403 PowerPC"
- "505" "505" $( [ "$CPU" == "505" ] && echo "on" || echo "off" ) "505 PowerPC"
- "601" "601" $( [ "$CPU" == "601" ] && echo "on" || echo "off" ) "601 PowerPC"
- "602" "602" $( [ "$CPU" == "602" ] && echo "on" || echo "off" ) "602 PowerPC"
- "603" "603" $( [ "$CPU" == "603" ] && echo "on" || echo "off" ) "603 PowerPC"
- "603a" "603a" $( [ "$CPU" == "603a" ] && echo "on" || echo "off" ) "603a PowerPC"
- "604" "604" $( [ "$CPU" == "604" ] && echo "on" || echo "off" ) "604 PowerPC"
- "604e" "604e" $( [ "$CPU" == "604e" ] && echo "on" || echo "off" ) "604e PowerPC"
- "620" "620" $( [ "$CPU" == "620" ] && echo "on" || echo "off" ) "620 PowerPC"
- "630" "630" $( [ "$CPU" == "630" ] && echo "on" || echo "off" ) "630 PowerPC"
- "740" "740" $( [ "$CPU" == "740" ] && echo "on" || echo "off" ) "740 PowerPC"
- "7400" "7400" $( [ "$CPU" == "7400" ] && echo "on" || echo "off" ) "7400 PowerPC"
- "7450" "7450" $( [ "$CPU" == "7450" ] && echo "on" || echo "off" ) "7450 PowerPC"
- "750" "750" $( [ "$CPU" == "750" ] && echo "on" || echo "off" ) "750 PowerPC"
- "801" "801" $( [ "$CPU" == "801" ] && echo "on" || echo "off" ) "801 PowerPC"
- "821" "821" $( [ "$CPU" == "821" ] && echo "on" || echo "off" ) "821 PowerPC"
- "823" "823" $( [ "$CPU" == "823" ] && echo "on" || echo "off" ) "823 PowerPC"
- "Power" "Power" $( [ "$CPU" == "Power" ] && echo "on" || echo "off" ) "Power PowerPC"
- "Power2" "Power2" $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" ) "Power2 PowerPC"
- "PowerPC" "PowerPC" $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "IBM and Apple hardware (Power and PowerPC)"
- )
- ;;
- SPARC)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "v7" "v7" $( [ "$CPU" == "v7" ] && echo "on" || echo "off" ) "V7 SPARC"
- "cypress" "cypress" $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" ) "Cypress SPARC"
- "v8" "v8" $( [ "$CPU" == "v8" ] && echo "on" || echo "off" ) "V8 SPARC"
- "supersparc" "supersparc" $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" ) "SuperSPARC"
- "sparclite" "sparclite" $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" ) "SPARCLite"
- "hypersparc" "hypersparc" $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" ) "HyperSPARC"
- "sparclite86x" "sparclite86x" $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "SPARCLite86x"
- "f930" "f930" $( [ "$CPU" == "f930" ] && echo "on" || echo "off" ) "f930 SPARC"
- "f934" "f934" $( [ "$CPU" == "f934" ] && echo "on" || echo "off" ) "f934 SPARC"
- "sparclet" "sparclet" $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" ) "SPARCLet"
- "tsc701" "tsc701" $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" ) "tsc701"
- "v9" "v9" $( [ "$CPU" == "v9" ] && echo "on" || echo "off" ) "V9 SPARC"
- "ultrasparc" "ultrasparc" $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" ) "ULTRASPARC"
- )
- ;;
- x86_64)
- OPTIONS=(
- "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
- "x86-64" "x86-64" $( [ "$CPU" == "x86-64" ] && echo "on" || echo "off" ) "Both AMD64 and Intel EM64T machines"
- "amd64" "amd64" $( [ "$CPU" == "amd64" ] && echo "on" || echo "off" ) "AMD64-specific optimizations"
- "em64t" "em64t" $( [ "$CPU" == "em64t" ] && echo "on" || echo "off" ) "Intel EM64t -specific optimizations"
- )
- ;;
- esac
- menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1). If you are unsure, use $(arch) - anything higher is not safe." &&
- CPU=$RESULT
- ;;
- spd)
- OPTIONS=(
- "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
- "Regparm" "-mregparm=3" $( echo ${SPD[@]} | grep -q "Regparm" && echo "on" || echo "off" ) "Pass up to 3 function arguments in registers instead of stack"
- "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
- "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
- "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
- "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
- "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
- "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
- "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
- "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
- "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
- "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
- "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
- "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
- "Tracer" "-ftracer" $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" ) "Perform tail duplication to enlarge superblock size."
- "Blocks" "-freorder-blocks" $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" ) "Reorder basic blocks in order to reduce number of taken branches."
- )
- menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information. None of these options are safe!" &&
- SPD=($RESULT)
- ;;
- fpm)
- OPTIONS=(
- "None" "Use compiler default" $([ "$FPM" == "None" ] && echo "on" || echo "off" ) "Use compiler default"
- )
- case $PLATFORM in
- x86|x86_64)
- if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
- OPTIONS=(
- ${OPTIONS[@]}
- "x387" "Floating point coprocessor" $([ "$FPM" == "x387" ] && echo "on" || echo "off" ) "Classic 387 or higher Floating Point Co-Processor"
- )
- fi
- if grep -qw sse /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE" "Streaming SIMD Extensions" $([ "$FPM" == "SSE" ] && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data)"
- )
- fi
- if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
- OPTIONS=(
- ${OPTIONS[@]}
- "Both" "x387 and SSE" $([ "$FPM" == "Both" ] && echo "on" || echo "off" ) "Both SSE and 387"
- )
- fi
- ;;
- PowerPC)
- if grep -qw altivec /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "Altivec" "PowerPC only" $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" ) "Altivec"
- )
- fi
- ;;
- esac
- unset FLAGS
- for EXT in fpu sse altivec ; do
- if grep -qw "$EXT" /proc/cpuinfo ; then
- FLAGS="$FLAGS $EXT"
- fi
- done
- FLAGS=${FLAGS/fpu/387}
- FLAGS=${FLAGS/387 sse/387 and sse (both)}
- menu radiolist "Select available Floating Point Math compile extensions. The kernel reports that this system has: $FLAGS. None of these are safe." &&
- FPM=$RESULT
- ;;
- xtra)
- unset OPTIONS
- case $PLATFORM in
- x86|x86_64)
- if grep -qw mmx /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "MMX" "MMX" $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" ) "Multi-Media instruction code eXtensions"
- )
- fi
- if grep -qw sse /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE" "SSE" $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions"
- )
- fi
- if grep -qw sse2 /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE2" "SSE2" $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v2"
- )
- fi
- if grep -qw pni /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "SSE3" "SSE3" $( echo ${XTRA[@]} | grep -q "SSE3" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v3"
- )
- fi
- if grep -qw 3dnow /proc/cpuinfo; then
- OPTIONS=(
- ${OPTIONS[@]}
- "dnow" "3dnow" $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" ) "3dnow"
- )
- fi
- ;;
- PowerPC)
- if grep -qw altivec /proc/cpuinfo; then
- OPTIONS=(
- "Altivec" "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" ) "Altivec"
- )
- fi
- ;;
- esac
- unset FLAGS
- for EXT in mmx sse sse2 pni 3dnow altivec ; do
- if grep -qw "$EXT" /proc/cpuinfo ; then
- echo $EXT
- FLAGS="$FLAGS $EXT"
- fi
- done
- FLAGS=${FLAGS/pni/sse3}
- menu checklist "Select compiler use of extra instruction sets. The kernel reports that this system has: $FLAGS. None of these are safe." &&
- XTRA=($RESULT)
- ;;
- cc_opt)
- OPTIONS=(
- "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -qw "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
- "Debug" "-g" $( echo ${CC_OPTS[@]} | grep -qw "Debug" && echo "on" || echo "off" ) "Add debug symbols"
- "Pipe" "-pipe (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -qw "Pipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
- )
- menu checklist "General C/C++ compiler settings" &&
- CC_OPTS=($RESULT)
- ;;
- stack)
- STACK=`$DIALOG --nocancel --inputbox "Enter the number to set the stack to, leave empty for default. Only used on x86 platform. Not safe" 0 55 $STACK`
- ;;
- esac
- done
+ case $CHOICE in
+ default)
+ if [ "$IS_DEFAULT" != "DEFAULT" ]; then
+ set_local_config LUNAR_COMPILER GCC_3_4
+ $DIALOG --msgbox "Gcc 3.4 is now the default compiler!" 6 60
+ fi
+ ;;
+ safe)
+ if [ "$SAFE_OPTIMIZATIONS" == "off" ]; then
+ SAFE_OPTIMIZATIONS=on
+ unset SPD XTRA STACK
+ FPM=("None")
+ BOPT=${BOPT//Fastest/Faster}
+ else
+ $DIALOG --defaultno --yes-label "No" --no-label "Yes" --colors --yesno " \Z1*** WARNING ***\n\n\ZnPlease read this carefully. You are about to turn off the optimization safety. This means that you can possibly turn on compiler or linker optimizations that can and will break your box. Not only will the problem most likely occur only days, weeks or months after you turn this switch, but also it can corrupt all your personal data, make your machine unbootable, and cause serious personal distress, headache, loss of vision, heart failure, loss of income, or otherwise very bad things. Before you turn off this option, please think for yourself for a minute and ask yourself: Is it worth it?\n\nOnly use safe optimizations?" 20 70
+ if [ $? == 0 ]; then
+ SAFE_OPTIMIZATIONS=off
+ fi
+ fi
+ ;;
+ bopt)
+ OPTIONS=(
+ "None" "-O0" $( [ "$BOPT" == "None" ] && echo "on" || echo "off" ) "Only default optimizations"
+ "Fast" "-O1" $( [ "$BOPT" == "Fast" ] && echo "on" || echo "off" ) "-O1"
+ "Faster" "-O2" $( [ "$BOPT" == "Faster" ] && echo "on" || echo "off" ) "-O2"
+ "Fastest" "-O3" $( [ "$BOPT" == "Fastest" ] && echo "on" || echo "off" ) "-O3"
+ "Small" "-Os" $( [ "$BOPT" == "Small" ] && echo "on" || echo "off" ) "-Os"
+ )
+ menu radiolist "Choose the base compile-time optimization. Most people will use -O2 or -O3. Note that some modules set their own level." &&
+ BOPT=$RESULT
+ ;;
+ cpu)
+ case $PLATFORM in
+ x86)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "i386" "i386" $( [ "$CPU" == "i386" ] && echo "on" || echo "off" ) "i386 processors"
+ "i486" "i486" $( [ "$CPU" == "i486" ] && echo "on" || echo "off" ) "i486 processors"
+ "i586" "i586 (Pentium)" $( [ "$CPU" == "i586" ] && echo "on" || echo "off" ) "i586 processors, identical to 'pentium'"
+ "pentium-mmx" "pentium-mmx" $( [ "$CPU" == "pentium-mmx" ] && echo "on" || echo "off" ) "Pentium processors with mmx"
+ "i686" "i686 (PentiumPro)" $( [ "$CPU" == "i686" ] && echo "on" || echo "off" ) "i686 processors, identical to 'pentiumpro'"
+ "pentium2" "P2" $( [ "$CPU" == "pentium2" ] && echo "on" || echo "off" ) "Pentium II processors"
+ "pentium3" "P3 (Celeron)" $( [ "$CPU" == "pentium3" ] && echo "on" || echo "off" ) "Pentium III processors"
+ "pentium3m" "P3 mobile (Celeron)" $( [ "$CPU" == "pentium3m" ] && echo "on" || echo "off" ) "Pentium III Mobile processors"
+ "pentium-m" "P3 mobile (Celeron) Low power version" $( [ "$CPU" == "pentium-m" ] && echo "on" || echo "off" ) "Pentium III Mobile processor - low power versions"
+ "pentium4" "P4" $( [ "$CPU" == "pentium4" ] && echo "on" || echo "off" ) "Pentium 4 processors"
+ "pentium4m" "P4 mobile" $( [ "$CPU" == "pentium4m" ] && echo "on" || echo "off" ) "Pentium 4 mobile processors"
+ "prescott" "Xeon" $( [ "$CPU" == "prescott" ] && echo "on" || echo "off" ) "Newer Xeons with sse3"
+ "nocona" "nocona" $( [ "$CPU" == "nocona" ] && echo "on" || echo "off" ) "Newer Xeons with sse3 and em64t"
+ "k6" "k6" $( [ "$CPU" == "k6" ] && echo "on" || echo "off" ) "AMD K6 processors"
+ "k6-2" "k6-2" $( [ "$CPU" == "k6-2" ] && echo "on" || echo "off" ) "AMD K6-2 processors"
+ "k6-3" "k6-3" $( [ "$CPU" == "k6-3" ] && echo "on" || echo "off" ) "AMD K6-3 processors"
+ "athlon" "athlon" $( [ "$CPU" == "athlon" ] && echo "on" || echo "off" ) "AMD Athlon processors"
+ "athlon-tbird" "athlon-tbird" $( [ "$CPU" == "athlon-tbird" ] && echo "on" || echo "off" ) "AMD Athlon Thunderbird processors"
+ "athlon-4" "athlon-4" $( [ "$CPU" == "athlon-4" ] && echo "on" || echo "off" ) "AMD Athlon 4 processors"
+ "athlon-xp" "athlon-xp" $( [ "$CPU" == "athlon-xp" ] && echo "on" || echo "off" ) "AMD Athlon XP processors"
+ "athlon-mp" "athlon-mp" $( [ "$CPU" == "athlon-mp" ] && echo "on" || echo "off" ) "AMD athlon MP processors"
+ "k8" "k8" $( [ "$CPU" == "k8" ] && echo "on" || echo "off" ) "AMD K8 processors"
+ "opteron" "opteron" $( [ "$CPU" == "opteron" ] && echo "on" || echo "off" ) "AMD opteron processors"
+ "athlon64" "athlon64" $( [ "$CPU" == "athlon64" ] && echo "on" || echo "off" ) "AMD Athlon 64 processors"
+ "athlonfx" "athlonfx" $( [ "$CPU" == "athlonfx" ] && echo "on" || echo "off" ) "AMD Athlon fx processors"
+ "winchip-c6" "winchip-c6" $( [ "$CPU" == "winchip-c6" ] && echo "on" || echo "off" ) "IDT Winchip C6 CPU (a 486)"
+ "winchip2" "winchip2" $( [ "$CPU" == "winchip2" ] && echo "on" || echo "off" ) "IDT Winchip2 CPU (a 486)"
+ "c3" "c3" $( [ "$CPU" == "c3" ] && echo "on" || echo "off" ) "Via C3 CPU with MMX and 3dNOW"
+ "c3-2" "c3-2" $( [ "$CPU" == "c3-2" ] && echo "on" || echo "off" ) "Via C3-2 CPU with MMX and SSE"
+ )
+ ;;
+ Alpha)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "ev4" "ev4" $( [ "$CPU" == "ev4" ] && echo "on" || echo "off" ) "Alpha EV4 (21064)"
+ "ev45" "ev45" $( [ "$CPU" == "ev45" ] && echo "on" || echo "off" ) "Alpha EV45 (21064a)"
+ "ev5" "ev5" $( [ "$CPU" == "ev5" ] && echo "on" || echo "off" ) "Alpha EV5 (21164)"
+ "ev56" "ev56" $( [ "$CPU" == "ev56" ] && echo "on" || echo "off" ) "Alpha EV56 (21164a)"
+ "pca56" "pca56" $( [ "$CPU" == "pca56" ] && echo "on" || echo "off" ) "Alpha pca56 (21164PC)"
+ "ev6" "ev6" $( [ "$CPU" == "ev6" ] && echo "on" || echo "off" ) "Alpha EV6 (21264)"
+ "ev67" "ev67" $( [ "$CPU" == "ev67" ] && echo "on" || echo "off" ) "Alpha EV67 (21264a)"
+ "ev68" "ev68" $( [ "$CPU" == "ev68" ] && echo "on" || echo "off" ) "Alpha EV68 (21264b)"
+ )
+ ;;
+ PowerPC)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "common" "common" $( [ "$CPU" == "common" ] && echo "on" || echo "off" ) "Common PowerPC"
+ "rios" "rios" $( [ "$CPU" == "rios" ] && echo "on" || echo "off" ) "Rios PowerPC"
+ "rios1" "rios1" $( [ "$CPU" == "rios1" ] && echo "on" || echo "off" ) "Rios1 PowerPC"
+ "rsc" "rsc" $( [ "$CPU" == "rsc" ] && echo "on" || echo "off" ) "RSC PowerPC"
+ "rios2" "rios2" $( [ "$CPU" == "rios2" ] && echo "on" || echo "off" ) "Rios2 PowerPC"
+ "rs64a" "rs64a" $( [ "$CPU" == "rs64a" ] && echo "on" || echo "off" ) "RS64a PowerPC"
+ "403" "403" $( [ "$CPU" == "403" ] && echo "on" || echo "off" ) "403 PowerPC"
+ "505" "505" $( [ "$CPU" == "505" ] && echo "on" || echo "off" ) "505 PowerPC"
+ "601" "601" $( [ "$CPU" == "601" ] && echo "on" || echo "off" ) "601 PowerPC"
+ "602" "602" $( [ "$CPU" == "602" ] && echo "on" || echo "off" ) "602 PowerPC"
+ "603" "603" $( [ "$CPU" == "603" ] && echo "on" || echo "off" ) "603 PowerPC"
+ "603a" "603a" $( [ "$CPU" == "603a" ] && echo "on" || echo "off" ) "603a PowerPC"
+ "604" "604" $( [ "$CPU" == "604" ] && echo "on" || echo "off" ) "604 PowerPC"
+ "604e" "604e" $( [ "$CPU" == "604e" ] && echo "on" || echo "off" ) "604e PowerPC"
+ "620" "620" $( [ "$CPU" == "620" ] && echo "on" || echo "off" ) "620 PowerPC"
+ "630" "630" $( [ "$CPU" == "630" ] && echo "on" || echo "off" ) "630 PowerPC"
+ "740" "740" $( [ "$CPU" == "740" ] && echo "on" || echo "off" ) "740 PowerPC"
+ "7400" "7400" $( [ "$CPU" == "7400" ] && echo "on" || echo "off" ) "7400 PowerPC"
+ "7450" "7450" $( [ "$CPU" == "7450" ] && echo "on" || echo "off" ) "7450 PowerPC"
+ "750" "750" $( [ "$CPU" == "750" ] && echo "on" || echo "off" ) "750 PowerPC"
+ "801" "801" $( [ "$CPU" == "801" ] && echo "on" || echo "off" ) "801 PowerPC"
+ "821" "821" $( [ "$CPU" == "821" ] && echo "on" || echo "off" ) "821 PowerPC"
+ "823" "823" $( [ "$CPU" == "823" ] && echo "on" || echo "off" ) "823 PowerPC"
+ "Power" "Power" $( [ "$CPU" == "Power" ] && echo "on" || echo "off" ) "Power PowerPC"
+ "Power2" "Power2" $( [ "$CPU" == "Power2" ] && echo "on" || echo "off" ) "Power2 PowerPC"
+ "PowerPC" "PowerPC" $( [ "$CPU" == "PowerPC" ] && echo "on" || echo "off" ) "IBM and Apple hardware (Power and PowerPC)"
+ )
+ ;;
+ SPARC)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "v7" "v7" $( [ "$CPU" == "v7" ] && echo "on" || echo "off" ) "V7 SPARC"
+ "cypress" "cypress" $( [ "$CPU" == "cypress" ] && echo "on" || echo "off" ) "Cypress SPARC"
+ "v8" "v8" $( [ "$CPU" == "v8" ] && echo "on" || echo "off" ) "V8 SPARC"
+ "supersparc" "supersparc" $( [ "$CPU" == "supersparc" ] && echo "on" || echo "off" ) "SuperSPARC"
+ "sparclite" "sparclite" $( [ "$CPU" == "sparclite" ] && echo "on" || echo "off" ) "SPARCLite"
+ "hypersparc" "hypersparc" $( [ "$CPU" == "hypersparc" ] && echo "on" || echo "off" ) "HyperSPARC"
+ "sparclite86x" "sparclite86x" $( [ "$CPU" == "sparclite86x" ] && echo "on" || echo "off" ) "SPARCLite86x"
+ "f930" "f930" $( [ "$CPU" == "f930" ] && echo "on" || echo "off" ) "f930 SPARC"
+ "f934" "f934" $( [ "$CPU" == "f934" ] && echo "on" || echo "off" ) "f934 SPARC"
+ "sparclet" "sparclet" $( [ "$CPU" == "sparclet" ] && echo "on" || echo "off" ) "SPARCLet"
+ "tsc701" "tsc701" $( [ "$CPU" == "tsc701" ] && echo "on" || echo "off" ) "tsc701"
+ "v9" "v9" $( [ "$CPU" == "v9" ] && echo "on" || echo "off" ) "V9 SPARC"
+ "ultrasparc" "ultrasparc" $( [ "$CPU" == "ultrasparc" ] && echo "on" || echo "off" ) "ULTRASPARC"
+ )
+ ;;
+ x86_64)
+ OPTIONS=(
+ "None" "" $( [ ! "$CPU" ] && echo "on" || echo "off" ) "All processor types"
+ "x86-64" "x86-64" $( [ "$CPU" == "x86-64" ] && echo "on" || echo "off" ) "Both AMD64 and Intel EM64T machines"
+ "amd64" "amd64" $( [ "$CPU" == "amd64" ] && echo "on" || echo "off" ) "AMD64-specific optimizations"
+ "em64t" "em64t" $( [ "$CPU" == "em64t" ] && echo "on" || echo "off" ) "Intel EM64t -specific optimizations"
+ )
+ ;;
+ esac
+ menu radiolist "CPU, according to the kernel you have a$(cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | head -n 1). If you are unsure, use $(arch) - anything higher is not safe." &&
+ CPU=$RESULT
+ ;;
+ spd)
+ OPTIONS=(
+ "Speedy" "-funroll-loops" $( echo ${SPD[@]} | grep -q "Speedy" && echo "on" || echo "off" ) "Optimize to increase performance of generated code"
+ "Regparm" "-mregparm=3" $( echo ${SPD[@]} | grep -q "Regparm" && echo "on" || echo "off" ) "Pass up to 3 function arguments in registers instead of stack"
+ "Risky" "-ffast-math" $( echo ${SPD[@]} | grep -q "Risky" && echo "on" || echo "off" ) "Optimize to increase performance ... by violating ANSI and IEEE FP rules"
+ "Pointers" "-fomit-frame-pointer" $( echo ${SPD[@]} | grep -q "Pointers" && echo "on" || echo "off" ) "Optimize by omitting frame pointers"
+ "Siblings" "-foptimize-sibling-calls" $( echo ${SPD[@]} | grep -q "Siblings" && echo "on" || echo "off" ) "Optimize sibling calls"
+ "Profiling" "-fprofile-arcs" $( echo ${SPD[@]} | grep -q "Profiling" && echo "on" || echo "off" ) "Generate profiles (For later use with Branching)"
+ "Branching" "-fbranching-probabilities" $( echo ${SPD[@]} | grep -q "Branching" && echo "on" || echo "off" ) "Predict branching (For using profiled sources)"
+ "Aliasing" "-fstrict-aliasing" $( echo ${SPD[@]} | grep -q "Aliasing" && echo "on" || echo "off" ) "Enable strict aliasing (enabled by default -O1 and above)"
+ "Cprop" "-fno-cprop-registers" $( echo ${SPD[@]} | grep -q "Cprop" && echo "on" || echo "off" ) "Reduce scheduling dependencies and remove copies"
+ "Float" "-ffloat-store" $( echo ${SPD[@]} | grep -q "Float" && echo "on" || echo "off" ) "Enable float store"
+ "Address" "-fforce-addr" $( echo ${SPD[@]} | grep -q "Address" && echo "on" || echo "off" ) "Force memory address"
+ "Align" "-falign-functions" $( echo ${SPD[@]} | grep -q "Align" && echo "on" || echo "off" ) "Align functions, loops, and jumps"
+ "Expensive" "-fexpensive-optimizations" $( echo ${SPD[@]} | grep -q "Expensive" && echo "on" || echo "off" ) "Perform expensive optimizations"
+ "Doubles" "-malign-double" $( echo ${SPD[@]} | grep -q "Doubles" && echo "on" || echo "off" ) "Align double, long double, and long long on two word boundaries"
+ "Tracer" "-ftracer" $( echo ${SPD[@]} | grep -q "Tracer" && echo "on" || echo "off" ) "Perform tail duplication to enlarge superblock size."
+ "Blocks" "-freorder-blocks" $( echo ${SPD[@]} | grep -q "Blocks" && echo "on" || echo "off" ) "Reorder basic blocks in order to reduce number of taken branches."
+ )
+ menu checklist "Select additional flags to optimize specific areas of the created code. Note that some of these flags are turned on automatically with -O2 or -O3. See 'man gcc' for more information. None of these options are safe!" &&
+ SPD=($RESULT)
+ ;;
+ fpm)
+ OPTIONS=(
+ "None" "Use compiler default" $([ "$FPM" == "None" ] && echo "on" || echo "off" ) "Use compiler default"
+ )
+ case $PLATFORM in
+ x86|x86_64)
+ if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "x387" "Floating point coprocessor" $([ "$FPM" == "x387" ] && echo "on" || echo "off" ) "Classic 387 or higher Floating Point Co-Processor"
+ )
+ fi
+ if grep -qw sse /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE" "Streaming SIMD Extensions" $([ "$FPM" == "SSE" ] && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data)"
+ )
+ fi
+ if grep '^fpu' /proc/cpuinfo | grep -qw yes; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "Both" "x387 and SSE" $([ "$FPM" == "Both" ] && echo "on" || echo "off" ) "Both SSE and 387"
+ )
+ fi
+ ;;
+ PowerPC)
+ if grep -qw altivec /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "Altivec" "PowerPC only" $([ "$FPM" == "Altivec" ] && echo "on" || echo "off" ) "Altivec"
+ )
+ fi
+ ;;
+ esac
+ unset FLAGS
+ for EXT in fpu sse altivec ; do
+ if grep -qw "$EXT" /proc/cpuinfo ; then
+ FLAGS="$FLAGS $EXT"
+ fi
+ done
+ FLAGS=${FLAGS/fpu/387}
+ FLAGS=${FLAGS/387 sse/387 and sse (both)}
+ menu radiolist "Select available Floating Point Math compile extensions. The kernel reports that this system has: $FLAGS. None of these are safe." &&
+ FPM=$RESULT
+ ;;
+ xtra)
+ unset OPTIONS
+ case $PLATFORM in
+ x86|x86_64)
+ if grep -qw mmx /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "MMX" "MMX" $( echo ${XTRA[@]} | grep -q "MMX" && echo "on" || echo "off" ) "Multi-Media instruction code eXtensions"
+ )
+ fi
+ if grep -qw sse /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE" "SSE" $( echo ${XTRA[@]} | grep -q "SSE" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions"
+ )
+ fi
+ if grep -qw sse2 /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE2" "SSE2" $( echo ${XTRA[@]} | grep -q "SSE2" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v2"
+ )
+ fi
+ if grep -qw pni /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "SSE3" "SSE3" $( echo ${XTRA[@]} | grep -q "SSE3" && echo "on" || echo "off" ) "Streaming SIMD (Single Instruction, Multiple Data) Extensions v3"
+ )
+ fi
+ if grep -qw 3dnow /proc/cpuinfo; then
+ OPTIONS=(
+ ${OPTIONS[@]}
+ "dnow" "3dnow" $( echo ${XTRA[@]} | grep -q "dnow" && echo "on" || echo "off" ) "3dnow"
+ )
+ fi
+ ;;
+ PowerPC)
+ if grep -qw altivec /proc/cpuinfo; then
+ OPTIONS=(
+ "Altivec" "Altivec" $( echo ${XTRA[@]} | grep -q "Altivec" && echo "on" || echo "off" ) "Altivec"
+ )
+ fi
+ ;;
+ esac
+ unset FLAGS
+ for EXT in mmx sse sse2 pni 3dnow altivec ; do
+ if grep -qw "$EXT" /proc/cpuinfo ; then
+ echo $EXT
+ FLAGS="$FLAGS $EXT"
+ fi
+ done
+ FLAGS=${FLAGS/pni/sse3}
+ menu checklist "Select compiler use of extra instruction sets. The kernel reports that this system has: $FLAGS. None of these are safe." &&
+ XTRA=($RESULT)
+ ;;
+ cc_opt)
+ OPTIONS=(
+ "Deprecated" "-Wno-deprecated for C++" $( echo ${CC_OPTS[@]} | grep -qw "Deprecated" && echo "on" || echo "off" ) "Disable warnings of deprecated symbols in C++"
+ "Debug" "-g" $( echo ${CC_OPTS[@]} | grep -qw "Debug" && echo "on" || echo "off" ) "Add debug symbols"
+ "Pipe" "-pipe (RECOMMENDED)" $( echo ${CC_OPTS[@]} | grep -qw "Pipe" && echo "on" || echo "off" ) "Enable cc to use named pipes."
+ )
+ menu checklist "General C/C++ compiler settings" &&
+ CC_OPTS=($RESULT)
+ ;;
+ stack)
+ STACK=`$DIALOG --nocancel --inputbox "Enter the number to set the stack to, leave empty for default. Only used on x86 platform. Not safe" 0 55 $STACK`
+ ;;
+ esac
+ done
- save_optimizations
+ save_optimizations
}
diff --git a/devel/binutils/plugin.d/optimize-gnu_ld.plugin b/devel/binutils/plugin.d/optimize-gnu_ld.plugin
index ddb8b14..827ac02 100644
--- a/devel/binutils/plugin.d/optimize-gnu_ld.plugin
+++ b/devel/binutils/plugin.d/optimize-gnu_ld.plugin
@@ -5,85 +5,85 @@
plugin_gnu_ld_optimize()
{
- if [ -f /etc/lunar/local/optimizations.GNU_LD ]; then
- . /etc/lunar/local/optimizations.GNU_LD
- fi
+ if [ -f /etc/lunar/local/optimizations.GNU_LD ]; then
+ . /etc/lunar/local/optimizations.GNU_LD
+ fi
- for LD in ${LDF[@]}; do
- case $LD in
- Strip)
- LDFLAGS="$LDFLAGS -s"
- ;;
- StripDebug)
- LDFLAGS="$LDFLAGS -S"
- ;;
- Optimize)
- LDFLAGS="$LDFLAGS -Wl,-O1"
- ;;
- Reduce)
- if echo $LDFLAGS | grep -q 'Wl,-O1' ; then
- LDFLAGS="$LDFLAGS -Wl,-O1,--as-needed"
- else
- LDFLAGS="$LDFLAGS -Wl,--as-needed"
- fi
- ;;
- Combreloc)
- LDFLAGS="$LDFLAGS -z combreloc"
- ;;
- esac
- done
+ for LD in ${LDF[@]}; do
+ case $LD in
+ Strip)
+ LDFLAGS="$LDFLAGS -s"
+ ;;
+ StripDebug)
+ LDFLAGS="$LDFLAGS -S"
+ ;;
+ Optimize)
+ LDFLAGS="$LDFLAGS -Wl,-O1"
+ ;;
+ Reduce)
+ if echo $LDFLAGS | grep -q 'Wl,-O1' ; then
+ LDFLAGS="$LDFLAGS -Wl,-O1,--as-needed"
+ else
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ fi
+ ;;
+ Combreloc)
+ LDFLAGS="$LDFLAGS -z combreloc"
+ ;;
+ esac
+ done
- export LDFLAGS
- verbose_msg "LDFLAGS=\"$LDFLAGS\""
- return 2
+ export LDFLAGS
+ verbose_msg "LDFLAGS=\"$LDFLAGS\""
+ return 2
}
plugin_gnu_ld_optimize_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the version
- # number which will be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "GNU_LD"
- echo "GNU ld - linker"
- return 2
- elif [ "$1" != "GNU_LD" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the version
+ # number which will be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "GNU_LD"
+ echo "GNU ld - linker"
+ return 2
+ elif [ "$1" != "GNU_LD" ]; then
+ # we don't display anything when the user selected a
+ # different menu
+ return 2
+ fi
- # load previous optimizations
- if [ -e /etc/lunar/local/optimizations.GNU_LD ]; then
- . /etc/lunar/local/optimizations.GNU_LD
- fi
+ # load previous optimizations
+ if [ -e /etc/lunar/local/optimizations.GNU_LD ]; then
+ . /etc/lunar/local/optimizations.GNU_LD
+ fi
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat > /etc/lunar/local/optimizations.GNU_LD <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat > /etc/lunar/local/optimizations.GNU_LD <<EOF
LDF=( $(echo ${LDF[@]} ) )
EOF
- }
+ }
- export IFS=$'\t\n'
- TITLE="Lunar Linker Optimizations"
-
-
- OPTIONS=(
- "Strip" "-s (RECOMMENDED)" $( echo ${LDF[@]} | grep -qw "Strip" && echo "on" || echo "off" ) "Strip all symbols"
- "StripDebug" "-S" $( echo ${LDF[@]} | grep -qw "StripDebug" && echo "on" || echo "off" ) "Strip debug symbols only"
- "Optimize" "-Wl,-O1" $( echo ${LDF[@]} | grep -qw "Optimize" && echo "on" || echo "off" ) "Optimize hash tables during linking"
- "Reduce" "-Wl,--as-needed" $( echo ${LDF[@]} | grep -qw "Reduce" && echo "on" || echo "off" ) "Reduce the amount of linked libraries if possible"
- "Combreloc" "-z combreloc" $( echo ${LDF[@]} | grep -qw "Combreloc" && echo "on" || echo "off" ) "Combreloc"
- )
- RESULT=`$DIALOG --item-help --separate-output --checklist "Select linker optimizations. These options only apply to the link stage of binaries." 0 0 0 "${OPTIONS[@]}"`
- if [ $? == 0 ]; then
- LDF=($RESULT)
- save_optimizations
- fi
+ export IFS=$'\t\n'
+ TITLE="Lunar Linker Optimizations"
+
+
+ OPTIONS=(
+ "Strip" "-s (RECOMMENDED)" $( echo ${LDF[@]} | grep -qw "Strip" && echo "on" || echo "off" ) "Strip all symbols"
+ "StripDebug" "-S" $( echo ${LDF[@]} | grep -qw "StripDebug" && echo "on" || echo "off" ) "Strip debug symbols only"
+ "Optimize" "-Wl,-O1" $( echo ${LDF[@]} | grep -qw "Optimize" && echo "on" || echo "off" ) "Optimize hash tables during linking"
+ "Reduce" "-Wl,--as-needed" $( echo ${LDF[@]} | grep -qw "Reduce" && echo "on" || echo "off" ) "Reduce the amount of linked libraries if possible"
+ "Combreloc" "-z combreloc" $( echo ${LDF[@]} | grep -qw "Combreloc" && echo "on" || echo "off" ) "Combreloc"
+ )
+ RESULT=`$DIALOG --item-help --separate-output --checklist "Select linker optimizations. These options only apply to the link stage of binaries." 0 0 0 "${OPTIONS[@]}"`
+ if [ $? == 0 ]; then
+ LDF=($RESULT)
+ save_optimizations
+ fi
}
diff --git a/devel/bzr/plugin.d/download-bzr.plugin b/devel/bzr/plugin.d/download-bzr.plugin
index 9e50915..b41bb0c 100644
--- a/devel/bzr/plugin.d/download-bzr.plugin
+++ b/devel/bzr/plugin.d/download-bzr.plugin
@@ -36,8 +36,7 @@ plugin_source_download_bzr() {
BZR_URL="${BZR_URL:4}"
fi
- message "${MESSAGE_COLOR}Downloading BZR module for" \
- "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}Downloading BZR module for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
SBASE=$(source_basename $2)
mk_source_dir $TMPDIR/$MODULE-$VERSION
@@ -104,13 +103,13 @@ plugin_source_needrefresh_bzr() {
BZR_THRESHOLD=${BZR_THRESHOLD:-10}
if (( "BZR_THRESHOLD" > 0 )) ; then
- if [ "$(find $3/$2 -amin +$BZR_THRESHOLD)" == "$3/$2" ] ; then
+ if [ "$(find $3/$2 -amin +$BZR_THRESHOLD)" == "$3/$2" ] ; then
# it is older:
- return 0
- else
+ return 0
+ else
message "${MESSAGE_COLOR}BZR update not required for \"${FILE_COLOR}$(basename $2)${DEFAULT_COLOR}${CYAN}\" (less than $BZR_THRESHOLD minutes old)${DEFAULT_COLOR}"
# now we can send a FAIL so the next plugins are skipped:
- return 1
+ return 1
fi
else
# always return true if threshhold is zero
diff --git a/devel/cvs/plugin.d/download-cvs.plugin b/devel/cvs/plugin.d/download-cvs.plugin
index a00c02f..70526c3 100644
--- a/devel/cvs/plugin.d/download-cvs.plugin
+++ b/devel/cvs/plugin.d/download-cvs.plugin
@@ -38,9 +38,7 @@ plugin_source_download_cvs() {
CVSROOT="$CVSARGS@$CVSSERVER:$CVSSPATH"
- message "${MESSAGE_COLOR}Downloading CVS module" \
- "${FILE_COLOR}${CVSMODULE}${DEFAULT_COLOR}${MESSAGE_COLOR}" \
- "for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}Downloading CVS module ${FILE_COLOR}${CVSMODULE}${DEFAULT_COLOR}${MESSAGE_COLOR} for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
SBASE=$(source_basename $2)
mk_source_dir $TMPDIR/$MODULE-$VERSION
@@ -107,13 +105,13 @@ plugin_source_needrefresh_cvs() {
CVS_THRESHOLD=${CVS_THRESHOLD:-10}
if (( "CVS_THRESHOLD" > 0 )) ; then
- if [ "$(find $3/$2 -amin +$CVS_THRESHOLD)" == "$3/$2" ] ; then
+ if [ "$(find $3/$2 -amin +$CVS_THRESHOLD)" == "$3/$2" ] ; then
# it is older:
- return 0
- else
+ return 0
+ else
verbose_msg "CVS update not required for \"$2\" (less than $CVS_THRESHOLD mins old)"
# now we can send a FAIL so the next plugins are skipped:
- return 1
+ return 1
fi
else
# always return true if threshhold is zero
diff --git a/devel/git/plugin.d/download-git.plugin b/devel/git/plugin.d/download-git.plugin
index 99addfd..7e48b41 100644
--- a/devel/git/plugin.d/download-git.plugin
+++ b/devel/git/plugin.d/download-git.plugin
@@ -37,8 +37,7 @@ plugin_source_download_git() {
GIT_URL="${GIT_URL:4}"
fi
- message "${MESSAGE_COLOR}Downloading GIT module for" \
- "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}Downloading GIT module for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
SBASE=$(source_basename $2)
mk_source_dir $TMPDIR/$MODULE-$VERSION
@@ -105,13 +104,13 @@ plugin_source_needrefresh_git() {
GIT_THRESHOLD=${GIT_THRESHOLD:-10}
if (( "GIT_THRESHOLD" > 0 )) ; then
- if [ "$(find $3/$2 -amin +$GIT_THRESHOLD)" == "$3/$2" ] ; then
+ if [ "$(find $3/$2 -amin +$GIT_THRESHOLD)" == "$3/$2" ] ; then
# it is older:
- return 0
- else
+ return 0
+ else
message "${MESSAGE_COLOR}GIT update not required for \"${FILE_COLOR}$(basename $2)${DEFAULT_COLOR}${CYAN}\" (less than $GIT_THRESHOLD minutes old)${DEFAULT_COLOR}"
# now we can send a FAIL so the next plugins are skipped:
- return 1
+ return 1
fi
else
# always return true if threshhold is zero
diff --git a/devel/make/plugin.d/optimize-gnu_make.plugin b/devel/make/plugin.d/optimize-gnu_make.plugin
index c8d1164..5b307e7 100644
--- a/devel/make/plugin.d/optimize-gnu_make.plugin
+++ b/devel/make/plugin.d/optimize-gnu_make.plugin
@@ -5,64 +5,64 @@
plugin_gnu_make_optimize()
{
- if [ -f /etc/lunar/local/optimizations.GNU_MAKE ]; then
- . /etc/lunar/local/optimizations.GNU_MAKE
- fi
+ if [ -f /etc/lunar/local/optimizations.GNU_MAKE ]; then
+ . /etc/lunar/local/optimizations.GNU_MAKE
+ fi
- if [ "$PSAFE" == "no" ] ; then
- unset MAKES
- elif (( MAKES < 2 )) ; then
- unset MAKES
- else
- if module_installed linux-openmosix; then
- MAKE_EXT="$MAKE_EXT mosrun -h"
- verbose_msg "MAKE_EXT=\"$MAKE_EXT\""
- fi
-
- verbose_msg "MAKES=\"$MAKES\""
- export MAKES
- fi
- return 2
+ if [ "$PSAFE" == "no" ] ; then
+ unset MAKES
+ elif (( MAKES < 2 )) ; then
+ unset MAKES
+ else
+ if module_installed linux-openmosix; then
+ MAKE_EXT="$MAKE_EXT mosrun -h"
+ verbose_msg "MAKE_EXT=\"$MAKE_EXT\""
+ fi
+
+ verbose_msg "MAKES=\"$MAKES\""
+ export MAKES
+ fi
+ return 2
}
plugin_gnu_make_optimize_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the version
- # number which will be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "GNU_MAKE"
- echo "GNU make - linker"
- return 2
- elif [ "$1" != "GNU_MAKE" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the version
+ # number which will be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "GNU_MAKE"
+ echo "GNU make - linker"
+ return 2
+ elif [ "$1" != "GNU_MAKE" ]; then
+ # we don't display anything when the user selected a
+ # different menu
+ return 2
+ fi
- # load previous optimizations
- if [ -e /etc/lunar/local/optimizations.GNU_MAKE ]; then
- . /etc/lunar/local/optimizations.GNU_MAKE
- fi
+ # load previous optimizations
+ if [ -e /etc/lunar/local/optimizations.GNU_MAKE ]; then
+ . /etc/lunar/local/optimizations.GNU_MAKE
+ fi
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat > /etc/lunar/local/optimizations.GNU_MAKE <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat > /etc/lunar/local/optimizations.GNU_MAKE <<EOF
MAKES=$MAKES
EOF
- }
+ }
+
+ export IFS=$'\t\n'
+ TITLE="Lunar make Optimizations"
- export IFS=$'\t\n'
- TITLE="Lunar make Optimizations"
-
- RESULT=`$DIALOG --inputbox "Enter the number of concurrent makes ( a value > 1 ) or leave this field empty." 9 60 $MAKES`
- if [ $? == 0 ]; then
- MAKES=$RESULT
- save_optimizations
- fi
+ RESULT=`$DIALOG --inputbox "Enter the number of concurrent makes ( a value > 1 ) or leave this field empty." 9 60 $MAKES`
+ if [ $? == 0 ]; then
+ MAKES=$RESULT
+ save_optimizations
+ fi
}
diff --git a/devel/subversion/plugin.d/download-svn.plugin b/devel/subversion/plugin.d/download-svn.plugin
index ac64aca..4284814 100644
--- a/devel/subversion/plugin.d/download-svn.plugin
+++ b/devel/subversion/plugin.d/download-svn.plugin
@@ -34,8 +34,7 @@ plugin_source_download_svn() {
SVN_URL="${SVN_URL:4}"
fi
- message "${MESSAGE_COLOR}Downloading SVN module for" \
- "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}Downloading SVN module for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
SBASE=$(source_basename $2)
mk_source_dir $TMPDIR/$MODULE-$VERSION
@@ -102,13 +101,13 @@ plugin_source_needrefresh_svn() {
SVN_THRESHOLD=${SVN_THRESHOLD:-10}
if (( "SVN_THRESHOLD" > 0 )) ; then
- if [ "$(find $3/$2 -amin +$SVN_THRESHOLD)" == "$3/$2" ] ; then
+ if [ "$(find $3/$2 -amin +$SVN_THRESHOLD)" == "$3/$2" ] ; then
# it is older:
- return 0
- else
+ return 0
+ else
message "${MESSAGE_COLOR}SVN update not required for \"${FILE_COLOR}$(basename $2)${DEFAULT_COLOR}${CYAN}\" (less than $SVN_THRESHOLD minutes old)${DEFAULT_COLOR}"
# now we can send a FAIL so the next plugins are skipped:
- return 1
+ return 1
fi
else
# always return true if threshhold is zero
diff --git a/distributed/distcc/plugin.d/optimize-distcc.plugin b/distributed/distcc/plugin.d/optimize-distcc.plugin
index 993568e..df2f075 100644
--- a/distributed/distcc/plugin.d/optimize-distcc.plugin
+++ b/distributed/distcc/plugin.d/optimize-distcc.plugin
@@ -5,89 +5,87 @@
plugin_distcc_optimize()
{
- if [ -f /etc/lunar/local/optimizations.DISTCC ]; then
- . /etc/lunar/local/optimizations.DISTCC
- fi
-
- if [ "$USE_DISTCC" == "yes" ]; then
- # we append distcc in case ccache is also used to
- # make sure that distcc goes first!
- echo $CC_EXT | grep -q "distcc" || CC_EXT="$CC_EXT distcc"
- echo $CXX_EXT | grep -q "distcc" || CXX_EXT="$CXX_EXT distcc"
- export CC_EXT
- export CXX_EXT
- export DISTCC_HOSTS
- export DISTCC_ALLOW
- verbose_msg "CC_EXT=\"$CC_EXT\""
- verbose_msg "CXX_EXT=\"$CXX_EXT\""
- verbose_msg "DISTCC_HOSTS=\"$DISTCC_HOSTS\""
- verbose_msg "DISTCC_ALLOW=\"$DISTCC_ALLOW\""
- fi
- return 2
+ if [ -f /etc/lunar/local/optimizations.DISTCC ]; then
+ . /etc/lunar/local/optimizations.DISTCC
+ fi
+
+ if [ "$USE_DISTCC" == "yes" ]; then
+ # we append distcc in case ccache is also used to make sure that distcc goes first!
+ echo $CC_EXT | grep -q "distcc" || CC_EXT="$CC_EXT distcc"
+ echo $CXX_EXT | grep -q "distcc" || CXX_EXT="$CXX_EXT distcc"
+ export CC_EXT
+ export CXX_EXT
+ export DISTCC_HOSTS
+ export DISTCC_ALLOW
+ verbose_msg "CC_EXT=\"$CC_EXT\""
+ verbose_msg "CXX_EXT=\"$CXX_EXT\""
+ verbose_msg "DISTCC_HOSTS=\"$DISTCC_HOSTS\""
+ verbose_msg "DISTCC_ALLOW=\"$DISTCC_ALLOW\""
+ fi
+ return 2
}
plugin_distcc_optimize_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the version
- # number which will be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "DISTCC"
- echo "Distributed Compiling"
- return 2
- elif [ "$1" != "DISTCC" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the version
+ # number which will be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "DISTCC"
+ echo "Distributed Compiling"
+ return 2
+ elif [ "$1" != "DISTCC" ]; then
+ # we don't display anything when the user selected a different menu
+ return 2
+ fi
- # load previous optimizations
- if [ -e /etc/lunar/local/optimizations.DISTCC ]; then
- . /etc/lunar/local/optimizations.DISTCC
- fi
+ # load previous optimizations
+ if [ -e /etc/lunar/local/optimizations.DISTCC ]; then
+ . /etc/lunar/local/optimizations.DISTCC
+ fi
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat > /etc/lunar/local/optimizations.DISTCC <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat > /etc/lunar/local/optimizations.DISTCC <<EOF
USE_DISTCC=$USE_DISTCC
DISTCC_HOSTS="$DISTCC_HOSTS"
DISTCC_ALLOW="$DISTCC_ALLOW"
EOF
- }
+ }
+
+ export IFS=$'\t\n'
+ TITLE="Lunar Distcc Optimizations"
- export IFS=$'\t\n'
- TITLE="Lunar Distcc Optimizations"
-
- while true; do
- RESULT=`$DIALOG --ok-label "Select" --cancel-label "Close" --menu "Use the Distributed C Compiler program distcc?" 0 0 0 "USE_DISTCC" "Use the distributed compiler [$USE_DISTCC]" "DISTCC_HOSTS" "Select remote target hosts..." "DISTCC_ALLOW" "Select allowed client hosts/networks..."`
- if [ $? != 0 ]; then
- break
- elif [ "$RESULT" == "USE_DISTCC" ]; then
- if [ $USE_DISTCC == 'yes' ]; then
- USE_DISTCC=no
- else
- USE_DISTCC=yes
- fi
- save_optimizations
- elif [ "$RESULT" == "DISTCC_HOSTS" ]; then
- DISTCC_HOSTS=`$DIALOG --inputbox "Enter a list of hosts as hostnames or IP addresses (see man distcc)" 9 60 $DISTCC_HOSTS`
- if [ $? != 0 ]; then
- continue
- else
- save_optimizations
- fi
- elif [ "$RESULT" == "DISTCC_ALLOW" ]; then
- DISTCC_ALLOW=`$DIALOG --inputbox "Enter a list of hosts or IP ranges (see man distccd).\n127.0.0.1 is already used by default." 9 60 $DISTCC_ALLOW`
- if [ $? != 0 ]; then
- continue
- else
- save_optimizations
- fi
- fi
- done
+ while true; do
+ RESULT=`$DIALOG --ok-label "Select" --cancel-label "Close" --menu "Use the Distributed C Compiler program distcc?" 0 0 0 "USE_DISTCC" "Use the distributed compiler [$USE_DISTCC]" "DISTCC_HOSTS" "Select remote target hosts..." "DISTCC_ALLOW" "Select allowed client hosts/networks..."`
+ if [ $? != 0 ]; then
+ break
+ elif [ "$RESULT" == "USE_DISTCC" ]; then
+ if [ $USE_DISTCC == 'yes' ]; then
+ USE_DISTCC=no
+ else
+ USE_DISTCC=yes
+ fi
+ save_optimizations
+ elif [ "$RESULT" == "DISTCC_HOSTS" ]; then
+ DISTCC_HOSTS=`$DIALOG --inputbox "Enter a list of hosts as hostnames or IP addresses (see man distcc)" 9 60 $DISTCC_HOSTS`
+ if [ $? != 0 ]; then
+ continue
+ else
+ save_optimizations
+ fi
+ elif [ "$RESULT" == "DISTCC_ALLOW" ]; then
+ DISTCC_ALLOW=`$DIALOG --inputbox "Enter a list of hosts or IP ranges (see man distccd).\n127.0.0.1 is already used by default." 9 60 $DISTCC_ALLOW`
+ if [ $? != 0 ]; then
+ continue
+ else
+ save_optimizations
+ fi
+ fi
+ done
}
diff --git a/libs/gpgme/plugin.d/verify-gpg.plugin b/libs/gpgme/plugin.d/verify-gpg.plugin
index c455ecc..f8155df 100644
--- a/libs/gpgme/plugin.d/verify-gpg.plugin
+++ b/libs/gpgme/plugin.d/verify-gpg.plugin
@@ -37,12 +37,12 @@ plugin_source_verify_gpg() {
verbose_msg "Downloading pub keys from \"$GPG_KEY\""
# TODO calling wget is a hack... we should accept file: urls too
if download_url $GPG_KEY $TMP_GPG_KEYS -q ; then
- TMP_GPG_OUTPUT=$(temp_create "gpg-output")
+ TMP_GPG_OUTPUT=$(temp_create "gpg-output")
GNUPGHOME=/var/state/lunar/gpg/ gpg --import $TMP_GPG_KEYS > $TMP_GPG_OUTPUT 2>&1
- grep -v 'not changed$' $TMP_GPG_OUTPUT | while read LINE; do
+ grep -v 'not changed$' $TMP_GPG_OUTPUT | while read LINE; do
message "${MESSAGE_COLOR}$LINE${DEFAULT_COLOR}"
- done
- temp_destroy $TMP_GPG_OUTPUT
+ done
+ temp_destroy $TMP_GPG_OUTPUT
fi
fi
@@ -53,19 +53,19 @@ plugin_source_verify_gpg() {
if download_url $GPG_SIG $TMP_GPG_SIG -q ; then
verbose_msg "Verifying signature of \"$SOURCE_CACHE/$1\""
verbose_msg "GNUPGHOME=/var/state/lunar/gpg/ gpg --verify $TMP_GPG_SIG $SOURCE_CACHE/$1"
- TMP_GPG_OUTPUT=$(temp_create "gpg-output")
+ TMP_GPG_OUTPUT=$(temp_create "gpg-output")
if ! GNUPGHOME=/var/state/lunar/gpg/ gpg --verify $TMP_GPG_SIG $SOURCE_CACHE/$1 > $TMP_GPG_OUTPUT 2>&1 ; then
verbose_msg "gpg exited with \"$?\""
RESULT=1
fi
- cat $TMP_GPG_OUTPUT | while read LINE; do
- if echo $LINE | grep -qw 'WARNING' ; then
+ cat $TMP_GPG_OUTPUT | while read LINE; do
+ if echo $LINE | grep -qw 'WARNING' ; then
message "${LRM_COLOR}$LINE${DEFAULT_COLOR}"
else
message "${MESSAGE_COLOR}$LINE${DEFAULT_COLOR}"
fi
- done
- temp_destroy $TMP_GPG_OUTPUT
+ done
+ temp_destroy $TMP_GPG_OUTPUT
else
message "cannot download key!"
RESULT=1
diff --git a/utils/ccache/plugin.d/optimize-ccache.plugin b/utils/ccache/plugin.d/optimize-ccache.plugin
index 71735f4..aa340e2 100644
--- a/utils/ccache/plugin.d/optimize-ccache.plugin
+++ b/utils/ccache/plugin.d/optimize-ccache.plugin
@@ -5,69 +5,67 @@
plugin_ccache_optimize()
{
- if [ -f /etc/lunar/local/optimizations.CCACHE ]; then
- . /etc/lunar/local/optimizations.CCACHE
- fi
-
- if [ "$USE_CCACHE" == "yes" ]; then
- # we PRE-pend ccache in case distcc is also used to
- # make sure that ccache goes first!
- echo $CC_EXT | grep -q "ccache" || CC_EXT="ccache $CC_EXT"
- echo $CXX_EXT | grep -q "ccache" || CXX_EXT="ccache $CXX_EXT"
- export CC_EXT
- export CXX_EXT
- verbose_msg "CC_EXT=\"$CC_EXT\""
- verbose_msg "CXX_EXT=\"$CXX_EXT\""
- fi
- return 2
+ if [ -f /etc/lunar/local/optimizations.CCACHE ]; then
+ . /etc/lunar/local/optimizations.CCACHE
+ fi
+
+ if [ "$USE_CCACHE" == "yes" ]; then
+ # we PRE-pend ccache in case distcc is also used to make sure that ccache goes first!
+ echo $CC_EXT | grep -q "ccache" || CC_EXT="ccache $CC_EXT"
+ echo $CXX_EXT | grep -q "ccache" || CXX_EXT="ccache $CXX_EXT"
+ export CC_EXT
+ export CXX_EXT
+ verbose_msg "CC_EXT=\"$CC_EXT\""
+ verbose_msg "CXX_EXT=\"$CXX_EXT\""
+ fi
+ return 2
}
plugin_ccache_optimize_menu()
{
- # The main code calls this function WITHOUT $1 to find out which
- # compiler optimization plugins exist. It then returns the version
- # number which will be saved in $LUNAR_COMPILER as the user's
- # choice for COMPILERS
- if [ -z "$1" ]; then
- echo "CCACHE"
- echo "Compiler Cache"
- return 2
- elif [ "$1" != "CCACHE" ]; then
- # we don't display anything when the user selected a
- # different menu
- return 2
- fi
+ # The main code calls this function WITHOUT $1 to find out which
+ # compiler optimization plugins exist. It then returns the version
+ # number which will be saved in $LUNAR_COMPILER as the user's
+ # choice for COMPILERS
+ if [ -z "$1" ]; then
+ echo "CCACHE"
+ echo "Compiler Cache"
+ return 2
+ elif [ "$1" != "CCACHE" ]; then
+ # we don't display anything when the user selected a different menu
+ return 2
+ fi
- # load previous optimizations
- if [ -e /etc/lunar/local/optimizations.CCACHE ]; then
- . /etc/lunar/local/optimizations.CCACHE
- fi
+ # load previous optimizations
+ if [ -e /etc/lunar/local/optimizations.CCACHE ]; then
+ . /etc/lunar/local/optimizations.CCACHE
+ fi
- save_optimizations()
- {
- debug_msg "save_optimizations($@)"
- cat > /etc/lunar/local/optimizations.CCACHE <<EOF
+ save_optimizations()
+ {
+ debug_msg "save_optimizations($@)"
+ cat > /etc/lunar/local/optimizations.CCACHE <<EOF
USE_CCACHE=$USE_CCACHE
EOF
- }
+ }
+
+ export IFS=$'\t\n'
+ TITLE="Lunar CCache Optimizations"
- export IFS=$'\t\n'
- TITLE="Lunar CCache Optimizations"
-
- while true; do
- RESULT=`$DIALOG --ok-label "Select" --cancel-label "Close" --menu "Use the C Compiler Cache program ccache? This will speed up subsequent compiliation of any module, at a small price." 0 0 0 "USE_CCACHE" "Use the Compiler Cache [$USE_CCACHE]"`
- if [ $? != 0 ]; then
- break
- else
- if [ $USE_CCACHE == 'yes' ]; then
- USE_CCACHE=no
- else
- USE_CCACHE=yes
- fi
- save_optimizations
- fi
- done
+ while true; do
+ RESULT=`$DIALOG --ok-label "Select" --cancel-label "Close" --menu "Use the C Compiler Cache program ccache? This will speed up subsequent compiliation of any module, at a small price." 0 0 0 "USE_CCACHE" "Use the Compiler Cache [$USE_CCACHE]"`
+ if [ $? != 0 ]; then
+ break
+ else
+ if [ $USE_CCACHE == 'yes' ]; then
+ USE_CCACHE=no
+ else
+ USE_CCACHE=yes
+ fi
+ save_optimizations
+ fi
+ done
}
diff --git a/utils/grub/plugin.d/bootloader-grub.plugin b/utils/grub/plugin.d/bootloader-grub.plugin
index 02a28c1..e49d7e8 100644
--- a/utils/grub/plugin.d/bootloader-grub.plugin
+++ b/utils/grub/plugin.d/bootloader-grub.plugin
@@ -14,142 +14,141 @@
map_devices_to_grub()
{
- local LINE DISC DEVICE TARGET REALTARGET MINOR
- debug_msg "map_devices_to_grub ($@)"
- # TODO - make sure partitions count continuously
- # TODO - check if ide, scsi, md is the correct order
- IFS=$' \t\n'
- for LINE in $(
- for N in /dev/{h,s}d{a,b,c,d,e,f,g,h}{,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} ; do
- if [[ -e "$N" ]] && grep -qw "${N/\/dev\//}" /proc/partitions ; then
- echo "$(readlink -f $N | sed -e 's/\/dev\/ide/0/g' \
- -e 's/\/dev\/scsi/1/g' | sort):$N:$(readlink -f $N)"
- fi
- done); do
- read DEVICE TARGET REALTARGET < <(echo ${LINE/:/ })
- MINOR=$(grep -w $(basename $DEVICE) /proc/partitions | awk '{print $2}')
- if (( MINOR % 16 == 0 )) ; then
- (( DISC++ ))
- PART=0
- echo "hd$((DISC-1)):$TARGET:$REALTARGET:"
- else
- (( PART++ ))
- echo "hd$((DISC-1)),$((PART-1)):$TARGET:$REALTARGET:"
- fi
- done
- IFS=$'\t\n'
+ local LINE DISC DEVICE TARGET REALTARGET MINOR
+ debug_msg "map_devices_to_grub ($@)"
+ # TODO - make sure partitions count continuously
+ # TODO - check if ide, scsi, md is the correct order
+ IFS=$' \t\n'
+ for LINE in $(
+ for N in /dev/{h,s}d{a,b,c,d,e,f,g,h}{,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} ; do
+ if [[ -e "$N" ]] && grep -qw "${N/\/dev\//}" /proc/partitions ; then
+ echo "$(readlink -f $N | sed -e 's/\/dev\/ide/0/g' -e 's/\/dev\/scsi/1/g' | sort):$N:$(readlink -f $N)"
+ fi
+ done); do
+ read DEVICE TARGET REALTARGET < <(echo ${LINE/:/ })
+ MINOR=$(grep -w $(basename $DEVICE) /proc/partitions | awk '{print $2}')
+ if (( MINOR % 16 == 0 )) ; then
+ (( DISC++ ))
+ PART=0
+ echo "hd$((DISC-1)):$TARGET:$REALTARGET:"
+ else
+ (( PART++ ))
+ echo "hd$((DISC-1)),$((PART-1)):$TARGET:$REALTARGET:"
+ fi
+ done
+ IFS=$'\t\n'
}
map_device_to_grub()
{
- debug_msg "map_device_to_grub ($@)"
- map_devices_to_grub | grep ":$(readlink -f $1):" | cut -d: -f1
+ debug_msg "map_device_to_grub ($@)"
+ map_devices_to_grub | grep ":$(readlink -f $1):" | cut -d: -f1
}
map_grub_to_device()
{
- debug_msg "map_grub_to_device($@)"
- local DEV
- DEV=$(echo "$1" | sed 's/[()]//g')
- unmap_device $(map_devices_to_grub | grep "^$DEV:" | cut -d: -f2)
+ debug_msg "map_grub_to_device($@)"
+ local DEV
+ DEV=$(echo "$1" | sed 's/[()]//g')
+ unmap_device $(map_devices_to_grub | grep "^$DEV:" | cut -d: -f2)
}
plugin_kernel_updatebootloader_grub()
{(
- # preferred? - master switch for experienced users
- if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "grub" ]; then
- return 2
- fi
- debug_msg "plugin_kernel_updatebootloader_grub ($@)"
-
- # we need to determine $GRUB_ROOT and $GRUB_BOOT, but ONLY when we are
- # not being called from the ISO, in which case we use the provided values
- # this test only checks GRUB_ROOT, because GRUB_BOOT might be empty
- if [ -z "$GRUB_ROOT" ]; then
- # determine if BOOT is a separate partition:
- BOOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/boot"){print $1}')
- # determine what to tell our kernel is the rootfs partition
- ROOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/"){print $1}')
- if [ -n "$BOOTPART" ]; then
- GRUB_BOOT=""
- else
- GRUB_BOOT="/boot"
- fi
- GRUB_ROOT="($(map_device_to_grub $ROOTPART))"
- debug_msg "grub: Using GRUB_BOOT=\"$GRUB_BOOT\""
- debug_msg "grub: Using GRUB_ROOT=\"$GRUB_ROOT\""
- fi
-
- print_grub_image()
- {
- CMDLINE=$(cat /proc/cmdline)
- debug_msg "title $2"
- debug_msg "kernel $GRUB_BOOT/$1 $CMDLINE"
- echo "title $2"
- echo "kernel $GRUB_BOOT/$1 $CMDLINE"
- echo ""
- }
-
- has_grub_title()
- {
- # really hard way of looking for a kernel label $1
- grep title "$2" | tr '\t' ' ' | tr -s ' ' | cut -d ' ' -f2- | grep -q "^$1$"
- }
-
- add_grub_image()
- {
- if ! has_grub_title "$2" /boot/grub/menu.lst ; then
- print_grub_image "$1" "$2" >> /boot/grub/menu.lst.new
- fi
- if [ -f /boot/"$1.old" ] && ! has_grub_title "$2.old" /boot/grub/menu.lst ; then
- print_grub_image "$1.old" "$2.old" >> /boot/grub/menu.lst.new
- fi
- }
-
- if ! ( has_grub_title "$2" /boot/grub/menu.lst && has_grub_title "$2.old" /boot/grub/menu.lst ) ; then
- export IFS=$'\n'
-
- rm -rf /boot/grub/menu.lst.new
- cp /boot/grub/menu.lst /boot/grub/menu.lst.old
-
- (( IMAGE_COUNT=0 ))
- for LINE in $(cat /boot/grub/menu.lst) ; do
- if echo $LINE | grep -q "title" ; then
- # To create a separating line between entries
- echo "" >> /boot/grub/menu.lst.new
-
- if (( IMAGE_COUNT == 0 )) ; then
- add_grub_image "$1" "$2"
- fi
- (( IMAGE_COUNT++ ))
- fi
- if (( IMAGE_COUNT == 14 )) ; then
- break
- fi
- echo $LINE >> /boot/grub/menu.lst.new
- done
-
- if (( IMAGE_COUNT == 0 )) ; then
- add_grub_image "$1" "$2"
- fi
-
- cp /boot/grub/menu.lst.new /boot/grub/menu.lst
- fi
-
- if query "Edit grub configuration manually ?" n ; then
- edit_file /boot/grub/menu.lst
- fi
-
- message ""
- message "${MESSAGE_COLOR}Warning: Do not forget to install grub to your MBR${DEFAULT_COLOR}"
- message "${MESSAGE_COLOR}if you have not done so before rebooting.${DEFAULT_COLOR}"
- message ""
-
- # right now we want to have it run all bootloaders?
- return 2
+ # preferred? - master switch for experienced users
+ if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "grub" ]; then
+ return 2
+ fi
+ debug_msg "plugin_kernel_updatebootloader_grub ($@)"
+
+ # we need to determine $GRUB_ROOT and $GRUB_BOOT, but ONLY when we are
+ # not being called from the ISO, in which case we use the provided values
+ # this test only checks GRUB_ROOT, because GRUB_BOOT might be empty
+ if [ -z "$GRUB_ROOT" ]; then
+ # determine if BOOT is a separate partition:
+ BOOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/boot"){print $1}')
+ # determine what to tell our kernel is the rootfs partition
+ ROOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/"){print $1}')
+ if [ -n "$BOOTPART" ]; then
+ GRUB_BOOT=""
+ else
+ GRUB_BOOT="/boot"
+ fi
+ GRUB_ROOT="($(map_device_to_grub $ROOTPART))"
+ debug_msg "grub: Using GRUB_BOOT=\"$GRUB_BOOT\""
+ debug_msg "grub: Using GRUB_ROOT=\"$GRUB_ROOT\""
+ fi
+
+ print_grub_image()
+ {
+ CMDLINE=$(cat /proc/cmdline)
+ debug_msg "title $2"
+ debug_msg "kernel $GRUB_BOOT/$1 $CMDLINE"
+ echo "title $2"
+ echo "kernel $GRUB_BOOT/$1 $CMDLINE"
+ echo ""
+ }
+
+ has_grub_title()
+ {
+ # really hard way of looking for a kernel label $1
+ grep title "$2" | tr '\t' ' ' | tr -s ' ' | cut -d ' ' -f2- | grep -q "^$1$"
+ }
+
+ add_grub_image()
+ {
+ if ! has_grub_title "$2" /boot/grub/menu.lst ; then
+ print_grub_image "$1" "$2" >> /boot/grub/menu.lst.new
+ fi
+ if [ -f /boot/"$1.old" ] && ! has_grub_title "$2.old" /boot/grub/menu.lst ; then
+ print_grub_image "$1.old" "$2.old" >> /boot/grub/menu.lst.new
+ fi
+ }
+
+ if ! ( has_grub_title "$2" /boot/grub/menu.lst && has_grub_title "$2.old" /boot/grub/menu.lst ) ; then
+ export IFS=$'\n'
+
+ rm -rf /boot/grub/menu.lst.new
+ cp /boot/grub/menu.lst /boot/grub/menu.lst.old
+
+ (( IMAGE_COUNT=0 ))
+ for LINE in $(cat /boot/grub/menu.lst) ; do
+ if echo $LINE | grep -q "title" ; then
+ # To create a separating line between entries
+ echo "" >> /boot/grub/menu.lst.new
+
+ if (( IMAGE_COUNT == 0 )) ; then
+ add_grub_image "$1" "$2"
+ fi
+ (( IMAGE_COUNT++ ))
+ fi
+ if (( IMAGE_COUNT == 14 )) ; then
+ break
+ fi
+ echo $LINE >> /boot/grub/menu.lst.new
+ done
+
+ if (( IMAGE_COUNT == 0 )) ; then
+ add_grub_image "$1" "$2"
+ fi
+
+ cp /boot/grub/menu.lst.new /boot/grub/menu.lst
+ fi
+
+ if query "Edit grub configuration manually ?" n ; then
+ edit_file /boot/grub/menu.lst
+ fi
+
+ message ""
+ message "${MESSAGE_COLOR}Warning: Do not forget to install grub to your MBR${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}if you have not done so before rebooting.${DEFAULT_COLOR}"
+ message ""
+
+ # right now we want to have it run all bootloaders?
+ return 2
)}
diff --git a/utils/lilo/plugin.d/bootloader-lilo.plugin b/utils/lilo/plugin.d/bootloader-lilo.plugin
index c37a6fc..9c6ae57 100644
--- a/utils/lilo/plugin.d/bootloader-lilo.plugin
+++ b/utils/lilo/plugin.d/bootloader-lilo.plugin
@@ -12,113 +12,112 @@
plugin_kernel_updatebootloader_lilo() {
- # preferred? - master switch for experienced users
- if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "lilo" ]; then
- return 2
- fi
- debug_msg "plugin_kernel_updatebootloader_lilo ($@)"
-
- IFS_OLD=$IFS
- export IFS=$'\n'
-
- rm -f /etc/lilo.conf.new
- cp /etc/lilo.conf /etc/lilo.conf.old
-
- output_image()
- {
- # and output the image lines
- if [ -n "$OTHER" ]; then
- echo "$OTHER"
- elif [ -n "$IMAGE" ]; then
- SLABEL=$(echo $LABEL | tr -d '[:blank:]' | sed 's/label=//')
- if [ "$SLABEL" == "$2" ]; then
- # rename this one to .old
- LABEL=" label = $2.old"
- SIMAGE=$(echo $IMAGE | tr -d '[:blank:]' | sed 's/image=//')
- if [ "$SIMAGE" == "/boot/$1" ]; then
- # rename the image too since the module
- # moved it to .old
- IMAGE="image = /boot/$1.old"
- fi
- elif [ "$SLABEL" == "$2.old" ]; then
- # delete this one!
- return
- fi
- echo "$IMAGE"
- fi
- echo "$LABEL"
- for OPTIONS in "${OPTIONS[@]}" ; do
- echo "$OPTIONS"
- done
- }
-
- (
- # defaulting to read-only?
- if sed '/other\|image/Q' /etc/lilo.conf | grep -wq "read-only" ; then
- READONLY=y
- fi
- # list all contents above the images first
- sed '/other\|image/Q' /etc/lilo.conf
-
- # we didn't have this label yet - insert it rightaway
- echo "image = /boot/$1"
- echo " label = $2"
- if [ -z "$READONLY" ]; then
- echo " read-only"
- fi
-
- (( IMAGE_COUNT=0 ))
- unset IMAGE OTHER LABEL OPTIONS
- # list old images
- while read LINE ; do
- if echo $LINE | grep -qw "image\|other" ; then
- (( IMAGE_COUNT++ ))
-
- # never loop beyond 14 images
- if (( IMAGE_COUNT == 15 )) ; then
- break
- fi
-
- # output and reset
- output_image $1 $2
- unset IMAGE OTHER LABEL OPTIONS
- fi
-
- # store the lines
- case $(echo "$LINE" | tr -d '[:blank:]') in
- image=*)
- IMAGE="$LINE"
- ;;
- other=*)
- OTHER="$LINE"
- ;;
- label=*)
- LABEL="$LINE"
- ;;
- *)
- OPTIONS=( "${OPTIONS[@]}" "$LINE" )
- ;;
- esac
- done < <(sed -n '/other\|image/,$p' /etc/lilo.conf)
-
- # write the last one too
- if [ -n "$LABEL" ] ;then
- output_image $1 $2
- fi
-
- ) > /etc/lilo.conf.new
-
- cp /etc/lilo.conf.new /etc/lilo.conf
- export IFS=$IFS_OLD
-
- if query "Edit lilo configuration manually ?" n ; then
- edit_file /etc/lilo.conf
- fi
-
- /sbin/lilo && sleep 1 || sleep 5
-
- # right now we want to have it run all bootloaders?
- return 2
+ # preferred? - master switch for experienced users
+ if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "lilo" ]; then
+ return 2
+ fi
+ debug_msg "plugin_kernel_updatebootloader_lilo ($@)"
+
+ IFS_OLD=$IFS
+ export IFS=$'\n'
+
+ rm -f /etc/lilo.conf.new
+ cp /etc/lilo.conf /etc/lilo.conf.old
+
+ output_image()
+ {
+ # and output the image lines
+ if [ -n "$OTHER" ]; then
+ echo "$OTHER"
+ elif [ -n "$IMAGE" ]; then
+ SLABEL=$(echo $LABEL | tr -d '[:blank:]' | sed 's/label=//')
+ if [ "$SLABEL" == "$2" ]; then
+ # rename this one to .old
+ LABEL=" label = $2.old"
+ SIMAGE=$(echo $IMAGE | tr -d '[:blank:]' | sed 's/image=//')
+ if [ "$SIMAGE" == "/boot/$1" ]; then
+ # rename the image too since the module moved it to .old
+ IMAGE="image = /boot/$1.old"
+ fi
+ elif [ "$SLABEL" == "$2.old" ]; then
+ # delete this one!
+ return
+ fi
+ echo "$IMAGE"
+ fi
+ echo "$LABEL"
+ for OPTIONS in "${OPTIONS[@]}" ; do
+ echo "$OPTIONS"
+ done
+ }
+
+ (
+ # defaulting to read-only?
+ if sed '/other\|image/Q' /etc/lilo.conf | grep -wq "read-only" ; then
+ READONLY=y
+ fi
+ # list all contents above the images first
+ sed '/other\|image/Q' /etc/lilo.conf
+
+ # we didn't have this label yet - insert it rightaway
+ echo "image = /boot/$1"
+ echo " label = $2"
+ if [ -z "$READONLY" ]; then
+ echo " read-only"
+ fi
+
+ (( IMAGE_COUNT=0 ))
+ unset IMAGE OTHER LABEL OPTIONS
+ # list old images
+ while read LINE ; do
+ if echo $LINE | grep -qw "image\|other" ; then
+ (( IMAGE_COUNT++ ))
+
+ # never loop beyond 14 images
+ if (( IMAGE_COUNT == 15 )) ; then
+ break
+ fi
+
+ # output and reset
+ output_image $1 $2
+ unset IMAGE OTHER LABEL OPTIONS
+ fi
+
+ # store the lines
+ case $(echo "$LINE" | tr -d '[:blank:]') in
+ image=*)
+ IMAGE="$LINE"
+ ;;
+ other=*)
+ OTHER="$LINE"
+ ;;
+ label=*)
+ LABEL="$LINE"
+ ;;
+ *)
+ OPTIONS=( "${OPTIONS[@]}" "$LINE" )
+ ;;
+ esac
+ done < <(sed -n '/other\|image/,$p' /etc/lilo.conf)
+
+ # write the last one too
+ if [ -n "$LABEL" ] ;then
+ output_image $1 $2
+ fi
+
+ ) > /etc/lilo.conf.new
+
+ cp /etc/lilo.conf.new /etc/lilo.conf
+ export IFS=$IFS_OLD
+
+ if query "Edit lilo configuration manually ?" n ; then
+ edit_file /etc/lilo.conf
+ fi
+
+ /sbin/lilo && sleep 1 || sleep 5
+
+ # right now we want to have it run all bootloaders?
+ return 2
}
diff --git a/utils/lunar-tools/plugin.d/lids.plugin b/utils/lunar-tools/plugin.d/lids.plugin
index 4204874..424afa2 100644
--- a/utils/lunar-tools/plugin.d/lids.plugin
+++ b/utils/lunar-tools/plugin.d/lids.plugin
@@ -12,38 +12,38 @@
plugin_lids_pre_remove()
{
- debug_msg "plugin_lids_pre_remove($@)"
- if [ -f /var/log/lunar/permissions/$MODULE-$VERSION ] ; then
- rm -f /var/log/lunar/permissions/$MODULE-$VERSION
- fi
+ debug_msg "plugin_lids_pre_remove($@)"
+ if [ -f /var/log/lunar/permissions/$MODULE-$VERSION ] ; then
+ rm -f /var/log/lunar/permissions/$MODULE-$VERSION
+ fi
}
plugin_lids_post_install()
{
- debug_msg "plugin_lids_post_install($@)"
- if [ "$USE_LIDS" != "on" ]; then
- return 2
- else
- /usr/sbin/lids create $MODULE
- fi
+ debug_msg "plugin_lids_post_install($@)"
+ if [ "$USE_LIDS" != "on" ]; then
+ return 2
+ else
+ /usr/sbin/lids create $MODULE
+ fi
}
plugin_module_check_lids()
{
- debug_msg "plugin_module_check_lids($@)"
- if [ "$USE_LIDS" != "on" ]; then
- return 2
- else
- if [ -f /var/log/lunar/permissions/$MODULE-$VERSION ] ; then
- if /usr/sbin/lids check $MODULE; then
- return 2
- fi
- else
- return 2
- fi
- fi
+ debug_msg "plugin_module_check_lids($@)"
+ if [ "$USE_LIDS" != "on" ]; then
+ return 2
+ else
+ if [ -f /var/log/lunar/permissions/$MODULE-$VERSION ] ; then
+ if /usr/sbin/lids check $MODULE; then
+ return 2
+ fi
+ else
+ return 2
+ fi
+ fi
}
More information about the Lunar-commits
mailing list