[Lunar-commits] <lunar> Backport of all outstanding changes in theedge: - new wrappers - new optimization plugins (you need to run lunar optimize!) - has_module_file generic code - GCCWRAPPERS obsoleted - remove := in favour of :- bash default assignment
Auke Kok
sofar at lunar-linux.org
Mon Jul 2 04:43:10 CEST 2012
commit 6a5762f4731f6ba197005a7b012bc427e30e8b98
Author: Auke Kok <sofar at lunar-linux.org>
Date: Wed Mar 22 01:54:48 2006 +0000
Backport of all outstanding changes in theedge:
- new wrappers
- new optimization plugins (you need to run lunar optimize!)
- has_module_file generic code
- GCCWRAPPERS obsoleted
- remove := in favour of :- bash default assignment
---
bin/lvu | 2 +-
etc/lunar/config | 43 +-
sbin/lunar | 32 +-
.../lunar/core-documentation/etc_lunar_config.html | 1 -
var/lib/lunar/compilers/c++ | 8 +-
var/lib/lunar/compilers/cc | 8 +-
var/lib/lunar/compilers/g++ | 8 +-
var/lib/lunar/compilers/gcc | 8 +-
var/lib/lunar/compilers/ld | 8 +-
var/lib/lunar/compilers/make | 8 +-
var/lib/lunar/functions/build.lunar | 25 +-
var/lib/lunar/functions/check.lunar | 42 +-
var/lib/lunar/functions/depends.lunar | 6 +-
var/lib/lunar/functions/download.lunar | 2 +-
var/lib/lunar/functions/init.lunar | 2 +-
var/lib/lunar/functions/main.lunar | 5 +-
var/lib/lunar/functions/messages.lunar | 2 +-
var/lib/lunar/functions/misc.lunar | 2 +-
var/lib/lunar/functions/modules.lunar | 36 +-
var/lib/lunar/functions/optimize.lunar | 842 ++------------------
var/lib/lunar/functions/plugins.lunar | 5 +-
var/lib/lunar/functions/sources.lunar | 8 +-
var/lib/lunar/functions/updatelog.lunar | 8 +-
var/lib/lunar/menu/dmodule.menu | 4 +-
var/lib/lunar/menu/download.menu | 12 +-
var/lib/lunar/plugins/download-generic.plugin | 2 +-
var/lib/lunar/unset.sh | 2 -
27 files changed, 225 insertions(+), 906 deletions(-)
diff --git a/bin/lvu b/bin/lvu
index a604d84..7bd8532 100755
--- a/bin/lvu
+++ b/bin/lvu
@@ -376,7 +376,7 @@ voyeur() {
follow_active_lin $MODULE
done
- DEFAULT_DELAY=${DEFAULT_DELAY:=60}
+ DEFAULT_DELAY=${DEFAULT_DELAY:-60}
while true ; do
if ! ACTIVE_MODULE=$(find_active_lin) ; then
diff --git a/etc/lunar/config b/etc/lunar/config
index 5a69e78..ac36810 100755
--- a/etc/lunar/config
+++ b/etc/lunar/config
@@ -42,33 +42,32 @@ export DIALOGRC=/etc/lunar/dialogrc
MODULE_INDEX=/var/state/lunar/module.index
INSTALL_CACHE=/var/cache/lunar
- SOURCE_CACHE=${SOURCE_CACHE:=/var/spool/lunar}
+ SOURCE_CACHE=${SOURCE_CACHE:-/var/spool/lunar}
# Override the following variables in /etc/lunar/local/config
# Or by exporting them before installing or removing.
- ARCHIVE=${ARCHIVE:=on}
- AUTOFIX=${AUTOFIX:=on}
- AUTOPRUNE=${AUTOPRUNE:=on}
- MAIL_REPORTS=${MAIL_REPORTS:=off}
- PRESERVE=${PRESERVE:=on}
- REAP=${REAP:=on}
- ADMIN=${ADMIN:=root}
- SOUND=${SOUND:=off}
- SUSTAIN=${SUSTAIN:=on}
- VIEW_REPORTS=${VIEW_REPORTS:=off}
- VOYEUR=${VOYEUR:=on}
- GARBAGE=${GARBAGE:=on}
- PROMPT_DELAY=${PROMPT_DELAY:=150}
- GCCWRAPPERS=${GCCWRAPPERS:=on}
- PROBE_EXPIRED=${PROBE_EXPIRED:=on}
- TMPFS=${TMPFS:=off}
+ ARCHIVE=${ARCHIVE:-on}
+ AUTOFIX=${AUTOFIX:-on}
+ AUTOPRUNE=${AUTOPRUNE:-on}
+ MAIL_REPORTS=${MAIL_REPORTS:-off}
+ PRESERVE=${PRESERVE:-on}
+ REAP=${REAP:-on}
+ ADMIN=${ADMIN:-root}
+ SOUND=${SOUND:-off}
+ SUSTAIN=${SUSTAIN:-on}
+ VIEW_REPORTS=${VIEW_REPORTS:-off}
+ VOYEUR=${VOYEUR:-on}
+ GARBAGE=${GARBAGE:-on}
+ PROMPT_DELAY=${PROMPT_DELAY:-150}
+ PROBE_EXPIRED=${PROBE_EXPIRED:-on}
+ TMPFS=${TMPFS:-off}
LUNAR_PRIORITY="+10"
- LDD_CHECK=${LDD_CHECK:=on}
- FIND_CHECK=${FIND_CHECK:=on}
- MD5SUM_CHECK=${MD5SUM_CHECK:=on}
- SYM_CHECK=${SYM_CHECK:=off}
+ LDD_CHECK=${LDD_CHECK:-on}
+ FIND_CHECK=${FIND_CHECK:-on}
+ MD5SUM_CHECK=${MD5SUM_CHECK:-on}
+ SYM_CHECK=${SYM_CHECK:-off}
GNU_URL=ftp://ftp.gnu.org/pub/gnu
KDE_URL=ftp://ftp.kde.org/pub/kde
@@ -85,7 +84,7 @@ export DIALOGRC=/etc/lunar/dialogrc
TRACKED="/bin /boot /etc /lib /sbin /usr /var /opt/lunar"
- TMPDIR=${TMPDIR:=/tmp}
+ TMPDIR=${TMPDIR:-/tmp}
DEFAULT="\e[0m"
BOLD="\e[1m"
diff --git a/sbin/lunar b/sbin/lunar
index 58456d7..b099e5d 100755
--- a/sbin/lunar
+++ b/sbin/lunar
@@ -511,20 +511,20 @@ feature_menu() {
X_HELP="When using --probe, also recompile modules if a newer version is available?"
Z_HELP="Custom modules in zlocal override equally named ones (NOT RECOMMENDED) ?"
- ARCHIVE=${ARCHIVE:=on}
- AUTORESURRECT=${AUTORESURRECT:=on}
- AUTOFIX=${AUTOFIX:=on}
- AUTOPRUNE=${AUTOPRUNE:=off}
- COLOR=${COLOR:=on}
- KEEP_SOURCE=${KEEP_SOURCE:=off}
- MAIL_REPORTS=${MAIL_REPORTS:=off}
- VIEW_REPORTS=${VIEW_REPORTS:=off}
- PRESERVE=${PRESERVE:=on}
- SOUND=${SOUND:=off}
+ ARCHIVE=${ARCHIVE:-on}
+ AUTORESURRECT=${AUTORESURRECT:-on}
+ AUTOFIX=${AUTOFIX:-on}
+ AUTOPRUNE=${AUTOPRUNE:-off}
+ COLOR=${COLOR:-on}
+ KEEP_SOURCE=${KEEP_SOURCE:-off}
+ MAIL_REPORTS=${MAIL_REPORTS:-off}
+ VIEW_REPORTS=${VIEW_REPORTS:-off}
+ PRESERVE=${PRESERVE:-on}
+ SOUND=${SOUND:-off}
SUSTAIN=${SUSTAIN:on}
- VOYEUR=${VOYEUR:=on}
- REAP=${REAP:=on}
- GARBAGE=${GARBAGE:=on}
+ VOYEUR=${VOYEUR:-on}
+ REAP=${REAP:-on}
+ GARBAGE=${GARBAGE:-on}
VERBOSE=${VERBOSE:off}
if [ -z $TMPFS ]; then
@@ -663,7 +663,7 @@ option_menu() {
F) feature_menu ;;
I) integrity_menu ;;
M) mirror_menu ;;
- O) . /var/lib/lunar/menu/optimize.menu && optimize_menu ;;
+ O) optimize_menu ;;
L) set_default_module ;;
A) set_accepted_licenses ;;
R) set_rejected_licenses ;;
@@ -789,7 +789,7 @@ main() {
export IFS="$TAB_ENTER_IFS"
- LUNAR_MODULE=${LUNAR_MODULE:=lunar}
+ LUNAR_MODULE=${LUNAR_MODULE:-lunar}
LUNAR_VERSION=$(run_details $LUNAR_MODULE && echo $UPDATED)
main_menu
@@ -823,7 +823,7 @@ else
renew ) renew ;;
update ) update ;;
rebuild ) rebuild ;;
- optimize ) . /var/lib/lunar/menu/optimize.menu && optimize_menu ;;
+ optimize ) optimize_menu ;;
set ) shift && setvar $@ ;;
unset ) shift && unsetvar $@ ;;
fix ) shift && run_fix $@ ;;
diff --git a/usr/share/doc/lunar/core-documentation/etc_lunar_config.html b/usr/share/doc/lunar/core-documentation/etc_lunar_config.html
index cccf4ce..3bc6a87 100644
--- a/usr/share/doc/lunar/core-documentation/etc_lunar_config.html
+++ b/usr/share/doc/lunar/core-documentation/etc_lunar_config.html
@@ -300,7 +300,6 @@ VIEW_REPORTS=${VIEW_REPORTS:=on}<br>
VOYEUR=${VOYEUR:=on}<br>
GARBAGE=${GARBAGE:=on}<br>
PROMPT_DELAY=${PROMPT_DELAY:=150}<br>
-GCCWRAPPERS=${GCCWRAPPERS:=on}<br>
LUNAR_PRIORITY="+10"<br>
MAX_SOURCES=100<br>
LDD_CHECK=${LDD_CHECK:=on}<br>
diff --git a/var/lib/lunar/compilers/c++ b/var/lib/lunar/compilers/c++
index 7ef04ca..dfa9256 100755
--- a/var/lib/lunar/compilers/c++
+++ b/var/lib/lunar/compilers/c++
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ $CXX_EXT ${COMPILER_PATH:-/usr/bin}/g++ $CCOPT \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $CXX_EXT $PROG $CCOPT $CXXFLAGS $@" >&2
fi
-$CXX_EXT ${COMPILER_PATH:-/usr/bin}/g++ $CCOPT "$@"
+exec $CXX_EXT $PROG $CCOPT $CXXFLAGS "$@"
diff --git a/var/lib/lunar/compilers/cc b/var/lib/lunar/compilers/cc
index e3bc069..e59e387 100755
--- a/var/lib/lunar/compilers/cc
+++ b/var/lib/lunar/compilers/cc
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ $CC_EXT ${COMPILER_PATH:-/usr/bin}/gcc $COPT \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $CC_EXT $PROG $COPT $CFLAGS $@" >&2
fi
-$CC_EXT ${COMPILER_PATH:-/usr/bin}/gcc $COPT "$@"
+exec $CC_EXT $PROG $COPT $CFLAGS "$@"
diff --git a/var/lib/lunar/compilers/g++ b/var/lib/lunar/compilers/g++
index 867b2d8..81b1611 100755
--- a/var/lib/lunar/compilers/g++
+++ b/var/lib/lunar/compilers/g++
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ $CXX_EXT ${COMPILER_PATH:-/usr/bin}/g++ $CCOPT \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $CXX_EXT $PROG $CCOPT $CXXFLAGS $@" >&2
fi
-$CXX_EXT ${COMPILER_PATH:-/usr/bin}/g++ $CCOPT "$@"
+exec $CXX_EXT $PROG $CCOPT $CXXFLAGS "$@"
diff --git a/var/lib/lunar/compilers/gcc b/var/lib/lunar/compilers/gcc
index e3bc069..e59e387 100755
--- a/var/lib/lunar/compilers/gcc
+++ b/var/lib/lunar/compilers/gcc
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ $CC_EXT ${COMPILER_PATH:-/usr/bin}/gcc $COPT \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $CC_EXT $PROG $COPT $CFLAGS $@" >&2
fi
-$CC_EXT ${COMPILER_PATH:-/usr/bin}/gcc $COPT "$@"
+exec $CC_EXT $PROG $COPT $CFLAGS "$@"
diff --git a/var/lib/lunar/compilers/ld b/var/lib/lunar/compilers/ld
index bfe42ce..50cef5f 100755
--- a/var/lib/lunar/compilers/ld
+++ b/var/lib/lunar/compilers/ld
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ ${LD_PATH:-/usr/bin}/ld \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $PROG $@" >&2
fi
-${LD_PATH:-/usr/bin}/ld "$@"
+exec $PROG "$@"
diff --git a/var/lib/lunar/compilers/make b/var/lib/lunar/compilers/make
index d03d395..2820d8a 100755
--- a/var/lib/lunar/compilers/make
+++ b/var/lib/lunar/compilers/make
@@ -1,8 +1,10 @@
#!/bin/bash
-if [ -n "$LUNAR_DEBUG" ] ; then
- echo "++ $MAKE_EXT ${MAKE_PATH:-/usr/bin}/make ${MAKES:+-j$MAKES} \"$@\"" >&2
+PROG=$(PATH=${PATH//\/var\/lib\/lunar\/compilers/} type -p ${0##*/})
+
+if [[ -n "$LUNAR_DEBUG" ]] ; then
+ echo "++ $MAKE_EXT $PROG ${MAKES:+-j$MAKES} $@" >&2
fi
-$MAKE_EXT ${MAKE_PATH:-/usr/bin}/make ${MAKES:+-j$MAKES} "$@"
+exec $MAKE_EXT $PROG ${MAKES:+-j$MAKES} "$@"
diff --git a/var/lib/lunar/functions/build.lunar b/var/lib/lunar/functions/build.lunar
index 899fd5f..d93e5f2 100644
--- a/var/lib/lunar/functions/build.lunar
+++ b/var/lib/lunar/functions/build.lunar
@@ -152,8 +152,6 @@ _configure()
{
debug_msg "_configure($@)"
if [ -e ./configure ]; then
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "LDFLAGS=\"$LDFLAGS\""
verbose_msg "./configure $@"
./configure $@
elif [ -e Makefile -o -e makefile ]; then
@@ -196,8 +194,6 @@ default_game_config() {
default_cvs_config() {
debug_msg "default_cvs_config ($@)"
verbose_msg "running \"default_cvs_config\""
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "LDFLAGS=\"$LDFLAGS\""
verbose_msg "MODULE_PREFIX=\"$MODULE_PREFIX\""
./autogen.sh --build=$BUILD \
@@ -335,19 +331,21 @@ run_configure() {
set_module_config OPTS "$OPTS"
fi
plugin_call BUILD_CONFIGURE $MODULE
- run_module_file $MODULE CONFIGURE
+ if has_module_file $MODULE CONFIGURE ; then
+ run_module_file $MODULE CONFIGURE
+ fi
}
run_pre_build() {
debug_msg "run_pre_build ($@)"
- message "${MESSAGE_COLOR}Building ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}"
+ message "${MESSAGE_COLOR}Building ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} version ${MODULE_COLOR}$VERSION${DEFAULT_COLOR}"
cd $BUILD_DIRECTORY
if verify_all_sources $MODULE ; then
plugin_call BUILD_PRE_BUILD $MODULE
- if [ -s $SCRIPT_DIRECTORY/PRE_BUILD ] ; then
+ if has_module_file $MODULE PRE_BUILD ; then
run_module_file $MODULE PRE_BUILD
else
if ! default_pre_build ; then
@@ -362,14 +360,19 @@ run_pre_build() {
run_build() {
debug_msg "run_build ($@)"
- if [ -d "$SOURCE_DIRECTORY" ] ; then
+ if [[ -d "$SOURCE_DIRECTORY" ]] ; then
cd $SOURCE_DIRECTORY
fi
verbose_msg "building \"$MODULE\" version \"$VERSION\" in `pwd`"
+ # this calls optimizations and others:
plugin_call BUILD_BUILD $MODULE
- if [ -s $SCRIPT_DIRECTORY/BUILD ] ; then
+ # now override compile wrappers if needed:
+ if [[ "${USE_WRAPPERS:-yes}" == "yes" ]]; then
+ export PATH=/var/lib/lunar/compilers:$PATH
+ fi
+ if has_module_file $MODULE BUILD ; then
run_module_file $MODULE BUILD
else
default_build
@@ -380,7 +383,7 @@ run_build() {
run_post_build() {
debug_msg "run_post_build ($@)"
- if [ -s $SCRIPT_DIRECTORY/POST_BUILD ] ; then
+ if has_module_file $MODULE POST_BUILD ; then
run_module_file $MODULE POST_BUILD
fi
default_post_build
@@ -390,7 +393,7 @@ run_post_build() {
run_post_install() {
debug_msg "run_post_install ($@)"
plugin_call BUILD_POST_INSTALL $MODULE
- if [ -s $SCRIPT_DIRECTORY/POST_INSTALL ] ; then
+ if has_module_file $MODULE POST_INSTALL ; then
run_module_file $MODULE POST_INSTALL
fi
}
diff --git a/var/lib/lunar/functions/check.lunar b/var/lib/lunar/functions/check.lunar
index 713185d..696e3ca 100644
--- a/var/lib/lunar/functions/check.lunar
+++ b/var/lib/lunar/functions/check.lunar
@@ -61,8 +61,8 @@ rework_module() {
debug_msg " run_depends ($@)"
(
if run_details $1 &> /dev/null ; then
- if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
- run_module_file $MODULE DEPENDS | grep -v '%'
+ if has_module_file $MODULE DEPENDS ; then
+ run_module_file $MODULE DEPENDS | grep -v '%'
fi
fi
)
@@ -109,21 +109,34 @@ run_fix() {
MODULES=$(list_installed | grep -v moonbase)
fi
+ if [[ -n "$FIXDEPENDS" ]] ; then
+ for MODULE in $MODULES ; do
+ fix_depends $MODULE
+ done
+ return
+ fi
+
+ # discover BROKEN modules
for MODULE in $MODULES ; do
- # ENV separation required here!
- (
- run_details $MODULE &&
- fix_depends $MODULE &&
+ if ! run_checks $MODULE ; then
+ BROKEN_MODULES=( ${BROKEN_MODULES[@]} $MODULE )
+ fi
+ done
- # if we were called with --fixdepends then we may skip the rest
- if [ -n "$FIXDEPENDS" ] ; then
- continue
- fi
+ # if we were called with --fixdepends then we may skip the rest
+ if [ -n "$FIXDEPENDS" ] ; then
+ return
+ fi
+
+ export TMP_LIN_SUCCESS=$(temp_create "successful")
+ export TMP_LIN_FAIL=$(temp_create "failed")
+ for MODULE in $(sort_by_dependency ${BROKEN_MODULES[@]}) ; do
+ (
+ run_details $MODULE &&
if module_installed $MODULE && ! module_held $MODULE ; then
-
if ! run_checks $MODULE ; then
- if [ -n "$NOFIX" ] ; then
+ if [[ -n "$NOFIX" ]] ; then
continue
fi
NEVER_ASK=1 DEPS_ONLY= satisfy_depends &&
@@ -143,6 +156,11 @@ run_fix() {
fi
)
done
+
+ display_update_log fix
+ temp_destroy $TMP_LIN_SUCCESS
+ temp_destroy $TMP_LIN_FAIL
+
}
diff --git a/var/lib/lunar/functions/depends.lunar b/var/lib/lunar/functions/depends.lunar
index 4297966..0c1358e 100644
--- a/var/lib/lunar/functions/depends.lunar
+++ b/var/lib/lunar/functions/depends.lunar
@@ -223,7 +223,7 @@ run_depends() {
}
grep -q "^"$MODULE"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
- if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
+ if has_module_file $MODULE DEPENDS ; then
if [ -n "$SINGLE_MODULE" ] ; then
# we only need to show this once, but we get here twice per module
message "${CHECK_COLOR}Checking dependencies for" \
@@ -318,7 +318,9 @@ conflicts() {
run_conflicts() {
debug_msg "run_conflicts ($@)"
- run_module_file $MODULE CONFLICTS
+ if has_module_file $MODULE CONFLICTS ; then
+ run_module_file $MODULE CONFLICTS
+ fi
}
diff --git a/var/lib/lunar/functions/download.lunar b/var/lib/lunar/functions/download.lunar
index f0ccf5c..1182f65 100644
--- a/var/lib/lunar/functions/download.lunar
+++ b/var/lib/lunar/functions/download.lunar
@@ -64,7 +64,7 @@ download_module() {
return 1
fi
- MAX_SOURCES=${MAX_SOURCES:=100}
+ MAX_SOURCES=${MAX_SOURCES:-100}
# loop over all sources
for (( N = 0 ; N < MAX_SOURCES ; N++ )) ; do
diff --git a/var/lib/lunar/functions/init.lunar b/var/lib/lunar/functions/init.lunar
index a62745a..5f8fc5e 100644
--- a/var/lib/lunar/functions/init.lunar
+++ b/var/lib/lunar/functions/init.lunar
@@ -59,7 +59,7 @@ root_check() {
# purpose : force niceness on lunar's processes
set_priority() {
debug_msg "set_priority ($@)"
- LUNAR_PRIORITY=${LUNAR_PRIORITY:="+10"}
+ LUNAR_PRIORITY=${LUNAR_PRIORITY:-"+10"}
renice "$LUNAR_PRIORITY" -p $$ 2> /dev/null >/dev/null
}
diff --git a/var/lib/lunar/functions/main.lunar b/var/lib/lunar/functions/main.lunar
index d2b0c35..d62066c 100644
--- a/var/lib/lunar/functions/main.lunar
+++ b/var/lib/lunar/functions/main.lunar
@@ -288,10 +288,7 @@ lin_module() {
# now entering the physical BUILD stage
if ! current_locked && ! solo_locked ; then
echo $$ > $linING &&
- start_logging &&
- if [ -z "$BUILD" ] ; then
- optimize
- fi &&
+ start_logging
if ! run_pre_build ; then
LIN_ERROR="PRE_BUILD"
diff --git a/var/lib/lunar/functions/messages.lunar b/var/lib/lunar/functions/messages.lunar
index ae95e3c..9b03b17 100644
--- a/var/lib/lunar/functions/messages.lunar
+++ b/var/lib/lunar/functions/messages.lunar
@@ -145,7 +145,7 @@ query() {
echo -e -n "${QUERY_COLOR}$1 [$2] ${DEFAULT_COLOR}"
read -t $PROMPT_DELAY -n 1 RESPONSE
if [ -z "$RESPONSE" ]; then
- RESPONSE=${RESPONSE:=$2}
+ RESPONSE=${RESPONSE:-$2}
else
echo
fi
diff --git a/var/lib/lunar/functions/misc.lunar b/var/lib/lunar/functions/misc.lunar
index 9b73c3e..16a1c91 100644
--- a/var/lib/lunar/functions/misc.lunar
+++ b/var/lib/lunar/functions/misc.lunar
@@ -146,7 +146,7 @@ find_pam_aware() {
custom_filters()
{
local FILE
- if [[ "${COMPRESS_MANPAGES:=on}" == "on" ]]; then
+ if [[ "${COMPRESS_MANPAGES:-on}" == "on" ]]; then
while read FILE; do
if [[ -f "$FILE" ]] ; then
if echo "$FILE" | grep '^/usr/share/man/.*\..$' | grep -q -v '\.gz$'; then
diff --git a/var/lib/lunar/functions/modules.lunar b/var/lib/lunar/functions/modules.lunar
index f4cbc96..2dfac45 100644
--- a/var/lib/lunar/functions/modules.lunar
+++ b/var/lib/lunar/functions/modules.lunar
@@ -164,7 +164,7 @@ find_section() {
local SECTION SECTIONS
debug_msg "find_section ($@)"
- if [[ "${ZLOCAL_OVERRIDES:=off}" == "on" ]] ; then
+ if [[ "${ZLOCAL_OVERRIDES:-off}" == "on" ]] ; then
if SECTION=$(find "$MOONBASE/zlocal/" -type d -name $1 | sed -e "s|$MOONBASE/||;s|/$1$||" ) ; then
if [[ -n "$SECTION" ]]; then
echo $SECTION
@@ -238,25 +238,29 @@ run_details() {
}
+has_module_file()
+{
+ if [[ -e "$SCRIPT_DIRECTORY/$2" ]] || [[ -e "$SCRIPT_DIRECTORY/$2.$PLATFORM" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+
# function : run_module_file
# usage : run_module_file $MODULE $SCRIPTNAME
# purpose : runs the given script for a pre-defined module
run_module_file() {
- debug_msg "run_module_file ($@)"
- if [ "$1" == "moonbase" ] ; then
- return 0
- fi
- if [ -z "$SCRIPT_DIRECTORY" ] ; then
- if ! run_details $1 > /dev/null ; then
- return 1
- fi
- fi
- CPU_ARCH=$(uname -m | sed 's/i[456]86/i386/')
- if [ -e "$SCRIPT_DIRECTORY/$2.$CPU_ARCH" ]; then
- . $SCRIPT_DIRECTORY/$2.$CPU_ARCH
- elif [ -e "$SCRIPT_DIRECTORY/$2" ] ; then
- . $SCRIPT_DIRECTORY/$2
- fi
+ debug_msg "run_module_file ($@)"
+ if [[ "$1" == "moonbase" ]] ; then
+ return 0
+ fi
+ if [[ -e "$SCRIPT_DIRECTORY/$2.$PLATFORM" ]]; then
+ . $SCRIPT_DIRECTORY/$2.$PLATFORM
+ elif [[ -e "$SCRIPT_DIRECTORY/$2" ]]; then
+ . $SCRIPT_DIRECTORY/$2
+ fi
}
diff --git a/var/lib/lunar/functions/optimize.lunar b/var/lib/lunar/functions/optimize.lunar
index 47016b0..03b3919 100644
--- a/var/lib/lunar/functions/optimize.lunar
+++ b/var/lib/lunar/functions/optimize.lunar
@@ -1,782 +1,68 @@
#!/bin/bash
-
-# All specified optimizations are system wide,
-# and apply to any module built using lin.
-
-# All settings in this function may be adjusted
-# in each modules BUILD script.
-
-# $PLATFORM = This sets the platform (x86, Sparc, PPC, etc..)
-# specific optimizations for the machine
-# $BOPT = This sets the base optimizations (the -O level)
-# it is applicable to all platforms and cpu types.
-# $CPU = This sets the specific cpu and arch type.
-# $SPD = This sets options that can increase the speed
-# of compiled binaries.
-# $XTRA = This specifies what type of extra instructions
-# to use for the specified cpu and platform.
-# $FPM = This sets the Floating Point Math use
-# of SSE instructions.
-# $LDF = This sets the system wide linking optimizations.
-
-
-
-# Usage : bad_flags "list of flags to remove"
-# Example : bad_flags -ffast-math -funroll-loops
-bad_flags() {
- debug_msg "bad_flags ($@)"
- verbose_msg "bad_flags \"$@\""
- if [[ "$1" == "ALL" ]]; then
- unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
- elif [[ "$1" == "compiler" ]]; then
- unset CFLAGS CXXFLAGS CPPFLAGS
- elif [[ "$1" == "linker" ]]; then
- unset LDFLAGS
- else
- for BAD_FLAG in "$@" ; do
- CFLAGS=$(echo $CFLAGS | sed s/$BAD_FLAG//)
- CXXFLAGS=$(echo $CXXFLAGS | sed s/$BAD_FLAG//)
- CPPFLAGS=$(echo $CPPFLAGS | sed s/$BAD_FLAG//)
- LDFLAGS=$(echo $LDFLAGS | sed s/$BAD_FLAG//)
- done
- fi
-}
-
-
-use_wrappers() {
- debug_msg "use_wrappers ($@)"
- if [ "${USE_WRAPPERS:-${GCCWRAPPERS:-on}}" == "on" ] ; then
- verbose_msg "Enabling gcc wrapper scripts to force optimizations"
- export PATH=/var/lib/lunar/compilers:${PATH}
- fi
-}
-
-
-optimize_make() {
- debug_msg "optimize_make ($@)"
- if [ "$PSAFE" == "no" ] ; then
- unset MAKES
- elif [ "$MAKES" == "1" ] ; then
- unset MAKES
- fi
- if module_installed linux-openmosix; then
- $MAKE_EXT="$MAKE_EXT mosrun -h"
- fi
-}
-
-
-optimize_base() {
- debug_msg "optimize_base ($@)"
- if ! [ "$1" ] ; then
- BOPT="None"
- fi
-
- if [[ $CFLAGS ]]; then
- unset CFLAGS CXXFLAGS
- fi
-
- case $1 in
- None) CFLAGS="-O0"
- CXXFLAGS="-O0"
- ;;
- Fast) CFLAGS="-O1"
- CXXFLAGS="-O1"
- ;;
- Faster) CFLAGS="-O2"
- CXXFLAGS="-O2"
- ;;
- Fastest) CFLAGS="-O3"
- CXXFLAGS="-O3"
- ;;
- Small) CFLAGS="-Os"
- CXXFLAGS="-Os"
- ;;
- esac
-}
-
-
-optimize_cpu() {
- debug_msg "optimize_cpu ($@)"
- if ! [[ $1 ]]; then
- if [[ $PLATFORM == "Alpha" ]]; then
- CPU="ev4"
- elif [[ $PLATFORM == "PowerPC" ]]; then
- CPU="powerpc"
- elif [[ $PLATFORM == "SPARC" ]]; then
- CPU="ultrasparc"
- elif [[ $PLATFORM == "x86_64" ]]; then
- CPU="x86_64"
- else
- CPU="I386"
- fi
- fi
-
-# Begin x86 options
- case $1 in
- I386) CFLAGS="$CFLAGS -march=i386"
- CXXFLAGS="$CXXFLAGS -march=i386"
- BUILD="i386-pc-linux-gnu"
- ;;
- I486) CFLAGS="$CFLAGS -march=i486"
- CXXFLAGS="$CXXFLAGS -march=i486"
- BUILD="i486-pc-linux-gnu"
- ;;
- I586) CFLAGS="$CFLAGS -march=i586"
- CXXFLAGS="$CXXFLAGS -march=i586"
- BUILD="i586-pc-linux-gnu"
- ;;
- I686) CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- ;;
- Pentium) CFLAGS="$CFLAGS -march=pentium"
- CXXFLAGS="$CXXFLAGS -march=pentium"
- BUILD="i586-pc-linux-gnu"
- ;;
- PentiumMMX) CFLAGS="$CFLAGS -march=pentium-mmx"
- CXXFLAGS="$CXXFLAGS -march=pentium-mmx"
- BUILD="i586-pc-linux-gnu"
- ;;
- PentiumPro) CFLAGS="$CFLAGS -march=pentiumpro"
- CXXFLAGS="$CXXFLAGS -march=pentiumpro"
- BUILD="i686-pc-linux-gnu"
- ;;
- Pentium2) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=pentium2"
- CXXFLAGS="$CXXFLAGS -march=pentium2"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- Pentium3) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=pentium3"
- CXXFLAGS="$CXXFLAGS -march=pentium3"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- Pentium4) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=pentium4"
- CXXFLAGS="$CXXFLAGS -march=pentium4"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- K6) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=k6"
- CXXFLAGS="$CXXFLAGS -march=k6"
- BUILD="i586-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i586"
- CXXFLAGS="$CXXFLAGS -march=k6"
- BUILD="i586-pc-linux-gnu"
- fi
- ;;
- K62) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=k6-2"
- CXXFLAGS="$CXXFLAGS -march=k6-2"
- BUILD="i586-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i586"
- CXXFLAGS="$CXXFLAGS -march=i586"
- BUILD="i586-pc-linux-gnu"
- fi
- ;;
- K63) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=k6-3"
- CXXFLAGS="$CXXFLAGS -march=k6-3"
- BUILD="i586-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i586"
- CXXFLAGS="$CXXFLAGS -march=i586"
- BUILD="i586-pc-linux-gnu"
- fi
- ;;
- Athlon) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon"
- CXXFLAGS="$CXXFLAGS -march=athlon"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- AthlonTBird) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon-tbird"
- CXXFLAGS="$CXXFLAGS -march=athlon-tbird"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- Athlon4) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon-4"
- CXXFLAGS="$CXXFLAGS -march=athlon-4"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- AthlonXP) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon-xp"
- CXXFLAGS="$CXXFLAGS -march=athlon-xp"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- AthlonMP) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon-mp"
- CXXFLAGS="$CXXFLAGS -march=athlon-mp"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
- Athlon64) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -march=athlon64"
- CXXFLAGS="$CXXFLAGS -march=athlon64"
- BUILD="i686-pc-linux-gnu"
- else
- CFLAGS="$CFLAGS -march=i686"
- CXXFLAGS="$CXXFLAGS -march=i686"
- BUILD="i686-pc-linux-gnu"
- fi
- ;;
-
-# Begin PowerPC options
- common) CFLAGS="$CFLAGS -mcpu=common"
- CXXFLAGS="$CXXFLAGS -mcpu=common"
- BUILD="power-linux"
- ;;
- rios) CFLAGS="$CFLAGS -mcpu=rios"
- CXXFLAGS="$CXXFLAGS -mcpu=rios"
- BUILD="power-linux"
- ;;
- rios1) CFLAGS="$CFLAGS -mcpu=rios1"
- CXXFLAGS="$CXXFLAGS -mcpu=rios1"
- BUILD="power-linux"
- ;;
- rsc) CFLAGS="$CFLAGS -mcpu=rsc"
- CXXFLAGS="$CXXFLAGS -mcpu=rsc"
- BUILD="power-linux"
- ;;
- rios2) CFLAGS="$CFLAGS -mcpu=rios2"
- CXXFLAGS="$CXXFLAGS -mcpu=rios2"
- BUILD="power-linux"
- ;;
- rs64a) CFLAGS="$CFLAGS -mcpu=rs64a"
- CXXFLAGS="$CXXFLAGS -mcpu=rs64a"
- BUILD="powerpc64-linux"
- ;;
- 403) CFLAGS="$CFLAGS -mcpu=403"
- CXXFLAGS="$CXXFLAGS -mcpu=403"
- BUILD="powerpc-linux"
- ;;
- 505) CFLAGS="$CFLAGS -mcpu=505"
- CXXFLAGS="$CXXFLAGS -mcpu=505"
- BUILD="powerpc-linux"
- ;;
- 601) CFLAGS="$CFLAGS -mcpu=601"
- CXXFLAGS="$CXXFLAGS -mcpu=601"
- BUILD="powerpc-linux"
- ;;
- 602) CFLAGS="$CFLAGS -mcpu=602"
- CXXFLAGS="$CXXFLAGS -mcpu=602"
- BUILD="powerpc-linux"
- ;;
- 603) CFLAGS="$CFLAGS -mcpu=603"
- CXXFLAGS="$CXXFLAGS -mcpu=603"
- BUILD="powerpc-linux"
- ;;
- 603e) CFLAGS="$CFLAGS -mcpu=603e"
- CXXFLAGS="$CXXFLAGS -mcpu=603e"
- BUILD="powerpc-linux"
- ;;
- 604) CFLAGS="$CFLAGS -mcpu=604"
- CXXFLAGS="$CXXFLAGS -mcpu=604"
- BUILD="powerpc-linux"
- ;;
- 604e) CFLAGS="$CFLAGS -mcpu=604e"
- CXXFLAGS="$CXXFLAGS -mcpu=604e"
- BUILD="powerpc-linux"
- ;;
- 620) CFLAGS="$CFLAGS -mcpu=620"
- CXXFLAGS="$CXXFLAGS -mcpu=620"
- BUILD="powerpc64-linux"
- ;;
- 630) CFLAGS="$CFLAGS -mcpu=630"
- CXXFLAGS="$CXXFLAGS -mcpu=630"
- BUILD="powerpc-linux"
- ;;
- 740) CFLAGS="$CFLAGS -mcpu=740"
- CXXFLAGS="$CXXFLAGS -mcpu=740"
- BUILD="powerpc-linux"
- ;;
- 7400) CFLAGS="$CFLAGS -mcpu=7400"
- CXXFLAGS="$CXXFLAGS -mcpu=7400"
- BUILD="powerpc-linux"
- ;;
- 7450) CFLAGS="$CFLAGS -mcpu=7450"
- CXXFLAGS="$CXXFLAGS -mcpu=7450"
- BUILD="powerpc-linux"
- ;;
- 750) CFLAGS="$CFLAGS -mcpu=750"
- CXXFLAGS="$CXXFLAGS -mcpu=750"
- BUILD="powerpc-linux"
- ;;
- 801) CFLAGS="$CFLAGS -mcpu=801"
- CXXFLAGS="$CXXFLAGS -mcpu=801"
- BUILD="powerpc-linux"
- ;;
- 821) CFLAGS="$CFLAGS -mcpu=821"
- CXXFLAGS="$CXXFLAGS -mcpu=821"
- BUILD="powerpc-linux"
- ;;
- 823) CFLAGS="$CFLAGS -mcpu=823"
- CXXFLAGS="$CXXFLAGS -mcpu=823"
- BUILD="powerpc-linux"
- ;;
- 860) CFLAGS="$CFLAGS -mcpu=860"
- CXXFLAGS="$CXXFLAGS -mcpu=860"
- BUILD="powerpc-linux"
- ;;
- power) CFLAGS="$CFLAGS -mcpu=power"
- CXXFLAGS="$CXXFLAGS -mcpu=power"
- BUILD="power-linux"
- ;;
- power2) CFLAGS="$CFLAGS -mcpu=power2"
- CXXFLAGS="$CXXFLAGS -mcpu=power2"
- BUILD="power-linux"
- ;;
- PowerPC) CFLAGS="$CFLAGS -mcpu=powerpc"
- CXXFLAGS="$CXXFLAGS -mcpu=powerpc"
- BUILD="powerpc-linux"
- ;;
-
-
-
-
-
-# Begin Alpha options
- ev4) CFLAGS="$CFLAGS -mcpu=ev4"
- CXXFLAGS="$CXXFLAGS -mcpu=ev4"
- BUILD="alpha-linux"
- ;;
- ev45) CFLAGS="$CFLAGS -mcpu=ev4"
- CXXFLAGS="$CXXFLAGS -mcpu=ev4"
- BUILD="alpha-linux"
- ;;
- ev5) CFLAGS="$CFLAGS -mcpu=ev5"
- CXXFLAGS="$CXXFLAGS -mcpu=ev5"
- BUILD="alpha-linux"
- ;;
- ev56) CFLAGS="$CFLAGS -mcpu=ev56"
- CXXFLAGS="$CXXFLAGS -mcpu=ev56"
- BUILD="alpha-linux"
- ;;
- pca56) CFLAGS="$CFLAGS -mcpu=pca56"
- CXXFLAGS="$CXXFLAGS -mcpu=pca56"
- BUILD="alpha-linux"
- ;;
- ev6) CFLAGS="$CFLAGS -mcpu=ev6"
- CXXFLAGS="$CXXFLAGS -mcpu=ev6"
- BUILD="alpha-linux"
- ;;
- ev67) CFLAGS="$CFLAGS -mcpu=ev67"
- CXXFLAGS="$CXXFLAGS -mcpu=ev67"
- BUILD="alpha-linux"
- ;;
- ev68) CFLAGS="$CFLAGS -mcpu=ev67"
- CXXFLAGS="$CXXFLAGS -mcpu=ev67"
- BUILD="alpha-linux"
- ;;
-# Begin SPARC options
- v7) CFLAGS="$CFLAGS -mcpu=v7"
- CXXFLAGS="$CXXFLAGS -mcpu=v7"
- BUILD="sparc-linux"
- ;;
- cypress) CFLAGS="$CFLAGS -mcpu=cypress"
- CXXFLAGS="$CXXFLAGS -mcpu=cypress"
- BUILD="sparc-linux"
- ;;
- v8) CFLAGS="$CFLAGS -mcpu=v8"
- CXXFLAGS="$CXXFLAGS -mcpu=v8"
- BUILD="sparc-linux"
- ;;
- supersparc) CFLAGS="$CFLAGS -mcpu=supersparc"
- CXXFLAGS="$CXXFLAGS -mcpu=supersparc"
- BUILD="sparc-linux"
- ;;
- sparclite) CFLAGS="$CFLAGS =mcpu=sparclite"
- CXXFLAGS="$CXXFLAGS =mcpu=sparclite"
- BUILD="sparc-linux"
- ;;
- hypersparc) CFLAGS="$CFLAGS -mcpu=hypersparc"
- CXXFLAGS="$CXXFLAGS -mcpu=hypersparc"
- BUILD="sparc-linux"
- ;;
- sparclite86x) CFLAGS="$CFLAGS -mcpu=sparclite86x"
- CXXFLAGS="$CXXFLAGS -mcpu=sparclite86x"
- BUILD="sparc-linux"
- ;;
- f930) CFLAGS="$CFLAGS -mcpu=f930"
- CXXFLAGS="$CXXFLAGS -mcpu=f930"
- BUILD="sparc-linux"
- ;;
- f934) CFLAGS="$CFLAGS -mcpu=f934"
- CXXFLAGS="$CXXFLAGS -mcpu=f934"
- BUILD="sparc-linux"
- ;;
- sparclet) CFLAGS="$CFLAGS -mcpu=sparclet"
- CXXFLAGS="$CXXFLAGS -mcpu=sparclet"
- BUILD="sparc-linux"
- ;;
- tsc701) CFLAGS="$CFLAGS -mcpu=tsc701"
- CXXFLAGS="$CXXFLAGS -mcpu=tsc701"
- BUILD="sparc-linux"
- ;;
- v9) CFLAGS="$CFLAGS -mcpu=v9"
- CXXFLAGS="$CXXFLAGS -mcpu=v9"
- BUILD="sparc-linux"
- ;;
- ultrasparc) CFLAGS="$CFLAGS -mcpu=ultrasparc"
- CXXFLAGS="$CXXFLAGS -mcpu=ultrasparc"
- BUILD="sparc-linux"
- ;;
- x86_64) CFLAGS="$CFLAGS"
- CXXFLAGS="$CXXFLAGS"
- BUILD="x86_64-pc-linux-gnu"
- ;;
- esac
-}
-
-
-optimize_speed() {
- debug_msg "optimize_speed ($@)"
- for A in ${SPD[@]}; do
- case $A in
- None) CFLAGS="$CFLAGS"
- CXXFLAGS="$CXXFLAGS"
- ;;
- Speedy) CFLAGS="$CFLAGS -funroll-loops"
- CXXFLAGS="$CXXFLAGS -funroll-loops"
- ;;
- Risky) CFLAGS="$CFLAGS -ffast-math"
- CXXFLAGS="$CXXFLAGS -ffast-math"
- ;;
- Pointers) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fomit-frame-pointer"
- CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
- fi
- ;;
- Siblings) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -foptimize-sibling-calls"
- CXXFLAGS="$CXXFLAGS"
- fi
- ;;
- Profiling) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fprofile-arcs"
- CXXFLAGS="$CXXFLAGS -fprofile-arcs"
- set_local_config "KEEP_SOURCE" "on"
- fi
- ;;
- Branching) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fbranch-probabilities"
- CXXFLAGS="$CXXFLAGS -fbranch-probabilities"
- fi
- ;;
- Aliasing) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fstrict-aliasing"
- CXXFLAGS="$CXXFLAGS -fstrict-aliasing"
- fi
- ;;
- Cprop) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fno-cprop-registers"
- CXXFLAGS="$CXXFLAGS -fno-cprop-registers"
- fi
- ;;
- Float) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -ffloat-store"
- CXXFLAGS="$CXXFLAGS -ffloat-store"
- fi
- ;;
- Address) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fforce-addr"
- CXXFLAGS="$CXXFLAGS -fforce-addr"
- fi
- ;;
- Align) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -falign-functions -falign-loops -falign-jumps"
- CXXFLAGS="$CXXFLAGS -falign-functions -falign-loops -falign-jumps"
- fi
- ;;
- Expensive) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -fexpensive-optimizations"
- CXXFLAGS="$CXXFLAGS -fexpensive-optimizations"
- fi
- ;;
- Doubles) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -malign-double"
- CXXFLAGS="$CXXFLAGS -malign-double"
- fi
- ;;
- Tracer) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -ftracer"
- CXXFLAGS="$CXXFLAGS -ftracer"
- fi
- ;;
- Blocks) if [[ $GCCVER == "3" ]] ; then
- CFLAGS="$CFLAGS -freorder-blocks"
- CXXFLAGS="$CXXFLAGS -freorder-blocks"
- fi
- ;;
- esac
- done
-}
-
-
-optimize_stack() {
- debug_msg "optimize_stack ($@)"
- if [[ $STACK > 0 ]] ; then
- if [ $PLATFORM == "x86" ] ; then
- CFLAGS="$CFLAGS -mpreferred-stack-boundary=$STACK"
- CXXFLAGS="$CXXFLAGS -mpreferred-stack-boundary=$STACK"
- CPPFLAGS="$CPPFLAGS -mpreferred-stack-boundary=$STACK"
- fi
- fi
-}
-
-
-optimize_extra() {
- debug_msg "optimize_extra ($@)"
- for A in ${XTRA[@]}; do
- case $A in
- None) CFLAGS="$CFLAGS"
- CXXFLAGS="$CXXFLAGS"
- ;;
- MMX) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -mmmx"
- CXXFLAGS="$CXXFLAGS -mmmx"
- fi
- ;;
- SSE) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -msse"
- CXXFLAGS="$CXXFLAGS -msse"
- fi
- ;;
- SSE2) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -msse2"
- CXXFLAGS="$CXXFLAGS -msse2"
- fi
- ;;
- SSE3) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -msse3"
- CXXFLAGS="$CXXFLAGS -msse3"
- fi
- ;;
- dnow) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -m3dnow"
- CXXFLAGS="$CXXFLAGS -m3dnow"
- fi
- ;;
- Altivec) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -maltivec"
- CXXFLAGS="$CXXFLAGS -maltivec"
- fi
- ;;
- esac
- done
-}
-
-
-# Set how floating point math is done
-optimize_fp() {
- debug_msg "optimize_fp ($@)"
- case $1 in
- x387) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -mfpmath=387"
- CXXFLAGS="$CXXFLAGS -mfpmath=387"
- fi
- ;;
- SSE) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -mfpmath=sse"
- CXXFLAGS="$CXXFLAGS -mfpmath=sse"
- fi
- ;;
- Both) if [[ $GCCVER == "3" ]]; then
- CFLAGS="$CFLAGS -mfpmath=sse,387"
- CXXFLAGS="$CXXFLAGS -mfpmath=sse,387"
- fi
- ;;
- None) CFLAGS="$CFLAGS"
- CXXFLAGS="$CXXFLAGS"
- ;;
- esac
-}
-
-
-# Set up the Linker optimizations
-optimize_ld() {
- local WL
- debug_msg "optimize_ld ($@)"
- if [[ $LDFLAGS ]]; then
- unset LDFLAGS
- fi
-
- for A in ${LDF[@]}; do
- case $A in
- Strip) LDFLAGS="$LDFLAGS -s" ;;
- Optimize) WL="$WL,-O1" ;;
- Reduce) WL="$WL,--as-needed" ;;
- Debug) LDFLAGS="$LDFLAGS -S" ;;
- Combreloc) LDFLAGS="$LDFLAGS -z combreloc" ;;
- esac
- done
- if [ -n "$WL" ]; then
- LDFLAGS="$LDFLAGS -Wl$WL"
- fi
-}
-
-
-optimize_addon() {
- debug_msg "optimize_addon ($@)"
- if ! [[ `grep ADDON /etc/lunar/local/optimizations` ]]; then
- echo ADDON=\( None \) >> /etc/lunar/local/optimizations
- ADDON=( None )
- fi
-
- for A in ${ADDON[@]}; do
- case $A in
- DistCC) if module_installed distcc; then
- CC_EXT="$CC_EXT distcc"
- CXX_EXT="$CXX_EXT distcc"
- else
- CC_EXT="$CC_EXT"
- CXX_EXT="$CXX_EXT"
- fi
- ;;
- CCache) if module_installed ccache; then
- CC_EXT="ccache $CC_EXT"
- CXX_EXT="ccache $CXX_EXT"
- else
- CC_EXT="$CC_EXT"
- CXX_EXT="$CXX_EXT"
- fi
- ;;
- GECC) CC_EXT="gecc"
- CXX_EXT="gecc"
- ;;
- esac
- done
- verbose_msg "CC_EXT=\"$CC_EXT\", CXX_EXT=\"$CXX_EXT\""
-}
-
-
-optimize_cc_opt() {
- debug_msg "optimize_cc_opt ($@)"
- for W in ${CC_OPTS[@]}; do
- case $W in
- Deprecated)
- CXXFLAGS="$CXXFLAGS -Wno-deprecated"
- CPPFLAGS="$CPPFLAGS -Wno-deprecated"
- ;;
- ccpipe)
- COPT="$COPT -pipe"
- ;;
- cxxpipe)
- CCOPT="$CCOPT -pipe"
- ;;
- esac
- done
-}
-
-
-optimize() {
- debug_msg "optimize ($@)"
- # Source in the optimization settings if it exists.
- if [ -s /etc/lunar/local/optimizations ] ; then
- . /etc/lunar/local/optimizations
- else
- verbose_msg "initializing optimizations with hard-coded defaults"
- echo -e PLATFORM=x86 '\n' \
-BUILD=i386-pc-linux-gnu '\n' \
-MAKES= '\n' \
-BOPT=-O0 '\n' \
-CPU=i386 '\n' \
-SPD=\( \) '\n' \
-STACK= '\n' \
-XTRA=\( \) '\n' \
-FPM= '\n' \
-CC_OPTS=\( \) '\n' \
-LDF=\( \) '\n' \
-ADDON=\( \) > /etc/lunar/local/optimizations
- fi
-
- #lets get the BUILD if it is not defined
- [ -z "$BUILD" ] && optimize_cpu $CPU
- [ -n "$BUILD" ] && export BUILD ||
- echo "Set your optimization preferences via lunar"
-
- unset CFLAGS CXXFLAGS LDFLAGS
-
- optimize_make $MAKES &&
- optimize_base $BOPT &&
- optimize_cpu $CPU &&
- optimize_speed ${SPD[@]} &&
- optimize_extra ${XTRA[@]} &&
- optimize_fp $FPM &&
- optimize_cc_opt &&
- optimize_ld ${LDF[@]} &&
- optimize_addon &&
-
- case $PLATFORM in
- x86)
- optimize_stack
- ;;
- esac
-
- local GCC_REALVERSION=$(${COMPILER_PATH:-/usr/bin}/gcc --version | head -n 1 | awk '{print $3}')
- if [ "$(echo $GCC_REALVERSION | cut -d. -f1,2)" == "3.4" \
- -o "$(echo $GCC_REALVERSION | cut -d. -f1)" == "4" ] ; then
- CFLAGS=$(echo $CFLAGS | sed 's:-mcpu:-mtune:')
- CXXFLAGS=$(echo $CXXFLAGS | sed 's:-mcpu:-mtune:')
- fi
-
- export CC_EXT
- export CXX_EXT
- export MAKE_EXT
- export COPT
- export CCOPT
- export CFLAGS
- export CXXFLAGS
- export LDFLAGS
- export MAKES
-
- use_wrappers
- verbose_msg "BUILD=\"$BUILD\""
- verbose_msg "GCCVER=\"$GCCVER\""
- verbose_msg "CFLAGS=\"$CFLAGS\""
- verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
- verbose_msg "LDFLAGS=\"$LDFLAGS\""
+############################################################
+# #
+# optimize.lunar - Lunar general optimization code #
+# #
+############################################################
+# #
+# Copyright 2006 by Auke Kok under GPLv2 #
+# #
+############################################################
+
+
+bad_flags()
+{
+ debug_msg "bad_flags ($@)"
+ verbose_msg "bad_flags \"$@\""
+
+ # maintain some degree of backward compatibility here
+ if [[ "$1" == "ALL" ]]; then
+ unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+ elif [[ "$1" == "compiler" ]]; then
+ unset CFLAGS CXXFLAGS CPPFLAGS
+ elif [[ "$1" == "linker" ]]; then
+ unset LDFLAGS
+ else
+ for BAD_FLAG in "$@" ; do
+ CFLAGS=$(echo $CFLAGS | sed s/$BAD_FLAG//)
+ CXXFLAGS=$(echo $CXXFLAGS | sed s/$BAD_FLAG//)
+ CPPFLAGS=$(echo $CPPFLAGS | sed s/$BAD_FLAG//)
+ LDFLAGS=$(echo $LDFLAGS | sed s/$BAD_FLAG//)
+ done
+ fi
}
+optimize_menu()
+{(
+ export IFS=$'\t\n'
+ while true; do
+ if [ -z "$(plugin_call OPTIMIZE_MENU)" ]; then
+ $DIALOG --msgbox "There are no configurable compontents. Please update your moonbase!" 6 60
+ return
+ fi
+ PLUGIN=`$DIALOG --cancel-label "Close" --menu "Select a component for which to configure optimizations" 0 0 0 $(plugin_call OPTIMIZE_MENU)`
+ if [ $? != 0 ]; then
+ return
+ fi
+
+ plugin_call OPTIMIZE_MENU $PLUGIN
+ done
+)}
+
+
+# because we pretty much need to know our $BUILD string
+# everywhere this code is separate and guides all other
+# parts of lunar where related things are done. Here we
+# autodetect the most important part but leave it open
+# to the user to override it
+
+# PLATFORM - translated uname -m / arch
+PLATFORM=$(uname -m | sed 's/i[3456]86/x86/')
+# BUILD -
+case $PLATFORM in
+ x86|x86_64)
+ BUILD=$(uname -m)-pc-linux-gnu ;;
+ *)
+ BUILD=$(uname -m | sed 's/.*/\L&/g')-linux-gnu ;;
+esac
diff --git a/var/lib/lunar/functions/plugins.lunar b/var/lib/lunar/functions/plugins.lunar
index 821e943..b4770aa 100644
--- a/var/lib/lunar/functions/plugins.lunar
+++ b/var/lib/lunar/functions/plugins.lunar
@@ -37,6 +37,7 @@ plugin_register() {
# 12 - BUILD_POST_INSTALL ,, ,, ,, POST_INSTALL
# 13 - BUILD_PRE_REMOVE ,, ,, ,, PRE_REMOVE
# 14 - BUILD_POST_REMOVE ,, ,, ,, POST_REMOVE
+ # 15 - OPTIMIZE_MENU Display optimization menu's
LUNAR_PLUGINS=(${LUNAR_PLUGINS[@]} "$1:$2")
((LUNAR_PLUGIN_COUNT++))
debug_msg "Registered plugin #$LUNAR_PLUGIN_COUNT, $1 -> $2()"
@@ -50,8 +51,8 @@ plugin_call() {
REQUESTED_TYPE=$1
shift
for ((COUNT=0; COUNT < $LUNAR_PLUGIN_COUNT; COUNT++)); do
- THIS_TYPE=$(echo ${LUNAR_PLUGINS[$COUNT]} | cut -d: -f1)
- THIS_HANDLER=$(echo ${LUNAR_PLUGINS[$COUNT]} | cut -d: -f2-)
+ THIS_TYPE=${LUNAR_PLUGINS[$COUNT]%%:*}
+ THIS_HANDLER=${LUNAR_PLUGINS[$COUNT]#*:}
if [ "$REQUESTED_TYPE" == "$THIS_TYPE" ]; then
# we have identified a valid plugin for this type
$THIS_HANDLER $@
diff --git a/var/lib/lunar/functions/sources.lunar b/var/lib/lunar/functions/sources.lunar
index b1a2ea0..b8089bc 100644
--- a/var/lib/lunar/functions/sources.lunar
+++ b/var/lib/lunar/functions/sources.lunar
@@ -40,7 +40,7 @@ verify_source() {
sources() {
(
debug_msg "sources ($@)"
- MAX_SOURCES=${MAX_SOURCES:=100}
+ MAX_SOURCES=${MAX_SOURCES:-100}
if ! run_details $1 ; then
return 1
@@ -96,7 +96,7 @@ unpack() {
verify_all_sources() {
(
debug_msg "verify_all_sources ($@)"
- MAX_SOURCES=${MAX_SOURCES:=100}
+ MAX_SOURCES=${MAX_SOURCES:-100}
if ! run_details $1 ; then
return 1
@@ -170,7 +170,7 @@ rm_source_dir() {
cd $BUILD_DIRECTORY
DEAD_DIR=$1
- DEAD_DIR=${DEAD_DIR:=$SOURCE_DIRECTORY}
+ DEAD_DIR=${DEAD_DIR:-$SOURCE_DIRECTORY}
verbose_msg "destroying building dir \"$DEAD_DIR\""
if [ "$TMPFS" != "off" ] ; then
@@ -193,7 +193,7 @@ mk_source_dir() {
fi
cd "$BUILD_DIRECTORY"
NEW_DIR=$1
- NEW_DIR=${NEW_DIR:=$SOURCE_DIRECTORY}
+ NEW_DIR=${NEW_DIR:-$SOURCE_DIRECTORY}
verbose_msg "creating building dir \"$NEW_DIR\""
if [ "$TMPFS" != "off" ] ; then
diff --git a/var/lib/lunar/functions/updatelog.lunar b/var/lib/lunar/functions/updatelog.lunar
index 54aa6eb..e5fba73 100644
--- a/var/lib/lunar/functions/updatelog.lunar
+++ b/var/lib/lunar/functions/updatelog.lunar
@@ -37,13 +37,13 @@ display_success_info() {
local NUMSUCCESS NUMFAILURES
debug_msg "display_success_info ($@)"
- NUMSUCCESS=$(cat $TMP_LIN_SUCCESS | wc -l)
- NUMFAILURES=$(cat $TMP_LIN_FAIL | wc -l)
+ NUMSUCCESS=$(wc -l $TMP_LIN_SUCCESS | cut -d" " -f1)
+ NUMFAILURES=$(wc -l $TMP_LIN_FAIL | cut -d" " -f1)
message
message "${MESSAGE_COLOR}Lunar $1 completed at `date`${DEFAULT_COLOR}"
- message "Successful : " $NUMSUCCESS
- message "Failed : " $NUMFAILURES
+ message "Successful : $NUMSUCCESS"
+ message "Failed : $NUMFAILURES"
message
if [ "$NUMSUCCESS" -gt "0" ]; then
diff --git a/var/lib/lunar/menu/dmodule.menu b/var/lib/lunar/menu/dmodule.menu
index 565dcb9..c5e9cfa 100644
--- a/var/lib/lunar/menu/dmodule.menu
+++ b/var/lib/lunar/menu/dmodule.menu
@@ -32,8 +32,8 @@ The modules MUST exist in the moonbase and MUST meet
some common criteria. Better do not hack by yourself."
LUNAR_MODULES=$(echo "$LUNAR_MODULES" | tr " " "\t")
- LUNAR_MODULES=${LUNAR_MODULES:=lunar}
- LUNAR_MODULE=${LUNAR_MODULE:=lunar}
+ LUNAR_MODULES=${LUNAR_MODULES:-lunar}
+ LUNAR_MODULE=${LUNAR_MODULE:-lunar}
unset SDM
for LUNAR in $LUNAR_MODULES ; do
diff --git a/var/lib/lunar/menu/download.menu b/var/lib/lunar/menu/download.menu
index 744ef6e..2fd0442 100644
--- a/var/lib/lunar/menu/download.menu
+++ b/var/lib/lunar/menu/download.menu
@@ -140,8 +140,8 @@ download problems, select active ftp option.
This option can also be set per module basis. Add
FTP_ACTIVE=on in DETAILS file :=) or vice-versa."
- FTP_ACTIVE=${FTP_ACTIVE:=off}
- FTP_PASSIVE=${FTP_PASSIVE:=on}
+ FTP_ACTIVE=${FTP_ACTIVE:-off}
+ FTP_PASSIVE=${FTP_PASSIVE:-on}
[ "$FTP_ACTIVE" == "on" ] &&
FTP_PASSIVE=off ||
@@ -176,7 +176,7 @@ and works fine on almost all cases.
This option can also be set per module basis. Add
CONTINUE=off in DETAILS file :=) or vice-versa."
- CONTINUE=${CONTINUE:=on}
+ CONTINUE=${CONTINUE:-on}
PARTIAL=`$DIALOG --title "Partial Downloads" \
--ok-label "Commit" \
@@ -207,7 +207,7 @@ a Pragma: no-cache directive to http server.
This option can also be set per module basis. Add
USE_CACHE=off in DETAILS file :=) or vice-versa."
- USE_CACHE=${USE_CACHE:=on}
+ USE_CACHE=${USE_CACHE:-on}
CACHE=`$DIALOG --title "Cache Usage" \
--ok-label "Commit" \
@@ -236,7 +236,7 @@ number of retries.
This option can also be set per module basis. Add
NUM_RETRY=<n> in DETAILS file :=)"
- NUM_RETRY=${NUM_RETRY:=5}
+ NUM_RETRY=${NUM_RETRY:-5}
if NUM_RETRY=`$DIALOG --title "Number of Retries" \
--ok-label "Commit" \
@@ -257,7 +257,7 @@ This is not recommended for normal downloads, broken downloads
should be reported to maintainer at lunar-linux.org.
"
- EXHAUSTIVE=${EXHAUSTIVE:=off}
+ EXHAUSTIVE=${EXHAUSTIVE:-off}
EXHAUSTIVE=`$DIALOG --title "Exhaustive mirror testing: " \
--ok-label "Commit" \
diff --git a/var/lib/lunar/plugins/download-generic.plugin b/var/lib/lunar/plugins/download-generic.plugin
index 8c39958..5117b2e 100644
--- a/var/lib/lunar/plugins/download-generic.plugin
+++ b/var/lib/lunar/plugins/download-generic.plugin
@@ -46,7 +46,7 @@ plugin_source_download_generic() {
WGET_RATE="--limit-rate=${DOWNLOAD_RATE}"
fi
- WGET_RETRIES="--tries=${NUM_RETRY:=5}"
+ WGET_RETRIES="--tries=${NUM_RETRY:-5}"
[ -n "$http_proxy" ] && export http_proxy=$http_proxy
[ -n "$ftp_proxy" ] && export ftp_proxy=$ftp_proxy
diff --git a/var/lib/lunar/unset.sh b/var/lib/lunar/unset.sh
index 755b2e2..4e369d0 100644
--- a/var/lib/lunar/unset.sh
+++ b/var/lib/lunar/unset.sh
@@ -32,8 +32,6 @@ unset FPM
unset FTP_ACTIVE
unset FUNCTIONS
unset GARBAGE
-unset GCCVER
-unset GCCWRAPPERS
unset GNOME_URL
unset GNU_URL
unset GREEN
More information about the Lunar-commits
mailing list