-Cleaned-up name of ipkg functions in package definition files.
[hvlinux.git] / stage2 / cis-ac
index 199b3da..e836f99 100755 (executable)
@@ -4,25 +4,88 @@ set -o errexit
 # First argument of this script is the package name.
 # Remaining arguments are additional configure options.
 
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
 PACKAGE=${1}
 shift
 CONFIGURE_OPTS=${*}
 
-# Applying patches (if any)
-apply_patches ${PACKAGE}
+# Reading system configuration informations, functions and package versions.
+source ${SCRDIR}/../sysinfos
+source ${SCRDIR}/../functions
+source ${SCRDIR}/../packages-list
+
+# Setting default configure options for all scripts
+CONFIGURE_OPTS="\
+      --prefix=/usr \
+      --sysconfdir=/etc \
+      ${CONFIGURE_OPTS}"
+
+# Default configure function
+hvconfig()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    echo "Running configure with options:"
+    echo "  <${CONFIGURE_OPTS}>"
+
+    ../${PACKAGE}/configure ${CONFIGURE_OPTS}
+}
+
+# Default build function
+hvbuild()
+{
+    ${HVMAKE}
+    ${HVMAKE} install
+}
+
+hvpatch()
+{
+    # Applying patches (if any)
+    apply_patches ${PACKAGE}
+}
+
+PACKAGE_DEF=${SCRDIR}/pkg/$(get_pkg_name ${PACKAGE})
+
+if [ -f ${PACKAGE_DEF} ]; then
+    echo "Load custom package functions and definitions"
+    source ${PACKAGE_DEF}
+fi
+
+hvpatch
+
+# Execute config-cache function if applicable
+if function_exists hvconfig_cache ; then
+    echo "Running configure cache script"
+    hvconfig_cache
+
+    CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache"
+fi
+
+# Execute pre-configure function if applicable
+if function_exists hvconfig_pre ; then
+    echo "Running configure pre-script"
+    hvconfig_pre
+fi
+
+if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then
+    echo "Not calling configure because ${PACKAGE} has no configure script"
+else
+    hvconfig
+fi
+
+# Execute post-configure function if applicable
+if function_exists hvconfig_post ; then
+    echo "Running configure post-script"
+    hvconfig_post
+fi
+
+hvbuild
+
+# Execute post-build function if applicable
+if function_exists hvbuild_post ; then
+    echo "Running build post-script"
+    hvbuild_post
+fi
 
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    ${CONFIGURE_OPTS}
-make
-make install
 ldconfig
 
 exit $?