summaryrefslogblamecommitdiffstats
path: root/FUNCTIONS
blob: f854259a4ae25002b8d27a0c6712af782c9c5279 (plain) (tree)
1
2
3
4
5
6
7
8
9

                      
                                       

                                                                      

                                                                  
                                                                      
                               
                
                        

























































                                                                                      











































































































                                                                                               











                                                                      
















                                                                           
                                                                     

























                                                                       
                                                           








                                                                               
                                                                                             











                                                                               




                                                                      




























                                                                                                                          






                                                                                                  


































































































                                                                                                









                                                                          

                                                                          
                                                 
 
 



                                                                          

                           
 







                                                         








                                                   
 



























                                                                                   







                                                                                             


                                  

 





                                                                             
                                               


                                                
             


                       
               
 

                                                   
               




                                                              


             


                                                
             
 
 
                                      









                                                                  



                                                             

                                                
                          
      
                               



            
 











                                                                             















































































































                                                                            



































                                                                             


                    
 
                                    


                                                                
                                                            













                                                                             




               
 


                              
. $GRIMOIRE/libaccount
. $GRIMOIRE/libgcc
. $GRIMOIRE/config_query_multi.function

#---------------------------------------------------------------------
## Replaces sorcerys default_pre_build with a custom version using
## the invoke_gcc function from libgcc #10641
#---------------------------------------------------------------------
function default_pre_build () {
  invoke_gcc  &&
  real_default_pre_build
}

#---------------------------------------------------------------------
## @return 0 if glibc was compiled with NPTL
## @return 1 otherwise
##
## Detects if the current glibc includes NPTL support.
##
#---------------------------------------------------------------------
function glibc_is_nptl ()
{
  if getconf GNU_LIBPTHREAD_VERSION | grep -q NPTL; then
    return 0
  fi
  return 1
}

#---------------------------------------------------------------------
# Runs update-desktop-database if it is installed
#---------------------------------------------------------------------
function update_desktop_database ()
{
  if test -x /usr/bin/update-desktop-database; then
    message "${MESSAGE_COLOR}Updating application mime type database.${DEFAULT_COLOR}"
    /usr/bin/update-desktop-database
  fi
}

#---------------------------------------------------------------------
## this function installs the *.desktop, start* files and qingy links
## this function is intended to be used by spells for windowmanagers
#---------------------------------------------------------------------
function install_wmfiles ()
{
  local wm_desktopfile_dir="${INSTALL_ROOT}/usr/share/xsessions"
  local wm_startwm_dir="${INSTALL_ROOT}/usr/bin"

  # install the start* file for the windowmanager if it's not
  # installed already
  if [ -f ${SCRIPT_DIRECTORY}/start${SPELL} ] ; then
    if ! [ -e ${wm_startwm}/start${SPELL} ] ; then
      install  -m  755  ${SCRIPT_DIRECTORY}/start${SPELL}     \
                        ${wm_startwm_dir}
    fi
  fi

  # making sure the destination directory exists
  if ! [ -d  ${wm_desktopfile_dir} ] ; then
      mkdir  ${wm_desktopfile_dir}
  fi                                                        &&

  # install the windowmanagers desktop file
  if [ -f ${SCRIPT_DIRECTORY}/${SPELL}.desktop ] ; then
    if ! [ -e ${wm_desktopfile_dir}/${SPELL}.desktop ]; then
      install  -m  755  ${SCRIPT_DIRECTORY}/${SPELL}.desktop   \
                        ${wm_desktopfile_dir}
    fi
  fi
}

#---------------------------------------------------------------------
## Sets the current script to run only one make job
#---------------------------------------------------------------------

function make_single ()
{
  JOBS_PER_HOST=0  &&
     MAKE_NJOBS=1
}

#---------------------------------------------------------------------
## Re-enables the normal Sorcery make (cancels single_make)
#---------------------------------------------------------------------

function make_normal ()
{
  source $COMPILE_CONFIG
}

#---------------------------------------------------------------------
## @param shellname
## @param full path to shell
##
## Adds a shell to /etc/shells and optionally to qingy's sessions
#---------------------------------------------------------------------
function install_shell ()
{
  local qingy_session_dir="${INSTALL_ROOT}/etc/qingy/sessions"

  if [ -z "$1" ] ; then
    message "${PROBLEM_COLOR}no shell name specified, aborting${DEFAULT_COLOR}"
    return 1
  fi &&
  if [ ! -e "$2" ] ; then
    message "${PROBLEM_COLOR} $2 isn't executable, no use adding it as a shell${DEFAULT_COLOR}"
    return 1
  fi &&

  #installing shell into /etc/shells
  message "installing $1 into /etc/shells"
  if ! ( grep -q "^${2}$" ${INSTALL_ROOT}/etc/shells ) ; then
    echo "$2" >> ${INSTALL_ROOT}/etc/shells
  fi || return 1

  #installing shell into qingy's session dir if it's installed
  if ( spell_ok qingy ) && ! [ -f ${qingy_session_dir}/$1 ] ; then
    message "installing $1 into $qingy_session_dir"
    echo "$2" > ${qingy_session_dir}/$1 &&
    chmod 0755 ${qingy_session_dir}/$1
  fi
}

#---------------------------------------------------------------------
## @param shellname
## @param full path to shell
##
## Removes a shell from /etc/shells and optionally from qingy's sessions
#---------------------------------------------------------------------
function remove_shell ()
{
  local qingy_session_dir="${INSTALL_ROOT}/etc/qingy/sessions"

  if [ -z "$1" ] ; then
    message "${PROBLEM_COLOR}no shell name specified, aborting${DEFAULT_COLOR}"
    return 1
  fi &&
  if [ -z "$2" ] ; then
    message "${PROBLEM_COLOR}no shell path specified, aborting${DEFAULT_COLOR}"
    return 1
  fi &&

  #removing shell from /etc/shells
  if  [  -f  /etc/shells  ]  ;  then
    sedit "\:^$2$:d"  /etc/shells
  fi

  # and optionally from qingy's session dir
  if [ -f ${qingy_session_dir}/$1 ] ; then
    message "removing $1 from $qingy_session_dir"
    rm -f ${qingy_session_dir}/$1
  fi
}


#---------------------------------------------------------------------
## replacement for config_query_string to work around a short timeout
## when entering long strings (hostnames, organisation names)
#---------------------------------------------------------------------
function config_query_long_string() {
    local ANSWER
    local DELAY=5 
    if config_get_option "$1" ANSWER; then
        # option allready answered in config
        echo -e "[[ ${QUERY_COLOR}$2${DEFAULT} -> '${QUERY_COLOR}$ANSWER${DEFAULT}' ]]"
    else
        query_string ANSWER "$2" "$3"
        read -t $DELAY -n 1 ANSWER_first
        if [[ $ANSWER_first ]] ; then 
          read ANSWER_rest
        fi
        ANSWER="${ANSWER_first}${ANSWER_rest}"
        config_set_option "$1" "$ANSWER"
    fi
    return 0
}


#---------------------------------------------------------------------
#
## Returns the location that the www files are installed to
## An attempt to get install_www_files configurable
#---------------------------------------------------------------------
function get_install_www_files_dir ()
{
  echo "/usr/share/www/"
}


#---------------------------------------------------------------------
## @param Directory with files we might want to install
## @param Destination directory (optional)
##
## Installs files to WWW_DEST ($INSTALL_ROOT/usr/share/www/$SPELL) and
## sets up proper www-data permissions
## Optionally the second parameter will override WWW_DATA (and make
## sure INSTALL_ROOT exists only once in the WWW_DATA)
#---------------------------------------------------------------------
function  install_www_files ()
{
  if  [  !  -z  $2  ];  then
    #
    # Just in case the destination already includes INSTALL_ROOT, remove it
    #
    local  WWW_DEST="$INSTALL_ROOT/${2/\$INSTALL_ROOT/}"
  else
    local  WWW_DEST="$INSTALL_ROOT$(get_install_www_files_dir)$SPELL"
  fi  &&

  #
  # Make sure the www-data user exists
  # Not sure if this will work :/
  create_account www-data

  #
  # Make sure WWW_DEST exists
  #
  if  [  !  -d  "$WWW_DEST"  ];  then
    if  [  !  -d  "${WWW_DEST/\/$SPELL/}"  ];  then
      mkdir  -p  "${WWW_DEST/\/$SPELL/}"                   &&
      chmod  0755                 "${WWW_DEST/\/$SPELL/}"  &&
      chown  www-data:www-data    "${WWW_DEST/\/$SPELL/}"
    fi  &&

    mkdir  -p  "$WWW_DEST"                   &&
    chmod  0755                 "$WWW_DEST"  &&
    chown  www-data:www-data    "$WWW_DEST"
  fi  &&

  # find $@ | while read file; do install ... $file ...; done
  # find  $1  -type  -f  |  while  read  file;  do
  for  www_file  in  `find  $1  -type  f`;  do
    if  install_config_file  "$www_file"   "$WWW_DEST/$www_file";  then
      chmod  u+r,g+r,o-wx         "$WWW_DEST/$www_file"  &&
      chown  www-data:www-data    "$WWW_DEST/$www_file"
    fi
  done
  #
  # Warning message about new location for www files
  # Remove around 2005-08-02 (one month in test, another in stable, supposedly)
  #
  message  "${MESSAGE_COLOR}Your web files have been moved out of the"        \
           "APACHE specific locations (apache2/htdocs, httpd/htdocs, etc.)"   \
           "and into a shared, non-DocumentRoot $INSTALL_ROOT$(get_install_www_files_dir)"  \
           "directory. You can modify your web server to point there for"     \
           "these files now.${DEFAULT_COLOR}"
}

#---------------------------------------------------------------------
## Removes traces of NSPR and NSS from Mozilla-based software
## TODO move patch to a central place
#---------------------------------------------------------------------
function mozilla_remove_nspr_nss() {
  message 'Checking Mozilla source code...' &&
  [[ "$(basename $(pwd))" == mozilla ]] &&
  message 'Checking the spell...' &&
  if  [[ -f $SCRIPT_DIRECTORY/security_manager_makefile.diff ]];  then
    patch -p1 < $SCRIPT_DIRECTORY/security_manager_makefile.diff
  else
    true  # No security patch needed
  fi  &&
  rm -fr dbm nsprpub security/nss &&
  # exclude DBM for top-level modules and don't build it
  sedit 's@\<dbm\>@@g' Makefile.in &&
  sedit 's@\<dbm\>@@g' build/unix/modules.mk &&
  # don't define NSS libraries as dependencies and don't look for them in the tree
  sedit 's@$(DIST)/lib/$(LIB_PREFIX)\(crmf\|dbm\|nss3\|softokn3\|smime3\|ssl3\)\.$(LIB_SUFFIX)@-l\1@g' config/config.mk &&
  sedit 's@NSS_DEP_LIBS\s*=@__undefine_\0@g' config/config.mk &&
  # align the makefile-s
  find -name Makefile.in | while read __MAKEFILE; do
    # use system NSPR's and NSS's headers
    # option `--with-system-nspr' doesn't do it everywhere
    sedit 's@-I\S*\(nss\|nspr\)\>@-I/usr/include/\1@g' $__MAKEFILE
  done
}

#-------------------------------------------------------------------------
## Returns the kernel version checks linux then linux-new (for now) and
## then uname for the kernel version
#-------------------------------------------------------------------------
function get_kernel_version()
{
	local KVER=$(installed_version linux)
	if [[ $KVER ]] ; then
		echo $KVER
	else
		KVER=$(installed_version linux-new)
		if [[ $KVER ]] ; then
			echo $KVER
		else
			KVER=$(grep version /usr/src/linux/.config | cut -d: -f2 | cut -d ' ' -f2)
			if [ $KVER ] && [ -d "/lib/modules/${KVER}/build" ] ; then
				 echo $KVER
			else
				KVER=$(uname -r)
				echo $KVER
			fi
		fi
	fi
}

#---------------------------------------------------------------------------
## Invokes the unamechange spell any spell that uses this should depend on
## unamechange otherwise this function does nothing.
## to use this function simply call then change the variables listed ro have
## any call to uname return that value
#--------------------------------------------------------------------------
function invoke_uname_change()
{
	if [[ $(installed_version unamechange) ]] ; then
		export UNAME_CHANGE_SYSNAME=$(uname -s)
		export UNAME_CHANGE_NODENAME=$(uname -n)
		export UNAME_CHANGE_RELEASE=$(uname -r)
		export UNAME_CHANGE_VERSION=$(uname -v)
		export UNAME_CHANGE_MACHINE=$(uname -m)
		export UNAME_CHANGE_DOMAINNAME=$(uname -o)
	
		export LD_PRELOAD="${LD_PRELOAD} /usr/lib/unamechange.so"
	fi
}

#-------------------------------------------------------------------------
## Returns the state of the system back to normal after calling 
## invoke_uname_change unset's all environmental vars and returns
## LD_PRELOAD back to normal
#-------------------------------------------------------------------------
function devoke_uname_change()
{
	if [[ $(installed_version unamechange) ]] ; then
		unset UNAME_CHANGE_SYSNAME
		unset UNAME_CHANGE_NODENAME
		unset UNAME_CHANGE_RELEASE
		unset UNAME_CHANGE_VERSION
		unset UNAME_CHANGE_MACHINE
		unset UNAME_CHANGE_DOMAINNAME
	
		export LD_PRELOAD="${LD_PRELOAD/\/usr\/lib\/unamechange.so/}"
	fi
}

#-----------------------------------------------------------------------
## Get the running kernel config status of a some part of the kernel
## given by $1. Used for spells that don't have linux triggers
##
## $1 string Config variable to look for
#-----------------------------------------------------------------------
function get_running_kernel_config()
{
	local KVER
	# use proc interface because even inside a uname change invoke this
	# still returns the version of the running kernel
	if [ -f /proc/sys/kernel/osrelease ] ; then
		KVER=$(cat /proc/sys/kernel/osrelease)
	else
		# apparently you don't have proc mount
		KVER=$(uname -r)
	fi
	if [ -f /proc/config.gz ] ; then
		echo $(zgrep "^$1=" /proc/config.gz | awk -F= '{ print $2 }')
	elif [ -f /boot/config-$KVER ] ; then
		echo $(grep "^$1=" /boot/config-$KVER | awk -F= '{ print $2 }')
	elif [ -f /usr/src/linux-$KVER/.config ] ; then
		echo $(grep "^$1=" /usr/src/linux-$KVER/.config | awk -F= '{ print $2 }')
	else
		echo "-1"
	fi
}

#-------------------------------------------------------------------------
## Get the config status of some part of the kernel sorcery says is 
## installed. Used by spells that have linux triggers.
##
## $1 string Config var to look for
#-------------------------------------------------------------------------
function get_sorcery_kernel_config()
{
	local KVER=$(get_kernel_version)
	if [ -f /boot/config-$KVER ] ; then
		echo $(grep "^$1=" /boot/config-$KVER | awk -F= '{ print $2 }')
	elif [ -f /usr/src/linux-$KVER/.config ] ; then
		echo $(grep "^$1=" /usr/src/linux-$KVER/.config | awk -F= '{ print $2 }')
	else
		echo "-1"
	fi
}


#-------------------------------------------------------------------------
## Compatibility code for gracefully failing if the user uses an older
## version of sorcery with a spell that calls unpack_file.
#-------------------------------------------------------------------------
declare -f unpack_file &> /dev/null ||
function unpack_file() {
  message "This spell uses a function only available in sorcery 1.12.2 or newer, please update."
  return 1
}

#-------------------------------------------------------------------------
## Default build for Python spell.
#-------------------------------------------------------------------------
function default_build_python() {
  python setup.py build
}

#-------------------------------------------------------------------------
## Default install for Python spell.
#-------------------------------------------------------------------------
function default_install_python() {
  python setup.py install --root "$INSTALL_ROOT/"
}

#-------------------------------------------------------------------------
## Default build for Perl spell.
#-------------------------------------------------------------------------
function default_build_perl() {
  perl Makefile.PL $OPTS &&
  make
}

#---
## disable_pic
## A function to smartly disable -DPIC and -fPIC flags
## has one optional parameter: force which forces disable
#---

disable_pic() {
  if [[ "${SMGL_COMPAT_ARCHS[1]}" != "x86_64" ]] &&
     [[ "${SMGL_COMPAT_ARCHS[1]}" != "alpha"  ]] ||
     [[ "$1" == "force" ]]
  then
    CFLAGS=${CFLAGS/-fPIC}                    &&
    CFLAGS=${CFLAGS/-DPIC}                    &&
    CXXFLAGS=${CXXFLAGS/-fPIC}                &&
    CXXFLAGS=${CXXFLAGS/-DPIC}
  fi
}

#
## Function to check if we're using xorg-modular libs or not
#

function check_if_xorg_modular_libs()
{
  if  [[  "$(get_spell_provider  ${1:-$SPELL}  X11-LIBS)"  ==  "xorg-server"  ]] ||
      [[  "$(get_spell_provider  ${1:-$SPELL}  X11-LIBS)"  ==  "xorg-libs"  ]]     
  then
     return 0
  fi
  return 1
}

#
## Function to check if we're using xorg-modular server or not
#

function check_if_xorg_modular_server()
{
  if  [[  "$(get_spell_provider  ${1:-$SPELL}  X11-SERVER)"  ==  "xorg-server"  ]]
  then
     return 0
  fi
  return 1
}

# FUnction to tag config files that cannot be tagged by the normal install_config_file method
# do NOT call check_if_modified or mark_file_modified ANYWHERE ELSE!!!
# # THIS function will go away when it migrates down from devel sorcery
# # David Kowis - 11-17-2006
#  $1 is the full path to the config file you want tracked.
#  CALL THIS BEFORE YOU DO THE INSTALLING. You can see the postfix spell for an example.
declare -f note_config_files &>/dev/null ||
function note_config_files() {
  if check_if_modified "$1"; then 
    mark_file_modified "$1" 
  fi
}

# Functions for default_build and default_install for waf based build systems
# please use this one instead of maunaly calling waf when possible
# Disabled caching as this has GREAT potential for borkage
# and waf is fast without it as well

function waf_build(){
  ./waf configure                             \
                --nocache                     \
                --prefix=${INSTALL_ROOT}/usr  \
                $OPTS                         &&
  ./waf build
}

function waf_install(){
  ./waf install
}

# spells in several  sections now need cmake or qt4
cmake_build() {
  cd $SOURCE_DIRECTORY  &&
  mkdir -p build        &&
  cd build              &&
  cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROOT/usr ../  $OPTS &&
  make
}

qt4_build() {
  [[ -z $QTDIR ]] && source /etc/profile.d/qt.sh
  QTDIR="${QTDIR:-$INSTALL_ROOT/usr}"
  PATH="$QTDIR/bin/qt4:$PATH"
  cmake_build
}

# check whether the QT provider is qt4
function check_if_qt4_provider()
{
  if  [[  "$(get_spell_provider  ${1:-$SPELL}  QT)"  ==  "qt4"  ]]
  then
     return 0
  fi
  return 1
}


# build using qt3 or qt4
# some spells an adapt the build process to either qt3 or qt4
function build_qt3_or_4()
{
  [[ -z $QTDIR ]] && source /etc/profile.d/qt.sh
  QTDIR="${QTDIR:-$INSTALL_ROOT/usr}"
  if check_if_qt4_provider
  then
    PATH="$QTDIR/bin/qt4:$PATH"
  fi      &&
  qmake   &&
  make
}

# cmake flags use : which is an internal sorcery delimiter.
# In order to facilitate the passing of depends flags, use % instead and call
# this function at the start of BUILD. Don't use it anywhere else.
# Example: 
# DEPENDS: depends kdelibs4 -DCRUFT%BOOL=FALSE; ...
# BUILD: prepare_cmake_flags; ...
function prepare_cmake_flags()
{
  OPTS="${OPTS//%/:}"
}


#-------------------------------------------------------------------------
## Print the version of the running kernel.
#-------------------------------------------------------------------------
function get_running_kernel_version()
{
  # Try the proc interface first because it returns the version of the
  # running kernel even when unamechange is invoked.
  [[ -f /proc/sys/kernel/osrelease ]] && cat /proc/sys/kernel/osrelease ||
    uname -r
}

#-------------------------------------------------------------------------
## Print the version of the installed linux spell or, lacking that, "-1".
## This is just a wrapper for 'installed_version linux' with the exception
## that this will always print something and not return false.
#-------------------------------------------------------------------------
function get_sorcery_kernel_version()
{
  installed_version linux || echo "-1"
}

#-------------------------------------------------------------------------
## Print the version of the kernel defined in USE_KERNEL_VERSION or, 
## lacking that, the version of either the installed linux spell or the 
## running kernel.
#-------------------------------------------------------------------------
function get_kernel_version()
{
  if [[ $USE_KERNEL_VERSION ]]
  then
    echo "$USE_KERNEL_VERSION"
  else
    installed_version linux || get_running_kernel_version
  fi
}

#-----------------------------------------------------------------------
## Print the kernel config status of the running kernel for the option 
## defined in $1.
## If a configure file is found print the requested config status (if
## any) and return 0, otherwise return 1.
#-----------------------------------------------------------------------
function get_running_kernel_config()
{
  if [[ -f /proc/config.gz ]]
  then
    zgrep "^$1=" /proc/config.gz | cut -d= -f2
  else
    local KVER="$(get_running_kernel_version)"
    if [[ -f "/boot/config-$KVER" ]]
    then
      grep "^$1=" "/boot/config-$KVER" | cut -d= -f2
    elif [[ -f "/usr/src/linux-$KVER/.config" ]]
    then
      grep "^$1=" "/usr/src/linux-$KVER/.config" | cut -d= -f2
    else
      return 1
    fi
  fi
}

#-----------------------------------------------------------------------
## Print the kernel config status of the installed linux spell for the 
## option defined in $1.
## If the linux spell is installed and a configure file is found print
## the requested config status (if any) and return 0, otherwise return
## 1.
#-----------------------------------------------------------------------
function get_sorcery_kernel_config()
{
  local KVER="$(installed_version linux)"
  if [[ $KVER ]]
  then
    if [[ -f "/boot/config-$KVER" ]]
    then
      grep "^$1=" "/boot/config-$KVER" | cut -d= -f2
    elif [[ -f "/usr/src/linux-$KVER/.config" ]]
    then
      grep "^$1=" "/usr/src/linux-$KVER/.config" | cut -d= -f2
    else
      return 1
    fi
  else
    return 1
  fi
}

#-----------------------------------------------------------------------
## Print the kernel config status for the option defined in $1 from the
## kernel defined in USE_KERNEL_VERSION or, lacking that, from either
## the installed linux spell or the running kernel.
## If a configure file is found print the requested config status (if
## any) and return 0, otherwise return 1.
#-----------------------------------------------------------------------
function get_kernel_config()
{
  if [[ $USE_KERNEL_VERSION ]]
  then
    if [[ -f "/boot/config-$USE_KERNEL_VERSION" ]]
    then
      grep "^$1=" "/boot/config-$USE_KERNEL_VERSION" | cut -d= -f2
    elif [[ -f "/usr/src/linux-$USE_KERNEL_VERSION/.config" ]]
    then
      grep "^$1=" "/usr/src/linux-$USE_KERNEL_VERSION/.config" | cut -d= -f2
    else
      return 1
    fi
  else
    get_sorcery_kernel_config "$1" || get_running_kernel_config "$1"
  fi
}

# this is mostly copied from sorcery real_default_sorcery_build,
# and kde-apps/KDE_BUILD

# we need a different --includedir value for KDE3 spells,
# so as to avoid conflicts with KDE4

function default_kde3_build() {

  if [[ -f /etc/profile.d/qt.sh ]]; then
    . /etc/profile.d/qt.sh
  fi                                       &&
  OPTS="$KDE_DEBUG_OPTION                  \
        $KDE_FINAL_OPTION                  \
        $KDE_LDFLAGS                       \
        --enable-dnotify                   \
        --with-distribution                \
        --disable-dependency-tracking      \
        $OPTS"                             &&

  OPTS="$OPTS --build=${BUILD}"
  #If these switches are used, they _may_ stop distcc and ccache from working
  # for some spells (bug 3798)
  #  We could write wrappers for all of the possible binaries
  [[ $CROSS_INSTALL == on ]] && OPTS="$OPTS --host=${HOST}"

  ./configure --prefix=${INSTALL_ROOT}/usr  \
          --sysconfdir=${INSTALL_ROOT}/etc  \
       --localstatedir=${INSTALL_ROOT}/var  \
              --mandir=${INSTALL_ROOT}/usr/share/man   \
             --infodir=${INSTALL_ROOT}/usr/share/info  \
            --includedir=${INSTALL_ROOT}/usr/include/kde3 \
                       $OPTS                 &&
  make

}

#---
## Default configure
#---

function default_build_configure() {
  # this is here so that config_query_option can be used without
  # extra junk
  local up_spell_name=$(echo $SPELL | tr "a-z" "A-Z")     &&
  local up_spell_name=$(echo $SPELL | tr "-" "_")         &&
  local tempopts="${up_spell_name}_OPTS"                  &&
  OPTS="${!tempopts} $OPTS"                               &&
  OPTS="$OPTS --build=${BUILD}"                           &&
  #If these switches are used, they _may_ stop distcc and ccache from working
  # for some spells (bug 3798)
  #  We could write wrappers for all of the possible binaries
  [[ $CROSS_INSTALL == on ]] && OPTS="$OPTS --host=${HOST}"

  ./configure --prefix=${INSTALL_ROOT}/usr                 \
          --sysconfdir=${INSTALL_ROOT}/etc                 \
       --localstatedir=${INSTALL_ROOT}/var                 \
              --mandir=${INSTALL_ROOT}/usr/share/man       \
             --infodir=${INSTALL_ROOT}/usr/share/info      \
                       $OPTS
}

#---
## Default make
#---

function default_build_make(){
  make
}