# FAILURE prints text in a red colour
FAILURE="echo -en \\033[1;31m"
-
# Extracting the version number from a complete package name.
# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4.4)
get_pkg_ver()
echo ${1} | sed "s!^.*-\(.*\)!\1!g"
}
-
# Extracting the base version number from a complete package name.
# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3.4)
get_pkg_ver_base()
echo ${1} | sed "s!^.*-\([0-9]*\.[0-9]*\).*!\1!g"
}
-
# Extracting the base version number from a complete package name.
# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3)
get_pkg_ver_major()
echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g"
}
-
# Extracting the name from a complete package name.
# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output gcc)
get_pkg_name()
echo ${1} | sed "s!^\(.*\)-.*!\1!g"
}
-
# Saves the content of CFLAGS and CXXFLAGS environment variables.
save_flags()
{
return ${EXIT_SUCCESS}
}
-
# Saves the content of CFLAGS and CXXFLAGS environment variables, and then
# set them to empty strings.
save_flags_no_optimizations()
return ${EXIT_SUCCESS}
}
-
# Restores the previous values of CFLAGS and CXXFLAGS environment variables. These
# must have been saved first using save_flags().
restore_flags()
return ${EXIT_SUCCESS}
}
-
# Create log directory and log file for current stage if necessary
# This should be done automatically...
init_log_file()
fi
}
-
# Create symbolic links for start/stop scripts in /etc/rc.d
#
# Arg #1: script name
fi
}
-
# Create symbolic links for start/stop scripts in /etc/rc.d
#
# Arg #1: level
fi
}
-
# Create symbolic links for start/stop scripts in /etc/rc.d
#
# Arg #1: script name
static_bootscript_add ${*} 3
}
-
# Create symbolic links for start/stop scripts in /etc/rc.d
#
# Arg #1: script name
static_bootscript_add ${*} S
}
-
# Add "export" before the variable name
#
# Arg #1: variable name
sed -i "s!\(^${VARIABLE}=.*\)!export \1!" ${FILE}
}
-
# Adding a new environment variable to a file.
#
# Arg #1: variable name
return $?
}
-
# Adding a new path environment variable to a file.
#
# Arg #1: variable name
var_add ${1} ${2} "${3}" ":" 1>> ${LFS_LOG_FILE} 2>&1
}
-
# Adding a new string environment variable to a file.
#
# Arg #1: variable name
var_add ${1} ${2} "${3}" " "
}
-
# Adding a new string to a file.
#
# Arg #1: string
echo "${STRING}" >> ${FILE}
}
-
# Adding a new environment variable to a shadow password suite file (login.defs)
#
# Arg #1: variable name
sed -i "s!\(^${VARIABLE}.*\)!\1:${VALUE}!" ${FILE}
}
-
# Adding a new group, checking if it already exist before.
# Arguments: same arguments as for standard groupadd command.
hv_groupadd()
fi
}
-
# Evaluates the return value of the process that was run just before this
# function was called.
evaluate_retval()
fi
}
-
-
-
# Obtain the name of the base directory for the decompressed package.
# First argument: package name
static_decompressed_dirname()
echo ${DIRNAME}
}
-
# Applying any patch(es) found for the current package.
# Will work only if patches have the same base name as
# the package, followed by a dash:
return $?
}
-
# Applying patch
# First argument is the name of the patch
# Second argument is the package name
patch -Np1 -d ${LFS_TMP}/${PACKAGE} -i ${LFS_PKG_DIR}/${PATCH_FILE}
}
-
# Decompression of a package
# First argument: package name
# Second argument: directory where decompressing (optional)
cd - 1> /dev/null 2>&1
}
-
# Installation of a package, removing source and build directories after.
#
# First argument: package name
static_ipkg ${1} ${2} ${1}
}
-
# Installation of a package conforming to GNU autotools.
# The package must be able to be built outside the
# source directory.
static_ipkg ${PACKAGE} cis-ac ${PACKAGE} ${CONFIGURE_OPTS}
}
-
# Installation of a package conforming to GNU autotools,
# but that must be built inside the source directory.
#
static_ipkg ${PACKAGE} cis-ac-nobuild ${PACKAGE} ${CONFIGURE_OPTS}
}
-
# Installation of a GNOME package.
#
# First argument: package name
static_ipkg ${1} cis-gnome ${1}
}
-
# Installation of a PERL module
#
# First argument: package name
static_ipkg ${1} cis-pm ${1}
}
-
# Multiple installation of a package. This is usefull for packages
# that may need to be installed multiple times, at different
# times of the build process, like for GCC pas 1 and GCC pass 2.
static_ipkg ${1} ${2} ${3}
}
-
# Installation of a package
#
# First argument: Real package name
return $EXIT_SUCCESS
}
-
# Display the action name, run a command, log its output and display it's
# status
# First argument: action name (string)
return $EXIT_SUCCESS
}
-
# Display the action name, run a command, log its output and display it's
# status and the time it took to execute.
# Note: In case of errors, this function returns an error code instead
fi
}
-
# Display the action name, run a command, log its output and display it's
# status. Write to install log file when successfully completed so it
# won't be called again after a successfull installation.
return $EXIT_SUCCESS
}
-
# Display the action name, run a command, log its output and display it's
# status. Write to install log file when successfully completed so it
# won't be called again after a successfull installation.
return $EXIT_SUCCESS
}
-
get_total_build_time()
{
INFILE=${1}
echo "${HOURS}.${MIN}"
}
-
display_build_time()
{
END_TIME=$(echo `date +%s`)
echo "h" 1>> ${LFS_LOG_FILE}
}
-
# The print_status prints a coloured "X" letter inside the checkbox to the left
# of the screen (the checkbox is displayed with the action_checkbox function).
print_status()
$NORMAL
}
-
# Testing GCC toolchain
gcc_toolchain_test_stage1()
{