set -o errtrace # Let shell functions inherit ERR trap.
set -o errexit
-# Don' t locate and remember (hash) commands as they are looked up for
-# execution (don' t remember path):
+# Don't locate and remember (hash) commands as they are looked up for
+# execution (don't remember path):
set +h
hvtrap_setup()
CLFS=${LFS}
+CROSS_TOOLS_DIR=${CLFS}/cross-tools
+TOOLS_DIR=${CLFS}/tools
+
# Load functions
source ../functions/fpkg
source ../functions/lpkg
source ../targets/${HVL_TARGET}
fi
-CLFS_TARGET="${CLFS_ARCH}-${CLFS_OS}-${CLFS_ABI}"
+# When CLFS_OS is defined, define target as the standard triplet:
+CLFS_TARGET="${CLFS_ARCH}"
+if [ x"${CLFS_OS}" != x ]; then
+ CLFS_TARGET+="-${CLFS_OS}-${CLFS_ABI}"
+fi
CLFS_HOST="$(echo $MACHTYPE | \
sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
echo ${1} | sed "s!.*_\([0-9].*\)!\1!g"
}
+# Extracting the version number from a complete package name
+# when the package name uses the underscore as the separator.
+# Arg. #1: Complete package name with version (ex: icu4c-54_1 will output 54.1)
+get_pkg_ver_underscore2()
+{
+ # Checking for correct number of arguments
+ if [ $# -ne 1 ]; then
+ echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+ return 1
+ fi
+
+ local v=$(get_pkg_ver ${1})
+
+ # Replace underscore by dot
+ echo ${v} | sed "s!_!\.!g"
+}
+
+# Convert package version dots to uderscore.
+# Ex: gcc-3.4.6 will output 3_4_6
+# Arg. #1: Complete package name with version
+ver_dots_to_underscore()
+{
+ # Checking for correct number of arguments
+ if [ $# -ne 1 ]; then
+ echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+ return 1
+ fi
+
+ local v=$(get_pkg_ver ${1})
+
+ # Replace dots by underscores
+ echo ${v} | sed "s!\.!_!g"
+}
+
# Extracting the first digit version number from a complete package name.
# Arg. #1: Complete package name with version (ex: gcc-3.4.4 will output 3)
get_pkg_ver1()
echo ${1} | sed "s!^.*-\([0-9]*\)\..*!\1!g"
}
+# Extracting the first digit version number from a complete package name,
+# when the package name uses the underscore as the separator.
+# Arg. #1: Complete package name with version (ex: icu4c-54_1 will output 54)
+get_pkg_ver1_underscore()
+{
+ # Checking for correct number of arguments
+ if [ $# -ne 1 ]; then
+ echo "${FUNCNAME}(), wrong number of arguments: ${*}"
+ return 1
+ fi
+
+ echo ${1} | sed "s!^.*-\([0-9]*\)_.*!\1!g"
+}
+
# Extracting the first 2 digits 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_ver2()
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()
-{
- arguments=${*}
-
- # The last argument is the group name
- while [ $# -ne 0 ]; do
- groupname=${*}
- shift
- done
-
- if ! cat /etc/group | egrep -q "^${groupname}:"; then
- groupadd ${arguments}
- fi
-}
-
# Adding a new user, checking if it already exist before
# Arguments: same arguments as for standard useradd command.
hv_useradd()