CLFS=${LFS}
+function function_exists
+{
+ local FUNCTION_NAME=$1
+
+ [ -z "$FUNCTION_NAME" ] && return 1
+
+ declare -F "$FUNCTION_NAME" > /dev/null 2>&1
+
+ return $?
+}
+
# Extracting the version number from a complete package name.
# Arg. #1: Complete package name with version (ex: firefox-3.5.5.source will output 3.5.5)
get_pkg_ver()
return 1
fi
- echo ${1} | sed "s!^\(.*\)-[0-9]*\.[0-9]*.*!\1!g"
+ # SED do not support non-greedy regexp:
+ # We want to match any characters preceeding a dash followed by a number
+ # (shortest match -> non-greedy)
+ echo ${1} | sed "s!\([^-][^0-9]*\)-[0-9].*!\1!"
}
# Saves the content of CFLAGS and CXXFLAGS environment variables.
tar.bz2|tar.gz|tgz|tar.Z)
# Remove optional "./" leading component with sed
# and extract base directory name with awk.
- local DIRNAME=$(tar ${TAR_OPTS} -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 | head -n1 | sed 's!^\./!!' | awk -F \/ '{print $1}')
+ # tar 1.23 reports an error when using pipes, so
+ # remove error message with "2> /dev/null"
+ local DIRNAME=$(tar ${TAR_OPTS} -tf ${LFS_PKG_DIR}/${PACKAGE}.tar.bz2 2> /dev/null | head -n1 | sed 's!^\./!!' | awk -F \/ '{print $1}')
echo ${DIRNAME}
;;
zip)
}
# Installation of a package, removing source and build directories after.
+# Try to merge this function with static_ipkg()???
#
# First argument: package name
# Second argument: script name
fi
local PACKAGE=${1}
- local CUSTOM_SCRIPT=${2}
local LABEL=${PACKAGE}
+ local CUSTOM_SCRIPT=${2}
shift
shift
local CONFIGURE_OPTS=${*}
ipkg ${PACKAGE} ${CUSTOM_SCRIPT} ${LABEL} ${CONFIGURE_OPTS}
}
-# Installation of a package conforming to GNU autotools.
-# The package must be able to be built outside the
-# source directory.
+# Static function called by:
+# ipkg_ac
+# ipkg_ac_nb
+# ipkg_gnome
#
-# First argument: package name
+# First argument: script name
+# Second argument: package name
# Remaining arguments: additional configure options
-ipkg_ac()
+static_ipkg()
{
# Checking for correct number of arguments
- if [ $# -lt 1 ]; then
+ if [ $# -lt 2 ]; then
echo
echo "${FUNCNAME}(): Wrong number of arguments"
echo " command was: \"${FUNCNAME}() $*\""
exit ${EXIT_FAILURE}
fi
- local PACKAGE=${1}
+ local SCRIPT=${1}
+ local PACKAGE=${2}
local LABEL=${PACKAGE}
shift
+ shift
local CONFIGURE_OPTS=${*}
- ipkg ${PACKAGE} cis-ac ${LABEL} ${CONFIGURE_OPTS}
+ ipkg ${PACKAGE} ${SCRIPT} ${LABEL} ${CONFIGURE_OPTS}
+}
+
+
+# Installation of a package conforming to GNU autotools.
+# The package must be able to be built outside the
+# source directory.
+#
+# First argument: package name
+# Remaining arguments: additional configure options
+ipkg_ac()
+{
+ static_ipkg cis-ac ${*}
}
# Installation of a package conforming to GNU autotools,
# Remaining arguments: additional configure options
ipkg_ac_nb()
{
- # Checking for correct number of arguments
- if [ $# -lt 1 ]; then
- echo
- echo "${FUNCNAME}(): Wrong number of arguments"
- echo " command was: \"${FUNCNAME}() $*\""
- exit ${EXIT_FAILURE}
- fi
-
- local PACKAGE=${1}
- local LABEL=${PACKAGE}
- shift
- local CONFIGURE_OPTS=${*}
-
- ipkg ${PACKAGE} cis-ac-nobuild ${LABEL} ${CONFIGURE_OPTS}
+ static_ipkg cis-ac-nobuild ${*}
}
# Installation of a GNOME package.
# Remaining arguments: additional configure options
ipkg_gnome()
{
- # Checking for correct number of arguments
- if [ $# -ne 1 ]; then
- echo
- echo "${FUNCNAME}(): Wrong number of arguments"
- echo " command was: \"${FUNCNAME}() $*\""
- exit ${EXIT_FAILURE}
- fi
-
- local PACKAGE=${1}
- local LABEL=${PACKAGE}
- shift
- local CONFIGURE_OPTS=${*}
-
- ipkg ${PACKAGE} cis-gnome ${LABEL} ${CONFIGURE_OPTS}
+ static_ipkg cis-gnome ${*}
}
# Installation of a PERL module