# FAILURE prints text in a red colour
FAILURE="echo -en \\033[1;31m"
+# It seems that when compiling bash-4.0, using
+# "make -j 1" is causing problems...
+if [ "x${MAKEJOBS}" == "x1" ]; then
+ HVMAKE="make"
+else
+ HVMAKE="make -j ${MAKEJOBS}"
+fi
+
# 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)
+# Arg. #1: Complete package name with version (ex: firefox-3.5.5.source will output 3.5.5)
get_pkg_ver()
{
# Checking for correct number of arguments
return 1
fi
- echo ${1} | sed "s!^.*-\(.*\)!\1!g"
+ echo ${1} | sed "s!.*-\(\([0-9]\.\)*\).*!\1!g" | sed 's!\.$!!g'
}
# Extracting the base version number from a complete package name.
{
local PACKAGE=${1}
- local DIRNAME=$(dirname $(tar -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1))
-
- if [ "x${DIRNAME}" == "x." ]; then
- DIRNAME=$(basename $(tar -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1))
- fi
+ local DIRNAME=$(tar -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1 | awk -F \/ '{print $1}')
echo ${DIRNAME}
}
if [ $# -eq 2 ]; then
TARGET_DIR=${2}
else
- TARGET_DIR=$(static_decompressed_dirname ${PACKAGE})
+ TARGET_DIR=${PACKAGE}
fi
# Checking if we can find at least one patch.
return ${EXIT_FAILURE}
fi
- local DECOMPRESSED_DIRNAME=$(static_decompressed_dirname ${PACKAGE})
-
- if [ -d ${TOPDIR}/${DECOMPRESSED_DIRNAME} ]; then
+ if [ -d ${TOPDIR}/${PACKAGE} ]; then
# Removing old source directory (if any)
- rm -v -rf ${TOPDIR}/${DECOMPRESSED_DIRNAME} || exit 1
+ rm -v -rf ${TOPDIR}/${PACKAGE} || exit 1
fi
# Decompressing package
ipkg()
{
# Checking for correct number of arguments
- if [ $# -ne 2 ]; then
+ if [ $# -lt 2 ]; then
echo
echo "${FUNCNAME}(): Wrong number of arguments"
echo " command was: \"${FUNCNAME}() $*\""
exit ${EXIT_FAILURE}
fi
- static_ipkg ${1} ${2} ${1}
+ local PACKAGE=${1}
+ shift
+ local CUSTOM_SCRIPT=${1}
+ shift
+ local CONFIGURE_OPTS=${*}
+
+ static_ipkg ${PACKAGE} ${CUSTOM_SCRIPT} ${PACKAGE} ${CONFIGURE_OPTS}
}
# Installation of a package conforming to GNU autotools.
exit ${EXIT_FAILURE}
fi
- PACKAGE_LOG=${LFS_LOG_DIR}/${PACKAGE_NAME}.log
+ PACKAGE_LOG=${LFS_LOG_DIR}/${LABEL}.log
# Checking if package was previously successfully installed
if grep "^${LABEL} successfully installed" ${LFS_LOG_FILE} \
decompress_package ${PACKAGE_NAME} 1>> ${PACKAGE_LOG} 2>&1
eval_retval2
- # Get the name of the decompressed directory
local DECOMPRESSED_DIRNAME=$(static_decompressed_dirname ${PACKAGE_NAME})
+ # Rename the decompressed package as per the package name if necessary
+ if [ "x${DECOMPRESSED_DIRNAME}" != "x${PACKAGE_NAME}" ]; then
+ mv ${LFS_TMP}/${DECOMPRESSED_DIRNAME} ${LFS_TMP}/${PACKAGE_NAME} || exit 1
+ fi
+
# Displaying package source size in log file
- echo " Source size:" $(du -h -s ${LFS_TMP}/${DECOMPRESSED_DIRNAME} | awk '{ print $1 }') 1>> ${LFS_LOG_FILE}
+ echo " Source size:" $(du -h -s ${LFS_TMP}/${PACKAGE_NAME} | awk '{ print $1 }') 1>> ${LFS_LOG_FILE}
# Removing old build directory (if any)
if [ -d ${LFS_TMP}/${PACKAGE_NAME}-build ]; then
eval_retval2
# Displaying package build size in log file
- BUILD_SIZE=$(du -h -s -c ${LFS_TMP}/${DECOMPRESSED_DIRNAME} ${LFS_TMP}/${PACKAGE_NAME}-build | grep total | awk '{ print $1 }')
+ BUILD_SIZE=$(du -h -s -c ${LFS_TMP}/${PACKAGE_NAME} ${LFS_TMP}/${PACKAGE_NAME}-build | grep total | awk '{ print $1 }')
echo " Build size : ${BUILD_SIZE}" 1>> ${LFS_LOG_FILE}
# Some scripts need to preserve the source or build directory. They can
# do so by renaming them.
- if [ -d ${LFS_TMP}/${DECOMPRESSED_DIRNAME} ]; then
+ if [ -d ${LFS_TMP}/${PACKAGE_NAME} ]; then
# Removing source directory
- rm -v -rf ${LFS_TMP}/${DECOMPRESSED_DIRNAME} 1>> ${PACKAGE_LOG} 2>&1
+ rm -v -rf ${LFS_TMP}/${PACKAGE_NAME} 1>> ${PACKAGE_LOG} 2>&1
eval_retval2
fi
if [ -d ${LFS_TMP}/${PACKAGE_NAME}-build ]; then
# 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.
-# First argument: label (string)
-# Second argument: script name
+# First argument: Message to display during action
+# Second argument: script name (will be label)
run_script_log()
{
- LABEL=${1}
+ MSGSTRING=${1}
SCRIPT=${2}
+ LABEL=${SCRIPT}
# Checking for correct number of arguments
if [ $# -lt 2 ]; then
fi
# Displaying script name
- echo -n "[ ] ${LABEL}"
+ echo -n "[ ] ${MSGSTRING}"
echo "------------------------" 1>> ${LFS_LOG_FILE}
echo "Running " ${LABEL} 1>> ${LFS_LOG_FILE}
echo 1>> ${LFS_LOG_FILE}