-Cleaned-up name of ipkg functions in package definition files.
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Thu, 4 Nov 2010 15:53:53 +0000 (15:53 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Thu, 4 Nov 2010 15:53:53 +0000 (15:53 +0000)
-Started converting stage2 to package definition files.
-Now booting ok after stage 1.

80 files changed:
packages-list
stage0/cis-ac
stage0/cis-pre-install [deleted file]
stage0/install-1
stage0/pkg/binutils
stage0/pkg/cloog-ppl
stage0/pkg/eglibc
stage0/pkg/gcc
stage0/pre-install [new file with mode: 0755]
stage0/stage0-install
stage1/cis-ac
stage1/cis-bootscripts [deleted file]
stage1/cis-post-install [deleted file]
stage1/cis-pre-install [deleted file]
stage1/install-1
stage1/install-bootscripts [new file with mode: 0755]
stage1/install-linux-minimal [deleted file]
stage1/pkg/bash
stage1/pkg/binutils
stage1/pkg/bzip2
stage1/pkg/cloog-ppl
stage1/pkg/coreutils
stage1/pkg/e2fsprogs
stage1/pkg/findutils
stage1/pkg/flex
stage1/pkg/gcc
stage1/pkg/gettext
stage1/pkg/grep
stage1/pkg/linux [new file with mode: 0644]
stage1/pkg/m4
stage1/pkg/module-init-tools
stage1/pkg/ppl
stage1/pkg/sysvinit
stage1/pkg/tar
stage1/pkg/udev
stage1/pkg/util-linux-ng
stage1/pkg/zlib
stage1/post-install [new file with mode: 0755]
stage1/pre-install [new file with mode: 0755]
stage1/stage1-install
stage2/cis-ac
stage2/cis-ac-nobuild [deleted file]
stage2/cis-binutils [deleted file]
stage2/cis-bison [deleted file]
stage2/cis-coreutils [deleted file]
stage2/cis-e2fsprogs [deleted file]
stage2/cis-eglibc [deleted file]
stage2/cis-flex [deleted file]
stage2/cis-gcc [deleted file]
stage2/cis-iana [deleted file]
stage2/cis-iproute2 [deleted file]
stage2/cis-kernel [deleted file]
stage2/cis-man-pages [deleted file]
stage2/cis-ncurses [deleted file]
stage2/cis-perl-pass1 [deleted file]
stage2/cis-pkg-config [deleted file]
stage2/cis-procps [deleted file]
stage2/cis-readline [deleted file]
stage2/cis-util-linux-ng [deleted file]
stage2/cis-zlib [deleted file]
stage2/install-2
stage2/packages-update
stage2/pkg/binutils [new file with mode: 0644]
stage2/pkg/bison [new file with mode: 0644]
stage2/pkg/coreutils [new file with mode: 0644]
stage2/pkg/e2fsprogs [new file with mode: 0644]
stage2/pkg/eglibc [new file with mode: 0644]
stage2/pkg/flex [new file with mode: 0644]
stage2/pkg/gcc [new file with mode: 0644]
stage2/pkg/iproute2 [new file with mode: 0644]
stage2/pkg/linux [new file with mode: 0644]
stage2/pkg/man-pages [new file with mode: 0644]
stage2/pkg/ncurses [new file with mode: 0644]
stage2/pkg/perl [new file with mode: 0644]
stage2/pkg/pkg-config [new file with mode: 0644]
stage2/pkg/procps [new file with mode: 0644]
stage2/pkg/readline [new file with mode: 0644]
stage2/pkg/util-linux-ng [new file with mode: 0644]
stage2/pkg/zlib [new file with mode: 0644]
stage2/stage2-install

index 475eaee..6db4ef0 100644 (file)
@@ -17,7 +17,7 @@ AVR_GDB="gdb-6.4"
 AVRDUDE="avrdude-5.1"
 ATK="atk-1.28.0"
 AUDIOFILE="audiofile-0.2.6"
-AUTOCONF="autoconf-2.65"
+AUTOCONF="autoconf-2.67"
 AUTOMAKE="automake-1.11.1"
 
 BABL="babl-0.1.2"
@@ -232,7 +232,7 @@ JADETEX="jadetex-3.13"
 JASPER="jasper-1.900.1"
 JAVA="jre-1.6.0_05"
 
-KBD="kbd-1.15"
+KBD="kbd-1.15.2"
 KERBEROS5="krb5-1.4.1"
 KERNEL="linux-2.6.36"
 KVM="kvm-84"
@@ -280,7 +280,7 @@ LIBSOUP="libsoup-2.28.2"
 LIBSPF2="libspf2-1.2.5"
 LIBTASN1="libtasn1-2.3"
 LIBTHEORA="libtheora-1.1.1"
-LIBTOOL="libtool-2.2.6a"
+LIBTOOL="libtool-2.2.10"
 LIBVORBIS="libvorbis-1.2.3"
 VORBIS_TOOLS="vorbis-tools-1.2.0"
 LIBUSB="libusb-1.0.2"
@@ -295,7 +295,7 @@ LTSP_UTILS="ltsp-utils-0.25-0"
 MAILMAN="mailman-2.1.8"
 MAKE_PACKAGE="make-3.82"
 MAN_DB="man-db-2.5.6"
-MANPAGES="man-pages-3.23"
+MANPAGES="man-pages-3.30"
 METACITY="metacity-2.18.5"
 MFOUR="m4-1.4.14"
 MILTER_GREYLIST="milter-greylist-4.0"
@@ -330,7 +330,7 @@ PATCH_PACKAGE="patch-2.6"
 PCIUTILS="pciutils-3.1.4"
 PCMANFM="pcmanfm-0.5"
 PCRE="pcre-8.00"
-PERL="perl-5.10.1"
+PERL="perl-5.12.1"
 PERL_MOD_PDL="PDL-2.4.6"
 PERL_MOD_PARSE_REDESCENT="Parse-RecDescent-1.965001"
 PERL_MOD_XML_WRITER="XML-Writer-0.606"
@@ -355,7 +355,7 @@ PORTMAP="portmap-6.0"
 PPL="ppl-0.10.2"
 PROCMAIL="procmail-3.22"
 PROCPS="procps-3.2.8"
-PSMISC="psmisc-22.9"
+PSMISC="psmisc-22.12"
 PULSEAUDIO="pulseaudio-0.9.21"
 PYCAIRO="pycairo-1.8.8"
 PYGOBJECT="pygobject-2.20.0"
index e6e6803..dd5186c 100755 (executable)
@@ -13,21 +13,20 @@ source ${SCRDIR}/../sysinfos
 source ${SCRDIR}/../functions
 source ${SCRDIR}/../packages-list
 
-DEFAULT_CONFIGURE_PREFIX=/cross-tools
+# Setting default configure options for all scripts
+CONFIGURE_OPTS="\
+      --prefix=/cross-tools \
+      ${CONFIGURE_OPTS}"
 
 # Default configure function
-hvconfigure()
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}-build
 
-    FINAL_CFG_OPTS="\
-      --prefix=${DEFAULT_CONFIGURE_PREFIX} \
-      ${CONFIGURE_OPTS}"
-
     echo "Running configure with options:"
-    echo "  <${FINAL_CFG_OPTS}>"
+    echo "  <${CONFIGURE_OPTS}>"
 
-    ../${PACKAGE}/configure ${FINAL_CFG_OPTS}
+    ../${PACKAGE}/configure ${CONFIGURE_OPTS}
 }
 
 # Default build function
@@ -53,31 +52,37 @@ fi
 hvpatch
 
 # Execute config-cache function if applicable
-if function_exists config_cache ; then
+if function_exists hvconfig_cache ; then
     echo "Running configure cache script"
-    config_cache
+    hvconfig_cache
 
     CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache"
 fi
 
 # Execute pre-configure function if applicable
-if function_exists configure_pre ; then
+if function_exists hvconfig_pre ; then
     echo "Running configure pre-script"
-    configure_pre
+    hvconfig_pre
 fi
 
 if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then
     echo "Not calling configure because ${PACKAGE} has no configure script"
 else
-    hvconfigure
+    hvconfig
 fi
 
 # Execute post-configure function if applicable
-if function_exists configure_post ; then
+if function_exists hvconfig_post ; then
     echo "Running configure post-script"
-    configure_post
+    hvconfig_post
 fi
 
 hvbuild
 
+# Execute post-build function if applicable
+if function_exists hvbuild_post ; then
+    echo "Running build post-script"
+    hvbuild_post
+fi
+
 exit $?
diff --git a/stage0/cis-pre-install b/stage0/cis-pre-install
deleted file mode 100755 (executable)
index 5183a23..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Making sure that this script was executed by the root user
-if [ "x${USER}" != "xroot" ]; then
-    echo "You must be the superuser to install hvlinux."
-    exit 1
-fi
-
-# Making sure that the LFS directory is accessible
-if [ ! -d ${LFS} ]; then
-    echo "LFS destination directory not found."
-    exit 1
-fi
-
-# Testing for the presence of the lfs user
-# We cannot always automatically create the user 'lfs' because the installation media
-# can be a CD-ROM (read-only)
-# If installing from some kind of live-CD, simply install as root without the LFS
-# user :)
-if ! grep "lfs" /etc/passwd 1> /dev/null 2>&1; then
-    # The option '-k /dev/null' prevents possible copying of files from a
-    # skeleton directory (default is /etc/skel).
-    groupadd lfs
-    useradd -s /bin/bash -g lfs -m -k /dev/null lfs
-fi
-
-# Creating basic directories
-for subdir in tmp var tools cross-tools; do
-    dir=${LFS}/${subdir}
-    if [ ! -d ${dir} ]; then
-        install -dv ${dir}
-    fi
-done
-
-chown -R lfs:lfs ${LFS}
-
-# Creating a link from the host root directory to LFS cross-tools directories
-for subdir in tools cross-tools; do
-    ln -sfvT ${LFS}/${subdir} /${subdir}
-done
-
-cat > /home/lfs/.bashrc << "EOF"
-# Setting up the environment
-set +h
-umask 022
-LC_ALL=POSIX
-PATH=/cross-tools/bin:/bin:/usr/bin
-HVMAKE="make -j ${MAKEJOBS}"
-
-unset CFLAGS
-unset CXXFLAGS
-
-export LC_ALL PATH HVMAKE
-EOF
-
-chown lfs:lfs /home/lfs/.bashrc
-
-exit $?
index d8e60eb..786c754 100755 (executable)
@@ -55,35 +55,9 @@ ipkg_ac   ${CLOOG_PPL} "\
 
 LDFLAGS=""
 
-AR=ar AS=as \
-    ipkg_ac ${BINUTILS} "\
-        --host=${CLFS_HOST} \
-        --target=${CLFS_TARGET} \
-        --with-sysroot=${CLFS} \
-        --with-lib-path=/tools/lib \
-        --disable-nls \
-        --enable-shared \
-        --disable-multilib"
-
-GCC_PASS1="1" AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
-    ipkg ${GCC} cis-ac "${GCC}-pass1"
-
-BUILD_CC="gcc" \
-    CC="${CLFS_TARGET}-gcc ${CLFS_BUILDFLAGS}" \
-    AR="${CLFS_TARGET}-ar" \
-    RANLIB="${CLFS_TARGET}-ranlib" \
-    ipkg_ac   ${EGLIBC} "\
-        --host=${CLFS_TARGET} \
-        --build=${CLFS_HOST} \
-        --disable-profile \
-        --enable-add-ons \
-        --with-tls \
-        --enable-kernel=$(get_pkg_ver ${KERNEL}) \
-        --with-__thread \
-        --with-binutils=/cross-tools/bin \
-        --with-headers=/tools/include"
-
-GCC_PASS2="1" AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
-    ipkg ${GCC} cis-ac "${GCC}-pass2"
+ipkg_ac ${BINUTILS}
+GCC_PASS1="1" ipkg ${GCC} cis-ac "${GCC}-pass1"
+ipkg_ac ${EGLIBC}
+GCC_PASS2="1" ipkg ${GCC} cis-ac "${GCC}-pass2"
 
 exit $?
index 209859b..922e22c 100644 (file)
@@ -1,6 +1,19 @@
 #!/bin/bash
 
-configure_pre()
+export AR=ar
+export AS=as
+
+CONFIGURE_OPTS="\
+    --host=${CLFS_HOST} \
+    --target=${CLFS_TARGET} \
+    --with-sysroot=${CLFS} \
+    --with-lib-path=/tools/lib \
+    --disable-nls \
+    --enable-shared \
+    --disable-multilib \
+    ${CONFIGURE_OPTS}"
+
+hvconfig_pre()
 {
     case "${HVL_TARGET}" in
         "x86_64")
index 6e06827..5cec880 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/bash
 
-# Prevents the configure script from setting LD_LIBRARY_PATH when it finds PPL.
-# This will prevent any conflicts with libraries from the host system.
-configure_pre()
+hvconfig_pre()
 {
+    # Prevents the configure script from setting LD_LIBRARY_PATH when it finds PPL.
+    # This will prevent any conflicts with libraries from the host system.
     sed -e "/LD_LIBRARY_PATH=/d" -i ${LFS_TMP}/${PACKAGE}/configure
 }
index 4d98d1b..fe9dfe2 100644 (file)
@@ -1,17 +1,24 @@
 #!/bin/bash
 
-hvpatch()
-{
-    case "${HVL_TARGET}" in
-        "x86" | "x86_64")
-            # Manually apply patch
-            #apply_patch ${1}-rpath.patch ${1}
-            ;;
-    esac
-}
+BUILD_CC="gcc"
+CC="${CLFS_TARGET}-gcc ${CLFS_BUILDFLAGS}"
+AR="${CLFS_TARGET}-ar"
+RANLIB="${CLFS_TARGET}-ranlib"
+
+CONFIGURE_OPTS="\
+    --prefix=/tools \
+    --host=${CLFS_TARGET} \
+    --build=${CLFS_HOST} \
+    --disable-profile \
+    --enable-add-ons \
+    --with-tls \
+    --enable-kernel=$(get_pkg_ver ${KERNEL}) \
+    --with-__thread \
+    --with-binutils=/cross-tools/bin \
+    --with-headers=/tools/include"
 
 # For Glibc to support NPTL:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 libc_cv_forced_unwind=yes
@@ -21,7 +28,7 @@ libc_cv_ssp=no
 EOF
 }
 
-configure_pre()
+hvconfig_pre()
 {
     case "${HVL_TARGET}" in
         "x86")
@@ -38,6 +45,4 @@ configure_pre()
 
     # Disable linking to libgcc_eh:
     sed -e 's/-lgcc_eh//g' -i Makeconfig
-
-    DEFAULT_CONFIGURE_PREFIX=/tools
 }
index 5746dab..c1eb6b0 100644 (file)
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+AR=ar
+LDFLAGS="-Wl,-rpath,/cross-tools/lib"
+
 hvpatch()
 {
     # Manually applying patches if specified
@@ -19,7 +22,7 @@ hvpatch()
     esac
 }
 
-configure_pre()
+hvconfig_pre()
 {
     # Common options for passes 1 & 2
     CONFIGURE_OPTS="${CONFIGURE_OPTS} \
diff --git a/stage0/pre-install b/stage0/pre-install
new file mode 100755 (executable)
index 0000000..5183a23
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+set -o errexit
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Making sure that this script was executed by the root user
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+# Making sure that the LFS directory is accessible
+if [ ! -d ${LFS} ]; then
+    echo "LFS destination directory not found."
+    exit 1
+fi
+
+# Testing for the presence of the lfs user
+# We cannot always automatically create the user 'lfs' because the installation media
+# can be a CD-ROM (read-only)
+# If installing from some kind of live-CD, simply install as root without the LFS
+# user :)
+if ! grep "lfs" /etc/passwd 1> /dev/null 2>&1; then
+    # The option '-k /dev/null' prevents possible copying of files from a
+    # skeleton directory (default is /etc/skel).
+    groupadd lfs
+    useradd -s /bin/bash -g lfs -m -k /dev/null lfs
+fi
+
+# Creating basic directories
+for subdir in tmp var tools cross-tools; do
+    dir=${LFS}/${subdir}
+    if [ ! -d ${dir} ]; then
+        install -dv ${dir}
+    fi
+done
+
+chown -R lfs:lfs ${LFS}
+
+# Creating a link from the host root directory to LFS cross-tools directories
+for subdir in tools cross-tools; do
+    ln -sfvT ${LFS}/${subdir} /${subdir}
+done
+
+cat > /home/lfs/.bashrc << "EOF"
+# Setting up the environment
+set +h
+umask 022
+LC_ALL=POSIX
+PATH=/cross-tools/bin:/bin:/usr/bin
+HVMAKE="make -j ${MAKEJOBS}"
+
+unset CFLAGS
+unset CXXFLAGS
+
+export LC_ALL PATH HVMAKE
+EOF
+
+chown lfs:lfs /home/lfs/.bashrc
+
+exit $?
index fe9b2f7..770821f 100755 (executable)
@@ -26,7 +26,7 @@ export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
 export LFS_TMP="${LFS}/tmp"
 
 echo "Performing pre-install"
-./cis-pre-install
+./pre-install
 
 # Logging-in as 'lfs' user, and executing the install-1 script. The
 # 'su -' command starts with a clean environment and enters the home
index cf16137..de929c3 100755 (executable)
@@ -13,24 +13,23 @@ source ${SCRDIR}/../sysinfos
 source ${SCRDIR}/../functions
 source ${SCRDIR}/../packages-list
 
-DEFAULT_CONFIGURE_PREFIX=/tools
+# Setting default configure options for all scripts
+CONFIGURE_OPTS="\
+      --prefix=/tools \
+      --build=${CLFS_HOST} \
+      --host=${CLFS_TARGET} \
+      ${CONFIGURE_OPTS}"
 
 # Default configure function
-hvconfigure()
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}-build
 
-    FINAL_CFG_OPTS="\
-      --prefix=${DEFAULT_CONFIGURE_PREFIX} \
-      --build=${CLFS_HOST} \
-      --host=${CLFS_TARGET} \
-      ${CONFIGURE_OPTS}"
-
     echo "Running configure with options:"
-    echo "  <${FINAL_CFG_OPTS}>"
+    echo "  <${CONFIGURE_OPTS}>"
 
     CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-        ../${PACKAGE}/configure ${FINAL_CFG_OPTS}
+        ../${PACKAGE}/configure ${CONFIGURE_OPTS}
 }
 
 # Default build function
@@ -56,31 +55,37 @@ fi
 hvpatch
 
 # Execute config-cache function if applicable
-if function_exists config_cache ; then
+if function_exists hvconfig_cache ; then
     echo "Running configure cache script"
-    config_cache
+    hvconfig_cache
 
     CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${LFS_TMP}/${PACKAGE}-build/config.cache"
 fi
 
 # Execute pre-configure function if applicable
-if function_exists configure_pre ; then
+if function_exists hvconfig_pre ; then
     echo "Running configure pre-script"
-    configure_pre
+    hvconfig_pre
 fi
 
 if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then
     echo "Not calling configure because ${PACKAGE} has no configure script"
 else
-    hvconfigure
+    hvconfig
 fi
 
 # Execute post-configure function if applicable
-if function_exists configure_post ; then
+if function_exists hvconfig_post ; then
     echo "Running configure post-script"
-    configure_post
+    hvconfig_post
 fi
 
 hvbuild
 
+# Execute post-build function if applicable
+if function_exists hvbuild_post ; then
+    echo "Running build post-script"
+    hvbuild_post
+fi
+
 exit $?
diff --git a/stage1/cis-bootscripts b/stage1/cis-bootscripts
deleted file mode 100755 (executable)
index 5c0def2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Clock settings
-cat > ${LFS}/etc/sysconfig/clock << "EOF"
-UTC=1
-EOF
-
-# Copying boot scripts
-STAGE1_BOOTSCRIPTS="checkfs cleanfs functions halt hostname initlog modules mountfs \
-    mountkernfs rc reboot sendsignals setclock swap udev"
-mkdir -p ${LFS}/etc/rc.d/init.d
-for bootscript in ${STAGE1_BOOTSCRIPTS}; do
-    install -m755 bootscripts/${bootscript} ${LFS}/etc/rc.d/init.d
-done
-
-# Creating runlevels links
-for level in sysinit 0 1 2 3 4 5 6; do
-    dir=${LFS}/etc/rc.d/rc${level}.d
-    if [ -d ${dir} ]; then
-        # Removing old links
-        rm -f ${dir}/*
-    else
-        # Creating basic directory structure
-        mkdir -v -p ${dir}
-    fi
-done
-
-# rcsysinit.d
-bootscript_add_rcsysinit initlog     05 00
-bootscript_add_rcsysinit hostname    10 00
-bootscript_add_rcsysinit mountkernfs 15 00
-bootscript_add_rcsysinit modules     20 00
-bootscript_add_rcsysinit udev        25 00
-bootscript_add_rcsysinit checkfs     30 00
-bootscript_add_rcsysinit mountfs     35 95
-bootscript_add_rcsysinit swap        40 94
-bootscript_add_rcsysinit cleanfs     45 00
-bootscript_add_rcsysinit setclock    60 92
-
-# rc0.d
-bootscript_add_manual 0 sendsignals 95 00
-bootscript_add_manual 0 halt        99 00
-
-# rc6.d is almost identical to rc0.d
-bootscript_add_manual 6 sendsignals 95 00
-bootscript_add_manual 6 reboot      99 00
-
-exit $?
diff --git a/stage1/cis-post-install b/stage1/cis-post-install
deleted file mode 100755 (executable)
index 6f3fb4d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# We need /dev/null and /dev/console before udev is started.
-mkdir -pv ${LFS}/dev
-
-if [ ! -c ${LFS}/dev/console ]; then
-    mknod -m 0600 ${LFS}/dev/console c 5 1
-fi
-
-if [ ! -c ${LFS}/dev/null ]; then
-    mknod -m 0666 ${LFS}/dev/null c 1 3
-fi
-
-# Static UDEV devices
-if [ ! -c ${LFS}/lib/udev/devices/null ]; then
-    mknod -m0666 ${LFS}/lib/udev/devices/null c 1 3
-fi
-
-if [ ! -c ${LFS}/lib/udev/devices/kmsg ]; then
-    mknod -m0666 ${LFS}/lib/udev/devices/kmsg c 1 11
-fi
-
-if [ ! -h ${LFS}/lib/udev/devices/fd ]; then
-    ln -sfv /proc/self/fd ${LFS}/lib/udev/devices/fd
-fi
-
-if [ ! -h ${LFS}/lib/udev/devices/stdin ]; then
-    ln -sfv /proc/self/fd/0 ${LFS}/lib/udev/devices/stdin
-fi
-
-if [ ! -h ${LFS}/lib/udev/devices/stdout ]; then
-    ln -sfv /proc/self/fd/1 ${LFS}/lib/udev/devices/stdout
-fi
-
-if [ ! -h ${LFS}/lib/udev/devices/stderr ]; then
-    ln -sfv /proc/self/fd/2 ${LFS}/lib/udev/devices/stderr
-fi
-
-if [ ! -h ${LFS}/lib/udev/devices/core ]; then
-    ln -sfv /proc/kcore ${LFS}/lib/udev/devices/core
-fi
-
-# Change the ownership for ${LFS} and its subdirectories
-chown -Rv root:root ${LFS}
-
-exit $?
diff --git a/stage1/cis-pre-install b/stage1/cis-pre-install
deleted file mode 100755 (executable)
index 13815b4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Making sure that this script was executed by the root user
-if [ "x${USER}" != "xroot" ]; then
-    echo "You must be the superuser to install hvlinux."
-    exit 1
-fi
-
-# Making sure that the LFS directory is accessible
-if [ ! -d ${LFS} ]; then
-    echo "LFS destination directory not found."
-    exit 1
-fi
-
-# Make lfs the owner in case the installation is restarted
-chown -Rv lfs:lfs ${LFS}
-
-exit $?
index 5a8a9cf..be2fd3e 100755 (executable)
@@ -100,12 +100,12 @@ ipkg_ac   ${E2FSPROGS}
 ipkg_ac   ${SYSVINIT}
 ipkg_ac   ${MODULE_INIT_TOOLS}
 ipkg_ac   ${UDEV}
+ipkg_ac   ${KERNEL}
 
 rscr once "Creating default users" create-users
 rscr once "Creating default groups" create-groups
 rscr once "Creating default log files" create-logfiles
-rscr once "Installing kernel sources" install-linux-minimal
 rscr once "Creating default config files" create-config-files
-rscr once "Installing bootscripts" cis-bootscripts
+rscr once "Installing bootscripts" install-bootscripts
 
 exit $?
diff --git a/stage1/install-bootscripts b/stage1/install-bootscripts
new file mode 100755 (executable)
index 0000000..5c0def2
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+set -o errexit
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Clock settings
+cat > ${LFS}/etc/sysconfig/clock << "EOF"
+UTC=1
+EOF
+
+# Copying boot scripts
+STAGE1_BOOTSCRIPTS="checkfs cleanfs functions halt hostname initlog modules mountfs \
+    mountkernfs rc reboot sendsignals setclock swap udev"
+mkdir -p ${LFS}/etc/rc.d/init.d
+for bootscript in ${STAGE1_BOOTSCRIPTS}; do
+    install -m755 bootscripts/${bootscript} ${LFS}/etc/rc.d/init.d
+done
+
+# Creating runlevels links
+for level in sysinit 0 1 2 3 4 5 6; do
+    dir=${LFS}/etc/rc.d/rc${level}.d
+    if [ -d ${dir} ]; then
+        # Removing old links
+        rm -f ${dir}/*
+    else
+        # Creating basic directory structure
+        mkdir -v -p ${dir}
+    fi
+done
+
+# rcsysinit.d
+bootscript_add_rcsysinit initlog     05 00
+bootscript_add_rcsysinit hostname    10 00
+bootscript_add_rcsysinit mountkernfs 15 00
+bootscript_add_rcsysinit modules     20 00
+bootscript_add_rcsysinit udev        25 00
+bootscript_add_rcsysinit checkfs     30 00
+bootscript_add_rcsysinit mountfs     35 95
+bootscript_add_rcsysinit swap        40 94
+bootscript_add_rcsysinit cleanfs     45 00
+bootscript_add_rcsysinit setclock    60 92
+
+# rc0.d
+bootscript_add_manual 0 sendsignals 95 00
+bootscript_add_manual 0 halt        99 00
+
+# rc6.d is almost identical to rc0.d
+bootscript_add_manual 6 sendsignals 95 00
+bootscript_add_manual 6 reboot      99 00
+
+exit $?
diff --git a/stage1/install-linux-minimal b/stage1/install-linux-minimal
deleted file mode 100755 (executable)
index b464d8e..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-PACKAGE=${KERNEL}
-
-# Move kernel source files to their final destination
-mkdir -pv ${LFS}/usr/src
-decompress_package ${PACKAGE} ${LFS}/usr/src
-
-cd ${LFS}/usr/src/${PACKAGE}
-${HVMAKE} mrproper
-
-# Install HV kernel compilation script:
-VERSION=$(get_pkg_ver ${PACKAGE})
-SCRIPT=${LFS}/usr/src/compile-kernel-minimal
-
-echo "#!/bin/bash" > ${SCRIPT}
-echo "set -o errexit" >> ${SCRIPT}
-echo "KERNEL_VERSION=${VERSION}" >> ${SCRIPT}
-echo "KERNEL_NAME=clfs-\${KERNEL_VERSION}" >> ${SCRIPT}
-echo "DEST=${LFS}/boot" >> ${SCRIPT}
-echo "PATH=\${PATH}:${LFS}/cross-tools/bin" >> ${SCRIPT}
-echo "" >> ${SCRIPT}
-
-echo "make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}- menuconfig" >> ${SCRIPT}
-
-# Compile the kernel image:
-echo "make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}-" >> ${SCRIPT}
-
-# Install the kernel:
-echo "cp -v arch/${CLFS_ARCH}/boot/bzImage \${DEST}/vmlinuz-\${KERNEL_NAME}" >> ${SCRIPT}
-
-# Install map file:
-echo "cp -v System.map \${DEST}/System.map-\${KERNEL_NAME}" >> ${SCRIPT}
-
-# Install config file:
-echo "cp -v .config \${DEST}/config-\${KERNEL_NAME}" >> ${SCRIPT}
-
-chmod -v u+x ${SCRIPT}
-
-exit $?
index 30ad517..867e03a 100644 (file)
@@ -6,7 +6,7 @@
 # will break one of the C++ test scripts in eglibc. The following prevents
 # future problems by skipping the check for named pipes, as well as other tests
 # that can not run while cross-compiling or that do not run properly:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 ac_cv_func_mmap_fixed_mapped=yes
@@ -24,10 +24,7 @@ gt_cv_int_divbyzero_sigfpe=yes
 EOF
 }
 
-hvbuild()
+hvbuild_post()
 {
-    ${HVMAKE}
-    ${HVMAKE} install
-
     ln -svfT bash /tools/bin/sh
 }
index 9f34be4..605dc88 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-configure_pre()
+hvconfig_pre()
 {
     case "${HVL_TARGET}" in
         "x86_64")
index bedd643..caadb9b 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # This package doesn't have a configure script...
-hvconfigure()
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}
 
index 6e06827..7b745ad 100644 (file)
@@ -2,7 +2,7 @@
 
 # Prevents the configure script from setting LD_LIBRARY_PATH when it finds PPL.
 # This will prevent any conflicts with libraries from the host system.
-configure_pre()
+hvconfig_pre()
 {
     sed -e "/LD_LIBRARY_PATH=/d" -i ${LFS_TMP}/${PACKAGE}/configure
 }
index c90f4fe..d454d93 100644 (file)
@@ -3,7 +3,7 @@
 # Configure cannot properly determine how to get free space when cross-compiling
 # and as a result the df program will not be built. Add the following entries to
 # config.cache  to correct this, and fix various cross-compiling issues:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 fu_cv_sys_stat_statfs2_bsize=yes
@@ -11,7 +11,7 @@ gl_cv_func_working_mkstemp=yes
 EOF
 }
 
-configure_pre()
+hvconfig_pre()
 {
     # Fix a bug when the uname patch is automatically applied
     touch ${LFS_TMP}/${PACKAGE}/man/{uname,hostname}.1
index 159f339..0d9f401 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-hvconfigure()
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}-build
 
@@ -24,7 +24,10 @@ hvbuild()
 
     # Install the static libraries and headers:
     ${HVMAKE} install-libs
+}
 
+hvbuild_post()
+{
     # Create needed symlinks for a bootable system:
     LINKS="fsck.ext2 fsck.ext3 fsck.ext4 e2fsck"
 
index b833e36..94cc2fc 100644 (file)
@@ -2,7 +2,7 @@
 
 # The following cache entries set the values for tests that do not run while
 # cross-compiling:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 gl_cv_func_wcwidth_works=yes
index c3c4a77..0d60fdc 100644 (file)
@@ -2,7 +2,7 @@
 
 # When Cross Compiling the configure script does not determine the correct
 # values for the following, Set the values manually:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 ac_cv_func_malloc_0_nonnull=yes
@@ -10,7 +10,7 @@ ac_cv_func_realloc_0_nonnull=yes
 EOF
 }
 
-configure_pre()
+hvconfig_pre()
 {
     # Make sure that Flex doesn't try to include headers from /usr/include.
     sed -e "s/-I@includedir@//g" -i ${LFS_TMP}/${PACKAGE}/Makefile.in
index c6df1c7..bde638a 100644 (file)
@@ -19,7 +19,7 @@ hvpatch()
     esac
 }
 
-configure_pre()
+hvconfig_pre()
 {
     cd ${LFS_TMP}/${PACKAGE}
 
@@ -35,7 +35,7 @@ configure_pre()
         gcc/Makefile.in.orig > gcc/Makefile.in
 }
 
-configure_post()
+hvconfig_post()
 {
     # Prevent GCC from looking in the wrong directories for headers and
     # libraries:
index 670907b..6bd0d9a 100644 (file)
@@ -3,14 +3,14 @@
 # When cross-compiling the Gettext configure script assumes we don't have a
 # working wcwidth when we do. The following will fix possible compilation
 # errors because of this assumption:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 gl_cv_func_wcwidth_works=yes
 EOF
 }
 
-hvconfigure()
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}/gettext-tools
 
index 7fe6d0f..1d6dc4f 100644 (file)
@@ -2,7 +2,7 @@
 
 # When Cross Compiling the configure script does not determine the correct values
 # for the following, Set the values manually:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 ac_cv_func_malloc_0_nonnull=yes
diff --git a/stage1/pkg/linux b/stage1/pkg/linux
new file mode 100644 (file)
index 0000000..0857772
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvbuild()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    # Move kernel source files to their final destination
+    mkdir -pv ${LFS}/usr/src
+    decompress_package ${PACKAGE} ${LFS}/usr/src
+
+    cd ${LFS}/usr/src/${PACKAGE}
+    ${HVMAKE} mrproper
+
+    # Install HV kernel compilation script:
+    VERSION=$(get_pkg_ver ${PACKAGE})
+    SCRIPT=${LFS}/usr/src/compile-kernel-minimal
+
+    echo "#!/bin/bash" > ${SCRIPT}
+    echo "set -o errexit" >> ${SCRIPT}
+    echo "KERNEL_VERSION=${VERSION}" >> ${SCRIPT}
+    echo "KERNEL_NAME=clfs-\${KERNEL_VERSION}" >> ${SCRIPT}
+    echo "DEST=${LFS}/boot" >> ${SCRIPT}
+    echo "PATH=\${PATH}:${LFS}/cross-tools/bin" >> ${SCRIPT}
+    echo "" >> ${SCRIPT}
+
+    echo "make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}- menuconfig" >> ${SCRIPT}
+
+    # Compile the kernel image:
+    echo "make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}-" >> ${SCRIPT}
+
+    # Install the kernel:
+    echo "cp -v arch/${CLFS_ARCH}/boot/bzImage \${DEST}/vmlinuz-\${KERNEL_NAME}" >> ${SCRIPT}
+
+    # Install map file:
+    echo "cp -v System.map \${DEST}/System.map-\${KERNEL_NAME}" >> ${SCRIPT}
+
+    # Install config file:
+    echo "cp -v .config \${DEST}/config-\${KERNEL_NAME}" >> ${SCRIPT}
+
+    chmod -v u+x ${SCRIPT}
+}
index d048865..d3ef530 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Configure can not properly determine the results of the following tests:
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 gl_cv_func_btowc_eof=yes
@@ -15,7 +15,7 @@ gl_cv_func_wctob_works=yes
 EOF
 }
 
-configure_pre()
+hvconfig_pre()
 {
     # Add a missing include statement into one of the source files:
     sed -e '/"m4.h"/i\#include <sys/stat.h>' -i ${LFS_TMP}/${PACKAGE}/src/path.c
index d458647..d05c66f 100644 (file)
@@ -1,17 +1,13 @@
 #!/bin/bash
 
-hvconfigure()
-{
-    cd ${LFS_TMP}/${PACKAGE}-build
+CC="${CC} ${CLFS_BUILDFLAGS}"
 
-    CC="${CC} ${CLFS_BUILDFLAGS}" \
-        ../${PACKAGE}/configure \
-        --prefix=/ \
-        --bindir=/bin \
-        --sbindir=/sbin \
-        --build=${CLFS_HOST} \
-        --host=${CLFS_TARGET}
-}
+CONFIGURE_OPTS="\
+    --prefix=/ \
+    --bindir=/bin \
+    --sbindir=/sbin \
+    --build=${CLFS_HOST} \
+    --host=${CLFS_TARGET}"
 
 hvbuild()
 {
index 87f279d..06699f1 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-configure_post()
+hvconfig_post()
 {
     # When PPL is cross-compiled, it does not check whether GMP was compiled
     # with support for exceptions, and simply assumes it was not. This
index 4cf5905..aaa9bcf 100644 (file)
@@ -2,7 +2,7 @@
 
 HV_NO_CONFIGURE_SCRIPT=1
 
-configure_pre()
+hvconfig_pre()
 {
     cd ${LFS_TMP}/${PACKAGE}
 
index d2c52da..5946e74 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Configure can not properly determine the results of a few tests.
-config_cache()
+hvconfig_cache()
 {
 cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
 gl_cv_func_wcwidth_works=yes
index 0d46963..984e6f7 100644 (file)
@@ -1,26 +1,23 @@
 #!/bin/bash
 
-configure_pre()
-{
-    cd ${LFS_TMP}/${PACKAGE}
+CC="${CC} ${CLFS_BUILDFLAGS}"
 
-    install -dv ${LFS}/lib/{firmware,udev/devices/{pts,shm}}
-}
+CONFIGURE_OPTS="\
+    --prefix=/usr \
+    --build=${CLFS_HOST} \
+    --host=${CLFS_TARGET} \
+    --exec-prefix="" \
+    --sysconfdir=/etc \
+    --libexecdir=/lib/udev \
+    --libdir=/usr/lib \
+    --disable-extras \
+    --disable-introspection"
 
-hvconfigure()
+hvconfig_pre()
 {
-    cd ${LFS_TMP}/${PACKAGE}-build
+    cd ${LFS_TMP}/${PACKAGE}
 
-    CC="${CC} ${CLFS_BUILDFLAGS}" ../${PACKAGE}/configure \
-        --prefix=/usr \
-        --build=${CLFS_HOST} \
-        --host=${CLFS_TARGET} \
-        --exec-prefix="" \
-        --sysconfdir=/etc \
-        --libexecdir=/lib/udev \
-        --libdir=/usr/lib \
-        --disable-extras \
-        --disable-introspection
+    install -dv ${LFS}/lib/{firmware,udev/devices/{pts,shm}}
 }
 
 hvbuild()
index b6a89cf..ad66e53 100644 (file)
@@ -1,22 +1,22 @@
 #!/bin/bash
 
-hvconfigure()
-{
-    cd ${LFS_TMP}/${PACKAGE}-build
+CC="${CC} ${CLFS_BUILDFLAGS}"
+CXX="${CXX} ${CLFS_BUILDFLAGS}"
 
-    CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-        ../${PACKAGE}/configure \
-        --build=${CLFS_HOST} \
-        --host=${CLFS_TARGET} \
-        --enable-login-utils \
-        --disable-makeinstall-chown
-}
+CONFIGURE_OPTS="\
+    --build=${CLFS_HOST} \
+    --host=${CLFS_TARGET} \
+    --enable-login-utils \
+    --disable-makeinstall-chown"
 
 hvbuild()
 {
     ${HVMAKE}
     ${HVMAKE} DESTDIR=${LFS} install
+}
 
+hvbuild_post()
+{
     # Copy Libraries and includes to /tools:
     rm -fv ${LFS}/usr/lib/lib{blkid,uuid}.la
     cp -v ${LFS}/usr/lib/lib{blkid,uuid}* /tools/lib
index 0be85a5..3cd0f86 100644 (file)
@@ -1,9 +1,11 @@
 #!/bin/bash
 
-hvconfigure()
+CC="${CC} ${CLFS_BUILDFLAGS}"
+
+hvconfig()
 {
     cd ${LFS_TMP}/${PACKAGE}
 
-    CC="${CC} ${CLFS_BUILDFLAGS}" ./configure \
+    ./configure \
         --prefix=/tools
 }
diff --git a/stage1/post-install b/stage1/post-install
new file mode 100755 (executable)
index 0000000..6f3fb4d
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+set -o errexit
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# We need /dev/null and /dev/console before udev is started.
+mkdir -pv ${LFS}/dev
+
+if [ ! -c ${LFS}/dev/console ]; then
+    mknod -m 0600 ${LFS}/dev/console c 5 1
+fi
+
+if [ ! -c ${LFS}/dev/null ]; then
+    mknod -m 0666 ${LFS}/dev/null c 1 3
+fi
+
+# Static UDEV devices
+if [ ! -c ${LFS}/lib/udev/devices/null ]; then
+    mknod -m0666 ${LFS}/lib/udev/devices/null c 1 3
+fi
+
+if [ ! -c ${LFS}/lib/udev/devices/kmsg ]; then
+    mknod -m0666 ${LFS}/lib/udev/devices/kmsg c 1 11
+fi
+
+if [ ! -h ${LFS}/lib/udev/devices/fd ]; then
+    ln -sfv /proc/self/fd ${LFS}/lib/udev/devices/fd
+fi
+
+if [ ! -h ${LFS}/lib/udev/devices/stdin ]; then
+    ln -sfv /proc/self/fd/0 ${LFS}/lib/udev/devices/stdin
+fi
+
+if [ ! -h ${LFS}/lib/udev/devices/stdout ]; then
+    ln -sfv /proc/self/fd/1 ${LFS}/lib/udev/devices/stdout
+fi
+
+if [ ! -h ${LFS}/lib/udev/devices/stderr ]; then
+    ln -sfv /proc/self/fd/2 ${LFS}/lib/udev/devices/stderr
+fi
+
+if [ ! -h ${LFS}/lib/udev/devices/core ]; then
+    ln -sfv /proc/kcore ${LFS}/lib/udev/devices/core
+fi
+
+# Change the ownership for ${LFS} and its subdirectories
+chown -Rv root:root ${LFS}
+
+exit $?
diff --git a/stage1/pre-install b/stage1/pre-install
new file mode 100755 (executable)
index 0000000..13815b4
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -o errexit
+
+# Reading system configuration informations, functions and package versions.
+source ../sysinfos
+source ../functions
+source ../packages-list
+
+# Making sure that this script was executed by the root user
+if [ "x${USER}" != "xroot" ]; then
+    echo "You must be the superuser to install hvlinux."
+    exit 1
+fi
+
+# Making sure that the LFS directory is accessible
+if [ ! -d ${LFS} ]; then
+    echo "LFS destination directory not found."
+    exit 1
+fi
+
+# Make lfs the owner in case the installation is restarted
+chown -Rv lfs:lfs ${LFS}
+
+exit $?
index 8e7d8d9..dd89a72 100755 (executable)
@@ -27,14 +27,14 @@ export LFS_TMP="${LFS}/tmp"
 
 init_log_file
 
-rscr mult "Performing pre-install" cis-pre-install
+rscr mult "Performing pre-install" pre-install
 
 # Logging-in as 'lfs' user, and executing the install-1 script. The
 # 'su -' command starts with a clean environment and enters the home
 # directory of the user.
 su - lfs -c "cd ${PWD}; ./install-1"
 
-rscr mult "Performing post-install" cis-post-install
+rscr mult "Performing post-install" post-install
 
 echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h"
 
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 $?
diff --git a/stage2/cis-ac-nobuild b/stage2/cis-ac-nobuild
deleted file mode 100755 (executable)
index bbe3998..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-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}
-
-cd ${LFS_TMP}/${PACKAGE}
-./configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    ${CONFIGURE_OPTS}
-make
-make install
-ldconfig
-
-exit $?
diff --git a/stage2/cis-binutils b/stage2/cis-binutils
deleted file mode 100755 (executable)
index 2efe336..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-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}
-
-cd ${LFS_TMP}/${PACKAGE}
-
-case "${HVL_TARGET}" in
-    "x86_64")
-        # Libiberty uses gcc -print-multi-os-directory to determine where to
-        # install libiberty.a. Because our temporary GCC is still
-        # multilib-aware, the command returns ../lib64 which causes the archive
-        # to be installed into /usr/lib64. The following sed will prevent this:
-        sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' libiberty/Makefile.in
-
-        # This adds 64 bit support to Binutils.
-       CONFIGURE_OPTS="${CONFIGURE_OPTS} --enable-64-bit-bfd"
-       ;;
-esac
-
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    ${CONFIGURE_OPTS}
-make configure-host
-make tooldir=/usr
-
-# Install the package:
-make tooldir=/usr install
-
-# Install the libiberty header file that is needed by some packages:
-cp -v ../${PACKAGE}/include/libiberty.h /usr/include
-
-exit $?
diff --git a/stage2/cis-bison b/stage2/cis-bison
deleted file mode 100755 (executable)
index fd30558..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr \
-    --sysconfdir=/etc
-# The configure system causes bison to be built without support for
-# internationalization of error messages if a bison program is not
-# already in $PATH. The following addition will correct this:
-echo '#define YYENABLE_NLS 1' >> config.h
-make
-make install
-ldconfig
-
-exit $?
diff --git a/stage2/cis-coreutils b/stage2/cis-coreutils
deleted file mode 100755 (executable)
index e540705..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr \
-    --enable-no-install-program=kill,uptime
-make -j ${MAKEJOBS}
-make install
-
-# Move some programs to their proper FHS locations:
-mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
-mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
-# Now specify new path to mv to eliminate error message:
-#   "/usr/bin/mv: No such file or directory" 
-/bin/mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
-/bin/mv -v /usr/bin/chroot /usr/sbin
-
-# Some of the scripts in the LFS-Bootscripts package depend on head
-# sleep and nice. As /usr may not be available during the early stages
-# of booting, those binaries need to be on the root partition:
-/bin/mv -v /usr/bin/{head,sleep,nice} /bin
-
-# Return last error
-exit $?
diff --git a/stage2/cis-e2fsprogs b/stage2/cis-e2fsprogs
deleted file mode 100755 (executable)
index 02997da..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr \
-    --with-root-prefix="" \
-    --enable-elf-shlibs \
-    --disable-libblkid \
-    --disable-libuuid \
-    --disable-uuidd \
-    --disable-fsck
-make -j ${MAKEJOBS}
-make install
-# Install the static libraries and headers:
-make install-libs
-
-# Make the installed static libraries writable so debugging symbols can be removed later:
-chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
-
-exit $?
diff --git a/stage2/cis-eglibc b/stage2/cis-eglibc
deleted file mode 100755 (executable)
index 103a21b..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/bash
-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=${*}
-
-EGLIBC_VER=$(echo ${PACKAGE} | sed "s!eglibc-\([0-9]*\.[0-9]*\.[0-9]*\)-.*!\1!g")
-
-case "${HVL_TARGET}" in
-    "x86" | "x86_64")
-        # Manually apply patch
-        apply_patch ${PACKAGE}-rpath.patch ${PACKAGE}
-        ;;
-esac
-
-TMP_CFLAGS="-mtune=generic -g -O2"
-
-case "${HVL_TARGET}" in
-    "x86")
-        TMP_CFLAGS="-march=$(cut -d- -f1 <<< ${CLFS_TARGET}) ${TMP_CFLAGS}"
-        ;;
-esac
-
-# When running make install, a script called test-installation.pl
-# performs a small sanity test on our newly installed Glibc. However,
-# because our toolchain still points to the /tools directory, the
-# sanity test would be carried out against the wrong Glibc. We can
-# force the script to check the Glibc we have just installed with:
-cd ${LFS_TMP}/${PACKAGE}
-LINKER=$(readelf -l $(file /tools/lib/libc-* | cut -f1 -d:) | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
-sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=${LINKER} -o|" \
-    scripts/test-installation.pl
-unset LINKER
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-case "${HVL_TARGET}" in
-    "x86_64")
-        # Tell EGLIBC to install its libraries into /lib:
-        echo "slibdir=/lib" >> configparms
-        CONFIGURE_OPTS="${CONFIGURE_OPTS} --libdir=/usr/lib"
-       ;;
-esac
-
-# Configure options:
-# --libexecdir=/usr/lib/eglibc
-#     Changes the location of the pt_chown program from its default of /usr/libexec to /usr/lib/eglibc.
-CFLAGS=${TMP_CFLAGS} \
-     ../${PACKAGE}/configure \
-    --prefix=/usr \
-    --disable-profile \
-    --enable-add-ons \
-    --enable-kernel=$(get_pkg_ver ${KERNEL}) \
-    --libexecdir=/usr/lib/eglibc \
-    ${CONFIGURE_OPTS}
-make
-touch /etc/ld.so.conf
-
-case "${HVL_TARGET}" in
-    "x86_64")
-        # The install will finish by checking that everything is correctly
-        # installed. Unfortunately, it will test for a multilib installation.
-        # On x86_64 Pure64 this means it will try to test the non-existent
-        # 32-bit loader which has a different name from the 64-bit loader
-        # (unlike on other 64-bit architectures). We fool it by creating a
-        # symlink to the real loader.
-        ln -svfT ld-${EGLIBC_VER}.so /lib/ld-linux.so.2
-        make install
-
-        # Now we can remove this symlink.
-        rm -v /lib/ld-linux.so.2
-
-        # We also need to correct the /usr/bin/ldd script - if you look at this,
-        # you will see it references not only the 32-bit linker, but also /lib64
-        # where it thinks the 64-bit linker is.
-        cp -v /usr/bin/ldd{,.bak}
-        sed '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd.bak >/usr/bin/ldd
-        rm -v /usr/bin/ldd.bak
-       ;;
-    *)
-        make install
-       ;;
-esac
-
-# The following instructions, instead of the install-locales target
-# above, will install the minimum set of locales necessary for the
-# tests to run successfully:
-mkdir -pv /usr/lib/locale
-localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
-localedef -i de_DE -f ISO-8859-1 de_DE
-localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
-localedef -i de_DE -f UTF-8 de_DE.UTF-8
-localedef -i en_HK -f ISO-8859-1 en_HK
-localedef -i en_PH -f ISO-8859-1 en_PH
-localedef -i en_US -f ISO-8859-1 en_US
-localedef -i en_US -f UTF-8 en_US.UTF-8
-localedef -i es_MX -f ISO-8859-1 es_MX
-localedef -i fa_IR -f UTF-8 fa_IR
-localedef -i fr_FR -f ISO-8859-1 fr_FR
-localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
-localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
-localedef -i it_IT -f ISO-8859-1 it_IT
-localedef -i ja_JP -f EUC-JP ja_JP
-localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
-localedef -i zh_CN -f GB18030 zh_CN.GB18030
-
-# French canadian locales:
-localedef -i ca_FR -f UTF-8 ca_FR.UTF-8
-localedef -i ca_FR -f ISO-8859-1 ca_FR
-localedef -i fr_CA -f UTF-8 fr_CA.UTF-8
-localedef -i fr_CA -f ISO-8859-1 fr_CA
-
-cat > /etc/nsswitch.conf << "EOF"
-# /etc/nsswitch.conf
-
-passwd: files
-group: files
-shadow: files
-
-hosts: files dns
-networks: files
-
-protocols: files
-services: files
-ethers: files
-rpc: files
-EOF
-
-ln -svfT ${TIMEZONE} /usr/share/zoneinfo/localtime
-cp --remove-destination /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
-
-cat > /etc/ld.so.conf << "EOF"
-# /etc/ld.so.conf
-/usr/local/lib
-/opt/lib
-EOF
-
-exit $?
diff --git a/stage2/cis-flex b/stage2/cis-flex
deleted file mode 100755 (executable)
index ff5ae38..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr
-make -j ${MAKEJOBS}
-make install
-
-ln -sfv libfl.a /usr/lib/libl.a
-
-# Create a bash script called lex that calls flex and have it emulate lex.
-cat > /usr/bin/lex << "EOF"
-#!/bin/sh
-# /usr/bin/lex
-
-exec /usr/bin/flex -l "$@"
-EOF
-chmod -v 755 /usr/bin/lex
-
-# Return last error
-exit ${?}
diff --git a/stage2/cis-gcc b/stage2/cis-gcc
deleted file mode 100755 (executable)
index 434386d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Manually applying patches
-apply_patch ${PACKAGE}-branch_update-1.patch ${PACKAGE}
-
-case "${HVL_TARGET}" in
-    "x86_64")
-        # Apply the following patch so that GCC links to /lib instead of /lib64:
-        apply_patch ${PACKAGE}-pure64-1.patch ${PACKAGE}
-       ;;
-esac
-
-cd ${LFS_TMP}/${PACKAGE}
-
-# Applying a sed substitution that will suppress the installation of
-# libiberty.a. We want to use the Binutils version of libiberty.a
-sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
-
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    ${CONFIGURE_OPTS}
-make
-make install
-ldconfig
-
-ln -svf ../usr/bin/cpp /lib
-ln -svf gcc /usr/bin/cc
-
-exit $?
diff --git a/stage2/cis-iana b/stage2/cis-iana
deleted file mode 100755 (executable)
index bd972fe..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-# iana-etc installs /etc/services and /etc/protocols using data from the
-# Internet Assigned Numbers Authority.
-
-cd ${LFS_TMP}/${1}
-make -j ${MAKEJOBS}
-make install
-
-# Return last error
-exit $?
diff --git a/stage2/cis-iproute2 b/stage2/cis-iproute2
deleted file mode 100755 (executable)
index 866aca6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-
-# The arpd binary included in this package is dependent on Berkeley DB.
-# Because arpd is not a very common requirement on a base Linux system,
-# remove the dependency on Berkeley DB by applying the sed command below
-sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
-
-make DESTDIR= DOCDIR=/usr/share/doc/iproute2 \
-    MANDIR=/usr/share/man
-
-make DESTDIR= DOCDIR=/usr/share/doc/iproute2 \
-    MANDIR=/usr/share/man install
-
-exit $?
diff --git a/stage2/cis-kernel b/stage2/cis-kernel
deleted file mode 100755 (executable)
index 9c6705b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# 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}
-
-# The kernel sources were already copied into /usr/src in stage0
-cd /usr/src/${PACKAGE}
-make mrproper
-make headers_check
-# Remove any previous headers install
-rm -rf dest
-make INSTALL_HDR_PATH=dest headers_install
-cp -rv dest/include/* /usr/include
-find /usr/include -name .install -or -name ..install.cmd | xargs rm -fv
-rm -rf dest
-
-# Install HV kernel compilation script:
-VERSION=$(get_pkg_ver ${PACKAGE})
-SCRIPT=/usr/src/compile-kernel
-
-echo "#!/bin/bash" > ${SCRIPT}
-echo "set -o errexit" >> ${SCRIPT}
-echo "KERNEL_VERSION=${VERSION}" >> ${SCRIPT}
-echo "KERNEL_NAME=clfs-\${KERNEL_VERSION}" >> ${SCRIPT}
-echo "DEST=/boot" >> ${SCRIPT}
-echo "ARCH=${HVL_TARGET}" >> ${SCRIPT}
-echo "unset CROSS_COMPILE" >> ${SCRIPT}
-echo "" >> ${SCRIPT}
-echo "make" >> ${SCRIPT}
-echo "make modules" >> ${SCRIPT}
-echo "make modules_install" >> ${SCRIPT}
-echo "cp -v arch/${HVL_TARGET}/boot/bzImage \${DEST}/vmlinuz-\${KERNEL_NAME}" >> ${SCRIPT}
-echo "cp -v System.map \${DEST}/System.map-\${KERNEL_NAME}" >> ${SCRIPT}
-echo "cp -v .config \${DEST}/config-\${KERNEL_NAME}" >> ${SCRIPT}
-
-chmod -v u+x ${SCRIPT}
-
-exit $?
diff --git a/stage2/cis-man-pages b/stage2/cis-man-pages
deleted file mode 100755 (executable)
index 952cd15..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-make install
-
-exit $?
diff --git a/stage2/cis-ncurses b/stage2/cis-ncurses
deleted file mode 100755 (executable)
index ffe95a1..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr \
-    --with-shared \
-    --without-debug \
-    --enable-widec
-make -j ${MAKEJOBS}
-make install
-
-# Move the libraries to the /lib  directory, where they are expected to reside:
-mv -fv /usr/lib/libncursesw.so.5* /lib
-
-# Because the libraries have been moved, one symlink points to a non-existent file:
-ln -sfvT ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
-
-# Many applications still expect the linker to be able to find
-# non-wide-character Ncurses libraries. Trick such applications
-# into linking with wide-character libraries by means of symlinks
-# and linker scripts:
-for lib in ncurses form panel menu ; do
-    rm -vf /usr/lib/lib${lib}.so
-    echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so
-    ln -sfvT lib${lib}w.a /usr/lib/lib${lib}.a
-done
-ln -sfvT libncurses++w.a /usr/lib/libncurses++.a
-
-# Finally, make sure that old applications that look for
-# -lcurses at build time are still buildable:
-rm -vf /usr/lib/libcursesw.so
-echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
-ln -sfv libncurses.so /usr/lib/libcurses.so
-ln -sfv libncursesw.a /usr/lib/libcursesw.a
-ln -sfv libncurses.a /usr/lib/libcurses.a
-
-ldconfig
-
-exit $?
diff --git a/stage2/cis-perl-pass1 b/stage2/cis-perl-pass1
deleted file mode 100755 (executable)
index 3cdfabe..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-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}
-
-cd ${LFS_TMP}/${PACKAGE}
-
-# Change a hardcoded path from /usr/include to /tools/include:
-sed -i 's@/usr/include@/tools/include@g' ext/Errno/Errno_pm.PL
-
-./configure.gnu \
-    --prefix=/tools \
-    -Dcc="gcc" \
-    ${CONFIGURE_OPTS}
-make
-make install
-ldconfig
-
-ln -svfT /tools/bin/perl /usr/bin/perl
-
-exit $?
diff --git a/stage2/cis-pkg-config b/stage2/cis-pkg-config
deleted file mode 100755 (executable)
index 7d59783..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr
-make -j ${MAKEJOBS}
-make install
-
-var_add_path "PKG_CONFIG_PATH" /etc/profile "/usr/local/lib/pkgconfig"
-var_export   "PKG_CONFIG_PATH" /etc/profile
-
-# Return last error
-exit $?
diff --git a/stage2/cis-procps b/stage2/cis-procps
deleted file mode 100755 (executable)
index 8bd8e5a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-make -j ${MAKEJOBS}
-make install
-
-exit $?
diff --git a/stage2/cis-readline b/stage2/cis-readline
deleted file mode 100755 (executable)
index cf28d22..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-
-# Reinstalling Readline will cause the old libraries to be moved to
-# <libraryname>.old. While this is normally not a problem, in some
-# cases it can trigger a linking bug in ldconfig. This can be
-# avoided by issuing the following two seds:
-sed -i '/MV.*old/d' Makefile.in
-sed -i '/{OLDSUFF}/c:' support/shlib-install
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
-    --prefix=/usr \
-    --libdir=/lib
-# SHLIB_LIBS=-lncurses: Forces Readline to link against the libncurses library.
-make SHLIB_LIBS=-lncurses
-make install
-# Now move the static libraries to a more appropriate location:
-mv -v /lib/lib{readline,history}.a /usr/lib
-
-# Next, remove the .so files in /lib and relink them into /usr/lib:
-rm -v /lib/lib{readline,history}.so
-ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
-ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
-
-exit $?
diff --git a/stage2/cis-util-linux-ng b/stage2/cis-util-linux-ng
deleted file mode 100755 (executable)
index 967bb3b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-cd ${LFS_TMP}/${1}
-
-# The FHS recommends that we use /var/lib/hwclock, instead of the usual
-# /etc, as the location for the adjtime file. To make the hwclock program
-# FHS-compliant, run the following:
-sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' -i $(grep -rl '/etc/adjtime' .)
-mkdir -pv /var/lib/hwclock
-
-./configure --enable-arch --enable-partx --enable-write
-
-make -j ${MAKEJOBS}
-make install
-
-# Move the logger  binary to /bin as it is needed by the CLFS-Bootscripts package:
-mv -v /usr/bin/logger /bin
-
-exit $?
diff --git a/stage2/cis-zlib b/stage2/cis-zlib
deleted file mode 100755 (executable)
index c2a433b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-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}
-
-cd ${LFS_TMP}/${PACKAGE}
-./configure \
-    --prefix=/usr \
-    ${CONFIGURE_OPTS}
-make
-make install
-ldconfig
-
-# The previous command installed two .so files into /usr/lib.
-# We will move it into /lib and then relink it to /usr/lib:
-mv -v /usr/lib/libz.so.* /lib
-ln -svf ../../lib/libz.so.1 /usr/lib/libz.so
-
-# Fix the permissions on the static library: 
-chmod 644 /usr/lib/libz.a
-
-exit $?
index debabd7..14ab663 100755 (executable)
@@ -17,7 +17,6 @@ init_log_file
 # Scripts directory
 export SCRDIR=$(pwd)
 
-ipkg_ac    ${LIBTOOL}
 ipkg_cust  ${GDBM} cis-gdbm
 ipkg_cust  ${INETUTILS} cis-inetutils \
     --libexecdir=/usr/sbin \
@@ -27,19 +26,16 @@ ipkg_cust  ${INETUTILS} cis-inetutils \
     --disable-syslogd \
     --disable-whois \
     --disable-servers
-ipkg_cust  ${PERL} cis-perl-pass2
-ipkg_ac    ${AUTOCONF}
-ipkg_ac    ${AUTOMAKE}
 ipkg_cust  ${BZIP2} cis-bzip2
 ipkg_cust  ${DIFFUTILS} cis-diffutils
 ipkg_ac    ${FILE_PKG}
 ipkg_ac    ${GAWK} "--libexecdir=/usr/lib"
 ipkg_cust  ${FINDUTILS} cis-findutils
-ipkg_cust  ${FLEX} cis-flex
 ipkg_ac    ${GETTEXT}
+ipkg_ac ${GREP} "--bindir=/bin --without-included-regex"
 ipkg_cust  ${GROFF} cis-groff
 ipkg_cust  ${GZIP} cis-gzip
-ipkg_cust  ${IPROUTE2} cis-iproute2
+
 ipkg_cust  ${KBD} cis-kbd
 ipkg_ac    ${LESS}
 ipkg_ac    ${MAKE_PACKAGE}
index fb4f628..5c1f588 100755 (executable)
@@ -23,6 +23,7 @@ lpkg     0 ${KERNEL}
 lpkg     0 ${EGLIBC}
 lpkg     0 ${GMP}
 lpkg     0 ${MPFR}
+lpkg     0 ${MPC}
 lpkg     0 ${PPL}
 lpkg     0 ${CLOOG_PPL}
 lpkg     0 ${BINUTILS}
@@ -57,7 +58,7 @@ lpkg     1 ${UDEV}
 lpkg     1 ${XZ_UTILS}
 
 # These packages are only for stage2
-fpkg       ${PERL} http://ftp.funet.fi/pub/CPAN/src
+fpkg -e tar.gz ${PERL} http://www.cpan.org/src/5.0
 fpkg       ${MANPAGES} http://www.kernel.org/pub/linux/docs/manpages
 fpkg       ${PKG_CONFIG} http://pkgconfig.freedesktop.org/releases
 fpkg       ${IANA} http://www.sethwklein.net/projects/iana-etc/downloads
diff --git a/stage2/pkg/binutils b/stage2/pkg/binutils
new file mode 100644 (file)
index 0000000..dabcf14
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+CC="gcc -isystem /usr/include"
+LDFLAGS="-Wl,-rpath-link,/lib"
+
+CONFIGURE_OPTS="\
+    --libdir=/usr/lib \
+    --enable-shared \
+    --disable-multilib \
+    ${CONFIGURE_OPTS}"
+
+hvconfig_pre()
+{
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # Libiberty uses gcc -print-multi-os-directory to determine where to
+            # install libiberty.a. Because our temporary GCC is still
+            # multilib-aware, the command returns ../lib64 which causes the archive
+            # to be installed into /usr/lib64. The following sed will prevent this:
+            sed -i 's%\(^MULTIOSDIR = \).*%\1 ../lib%' \
+                ${LFS_TMP}/${PACKAGE}/libiberty/Makefile.in
+
+            # This adds 64 bit support to Binutils.
+           CONFIGURE_OPTS="${CONFIGURE_OPTS} --enable-64-bit-bfd"
+           ;;
+    esac
+}
+
+hvbuild()
+{
+    make configure-host
+    make tooldir=/usr
+    make tooldir=/usr install
+}
+
+hvbuild_post()
+{
+    # Install the libiberty header file that is needed by some packages:
+    cp -v ../${PACKAGE}/include/libiberty.h /usr/include
+}
diff --git a/stage2/pkg/bison b/stage2/pkg/bison
new file mode 100644 (file)
index 0000000..1b66183
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+hvconfig_post()
+{
+    # The configure system causes bison to be built without support for
+    # internationalization of error messages if a bison program is not
+    # already in $PATH. The following addition will correct this:
+    echo '#define YYENABLE_NLS 1' >> config.h
+}
diff --git a/stage2/pkg/coreutils b/stage2/pkg/coreutils
new file mode 100644 (file)
index 0000000..b60e9e8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+CONFIGURE_OPTS="\
+    --enable-no-install-program=kill,uptime \
+    ${CONFIGURE_OPTS}"
+
+hvbuild_post()
+{
+    # Move some programs to their proper FHS locations:
+    mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
+    mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
+
+    # Now specify new path to mv to eliminate error message:
+    #   "/usr/bin/mv: No such file or directory" 
+    /bin/mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
+    /bin/mv -v /usr/bin/chroot /usr/sbin
+
+    # Some of the scripts in the LFS-Bootscripts package depend on head
+    # sleep and nice. As /usr may not be available during the early stages
+    # of booting, those binaries need to be on the root partition:
+    /bin/mv -v /usr/bin/{head,sleep,nice} /bin
+}
diff --git a/stage2/pkg/e2fsprogs b/stage2/pkg/e2fsprogs
new file mode 100644 (file)
index 0000000..99f7e68
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+PKG_CONFIG=true
+
+CONFIGURE_OPTS="\
+    --with-root-prefix="" \
+    --enable-elf-shlibs \
+    --disable-libblkid \
+    --disable-libuuid \
+    --disable-fsck \
+    --disable-uuidd \
+    ${CONFIGURE_OPTS}"
+
+hvbuild_post()
+{
+    # Install the static libraries and headers:
+    make install-libs
+
+    # Make the installed static libraries writable so debugging symbols can be removed later:
+    chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
+}
diff --git a/stage2/pkg/eglibc b/stage2/pkg/eglibc
new file mode 100644 (file)
index 0000000..a4ebe94
--- /dev/null
@@ -0,0 +1,126 @@
+#!/bin/bash
+
+hvconfig_pre()
+{
+    CFLAGS="-mtune=generic -g -O2"
+
+    CONFIGURE_OPTS="\
+        --disable-profile \
+        --enable-add-ons \
+        --enable-kernel=$(get_pkg_ver ${KERNEL}) \
+        --libexecdir=/usr/lib/eglibc \
+        ${CONFIGURE_OPTS}"
+
+    case "${HVL_TARGET}" in
+        "x86")
+            CFLAGS="-march=$(cut -d- -f1 <<< ${CLFS_TARGET}) ${CFLAGS}"
+            ;;
+    esac
+
+    # When running make install, a script called test-installation.pl performs a
+    # small sanity test on our newly installed Glibc. However, because our
+    # toolchain still points to the /tools directory, the sanity test would be
+    # carried out against the wrong Glibc. We can force the script to check the
+    # Glibc we have just installed with:
+    cd ${LFS_TMP}/${PACKAGE}
+    LINKER=$(readelf -l $(file /tools/lib/libc-* | cut -f1 -d:) | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
+    sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=${LINKER} -o|" \
+        scripts/test-installation.pl
+    unset LINKER
+
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # Tell EGLIBC to install its libraries into /lib:
+            echo "slibdir=/lib" >> configparms
+            CONFIGURE_OPTS="${CONFIGURE_OPTS} --libdir=/usr/lib"
+           ;;
+    esac
+}
+
+hvbuild()
+{
+    make
+    touch /etc/ld.so.conf
+
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # The install will finish by checking that everything is correctly
+            # installed. Unfortunately, it will test for a multilib installation.
+            # On x86_64 Pure64 this means it will try to test the non-existent
+            # 32-bit loader which has a different name from the 64-bit loader
+            # (unlike on other 64-bit architectures). We fool it by creating a
+            # symlink to the real loader.
+            EGLIBC_VER_BASE=$(echo ${PACKAGE} | sed "s!eglibc-\([^-]*\)-.*!\1!g")
+            ln -svfT ld-${EGLIBC_VER_BASE}.so /lib/ld-linux.so.2
+            make install
+
+            # Now we can remove this symlink.
+            rm -v /lib/ld-linux.so.2
+
+            # We also need to correct the /usr/bin/ldd script - if you look at this,
+            # you will see it references not only the 32-bit linker, but also /lib64
+            # where it thinks the 64-bit linker is.
+            cp -v /usr/bin/ldd{,.bak}
+            sed '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd.bak >/usr/bin/ldd
+            rm -v /usr/bin/ldd.bak
+           ;;
+        *)
+            make install
+           ;;
+    esac
+
+    # The following instructions, instead of the install-locales target
+    # above, will install the minimum set of locales necessary for the
+    # tests to run successfully:
+    mkdir -pv /usr/lib/locale
+    localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
+    localedef -i de_DE -f ISO-8859-1 de_DE
+    localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
+    localedef -i de_DE -f UTF-8 de_DE.UTF-8
+    localedef -i en_HK -f ISO-8859-1 en_HK
+    localedef -i en_PH -f ISO-8859-1 en_PH
+    localedef -i en_US -f ISO-8859-1 en_US
+    localedef -i en_US -f UTF-8 en_US.UTF-8
+    localedef -i es_MX -f ISO-8859-1 es_MX
+    localedef -i fa_IR -f UTF-8 fa_IR
+    localedef -i fr_FR -f ISO-8859-1 fr_FR
+    localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
+    localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
+    localedef -i it_IT -f ISO-8859-1 it_IT
+    localedef -i ja_JP -f EUC-JP ja_JP
+    localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
+    localedef -i zh_CN -f GB18030 zh_CN.GB18030
+
+    # French canadian locales:
+    localedef -i ca_FR -f UTF-8 ca_FR.UTF-8
+    localedef -i ca_FR -f ISO-8859-1 ca_FR
+    localedef -i fr_CA -f UTF-8 fr_CA.UTF-8
+    localedef -i fr_CA -f ISO-8859-1 fr_CA
+
+    cat > /etc/nsswitch.conf << "EOF"
+# /etc/nsswitch.conf
+
+passwd: files
+group: files
+shadow: files
+
+hosts: files dns
+networks: files
+
+protocols: files
+services: files
+ethers: files
+rpc: files
+EOF
+
+    ln -svfT ${TIMEZONE} /usr/share/zoneinfo/localtime
+    cp --remove-destination /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
+
+    cat > /etc/ld.so.conf << "EOF"
+# /etc/ld.so.conf
+/usr/local/lib
+/opt/lib
+EOF
+}
diff --git a/stage2/pkg/flex b/stage2/pkg/flex
new file mode 100644 (file)
index 0000000..e0c56de
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+hvbuild_post()
+{
+    ln -sfv libfl.a /usr/lib/libl.a
+
+    # Create a bash script called lex that calls flex and have it emulate lex.
+    cat > /usr/bin/lex << "EOF"
+#!/bin/sh
+# /usr/bin/lex
+
+exec /usr/bin/flex -l "$@"
+EOF
+    chmod -v 755 /usr/bin/lex
+}
diff --git a/stage2/pkg/gcc b/stage2/pkg/gcc
new file mode 100644 (file)
index 0000000..c73c30d
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+CC="gcc -Wl,-rpath-link,/lib -isystem /usr/include"
+CXX="g++ -Wl,-rpath-link,/lib -isystem /usr/include"
+
+CONFIGURE_OPTS="\
+    --libexecdir=/usr/lib \
+    --enable-shared \
+    --enable-threads=posix \
+    --enable-__cxa_atexit \
+    --enable-c99 \
+    --enable-long-long \
+    --enable-clocale=gnu \
+    --enable-languages=c,c++ \
+    --disable-multilib \
+    --disable-libstdcxx-pch \
+    ${CONFIGURE_OPTS}"
+
+hvpatch()
+{
+    # Manually applying patches if specified
+    if [ -n "${GCC_PATCHES}" ]; then
+        for p in ${GCC_PATCHES}; do
+            apply_patch ${PACKAGE}-${p}.patch ${PACKAGE}
+        done
+    fi
+
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # Apply the following patch so that GCC links to /lib instead of /lib64:
+            apply_patch ${PACKAGE}-pure64-2.patch ${PACKAGE}
+           ;;
+    esac
+}
+
+hvconfig_pre()
+{
+    # Applying a sed substitution that will suppress the installation of
+    # libiberty.a. We want to use the Binutils version of libiberty.a
+    sed -i 's/install_to_$(INSTALL_DEST) //' ${LFS_TMP}/${PACKAGE}/libiberty/Makefile.in
+}
+
+hvbuild_post()
+{
+    ln -svf ../usr/bin/cpp /lib
+    ln -svf gcc /usr/bin/cc
+}
diff --git a/stage2/pkg/iproute2 b/stage2/pkg/iproute2
new file mode 100644 (file)
index 0000000..855c1f7
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvbuild()
+{
+    # The arpd binary included in this package is dependent on Berkeley DB.
+    # Because arpd is not a very common requirement on a base Linux system,
+    # remove the dependency on Berkeley DB by applying the sed command below
+    sed -i '/^TARGETS/s@arpd@@g' ${LFS_TMP}/${PACKAGE}/misc/Makefile
+
+    make DESTDIR= DOCDIR=/usr/share/doc/iproute2 \
+        MANDIR=/usr/share/man
+
+    make DESTDIR= DOCDIR=/usr/share/doc/iproute2 \
+        MANDIR=/usr/share/man install
+}
diff --git a/stage2/pkg/linux b/stage2/pkg/linux
new file mode 100644 (file)
index 0000000..71e7574
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvbuild()
+{
+    # The kernel sources were already copied into /usr/src in stage0
+    cd /usr/src/${PACKAGE}
+    make mrproper
+    make headers_check
+
+    # Remove any previous headers install
+    rm -rf dest
+    make INSTALL_HDR_PATH=dest headers_install
+    cp -rv dest/include/* /usr/include
+    find /usr/include -name .install -or -name ..install.cmd | xargs rm -fv
+    rm -rf dest
+
+    # Install HV kernel compilation script:
+    VERSION=$(get_pkg_ver ${PACKAGE})
+    SCRIPT=/usr/src/compile-kernel
+
+    echo "#!/bin/bash" > ${SCRIPT}
+    echo "set -o errexit" >> ${SCRIPT}
+    echo "KERNEL_VERSION=${VERSION}" >> ${SCRIPT}
+    echo "KERNEL_NAME=clfs-\${KERNEL_VERSION}" >> ${SCRIPT}
+    echo "DEST=/boot" >> ${SCRIPT}
+    echo "ARCH=${HVL_TARGET}" >> ${SCRIPT}
+    echo "unset CROSS_COMPILE" >> ${SCRIPT}
+    echo "" >> ${SCRIPT}
+    echo "make" >> ${SCRIPT}
+    echo "make modules" >> ${SCRIPT}
+    echo "make modules_install" >> ${SCRIPT}
+    echo "cp -v arch/${HVL_TARGET}/boot/bzImage \${DEST}/vmlinuz-\${KERNEL_NAME}" >> ${SCRIPT}
+    echo "cp -v System.map \${DEST}/System.map-\${KERNEL_NAME}" >> ${SCRIPT}
+    echo "cp -v .config \${DEST}/config-\${KERNEL_NAME}" >> ${SCRIPT}
+
+    chmod -v u+x ${SCRIPT}
+}
diff --git a/stage2/pkg/man-pages b/stage2/pkg/man-pages
new file mode 100644 (file)
index 0000000..823d701
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvbuild()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+    make install
+}
diff --git a/stage2/pkg/ncurses b/stage2/pkg/ncurses
new file mode 100644 (file)
index 0000000..69433cf
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+CONFIGURE_OPTS="\
+    --libdir=/lib \
+    --with-shared \
+    --without-debug \
+    --enable-widec \
+    --with-manpage-format=normal \
+    ${CONFIGURE_OPTS}"
+
+hvbuild_post()
+{
+    # Move the Ncurses static libraries to the proper location:
+    mv -v /lib/lib{panelw,menuw,formw,ncursesw,ncurses++w}.a /usr/lib
+
+    # Create symlinks in /usr/lib:
+    rm -v /lib/lib{ncursesw,menuw,panelw,formw}.so
+    ln -svfT ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
+    ln -svfT ../../lib/libmenuw.so.5 /usr/lib/libmenuw.so
+    ln -svfT ../../lib/libpanelw.so.5 /usr/lib/libpanelw.so
+    ln -svfT ../../lib/libformw.so.5 /usr/lib/libformw.so
+    
+    # Make our Ncurses compatible for older and non-widec compatible programs can build properly.
+    # Many applications still expect the linker to be able to find
+    # non-wide-character Ncurses libraries. Trick such applications
+    # into linking with wide-character libraries by means of symlinks
+    # and linker scripts:
+    for lib in curses ncurses form panel menu ; do
+        rm -vf /usr/lib/lib${lib}.so
+        echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
+        ln -sfvT lib${lib}w.a /usr/lib/lib${lib}.a
+    done
+    ln -sfvT libncursesw.so /usr/lib/libcursesw.so
+    ln -sfvT libncursesw.a /usr/lib/libcursesw.a
+    ln -sfvT libncurses++w.a /usr/lib/libncurses++.a
+    ln -sfvT ncursesw5-config /usr/bin/ncurses5-config
+
+    # Create a symlink for /usr/share/terminfo in /usr/lib for compatibility:
+    ln -sfvT ../share/terminfo /usr/lib/terminfo
+}
diff --git a/stage2/pkg/perl b/stage2/pkg/perl
new file mode 100644 (file)
index 0000000..b689a73
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+hvconfig_pre()
+{
+    # Change a hardcoded path from /usr/include to /tools/include:
+    sed -i 's@/usr/include@/tools/include@g' ${LFS_TMP}/${PACKAGE}/ext/Errno/Errno_pm.PL
+}
+
+hvconfig()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    ./configure.gnu \
+        --prefix=/tools \
+        -Dcc="gcc"
+}
+
+hvbuild_post()
+{
+    ln -svfT /tools/bin/perl /usr/bin/perl
+}
diff --git a/stage2/pkg/pkg-config b/stage2/pkg/pkg-config
new file mode 100644 (file)
index 0000000..15d34e6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+hvbuild_post()
+{
+    var_add_path "PKG_CONFIG_PATH" /etc/profile "/usr/local/lib/pkgconfig"
+    var_export   "PKG_CONFIG_PATH" /etc/profile
+}
diff --git a/stage2/pkg/procps b/stage2/pkg/procps
new file mode 100644 (file)
index 0000000..fcd1afc
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+hvconfig_pre()
+{
+    # The following fixes an issue with Make 3.82:
+    sed -i -r '/^-include/s/\*(.*)/proc\1 ps\1/' ${LFS_TMP}/${PACKAGE}/Makefile
+}
diff --git a/stage2/pkg/readline b/stage2/pkg/readline
new file mode 100644 (file)
index 0000000..9097481
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+CONFIGURE_OPTS="\
+    --libdir=/lib
+    ${CONFIGURE_OPTS}"
+
+hvconfig_pre()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    # Reinstalling Readline will cause the old libraries to be moved to
+    # <libraryname>.old. While this is normally not a problem, in some
+    # cases it can trigger a linking bug in ldconfig. This can be
+    # avoided by issuing the following two seds:
+    sed -i '/MV.*old/d' Makefile.in
+    sed -i '/{OLDSUFF}/c:' support/shlib-install
+}
+
+hvbuild()
+{
+    # SHLIB_LIBS=-lncurses: Forces Readline to link against the libncurses library.
+    make SHLIB_LIBS=-lncurses
+    make install
+}
+
+hvbuild_post()
+{
+    # Now move the static libraries to a more appropriate location:
+    mv -v /lib/lib{readline,history}.a /usr/lib
+
+    # Next, remove the .so files in /lib and relink them into /usr/lib:
+    rm -v /lib/lib{readline,history}.so
+    ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
+    ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
+}
diff --git a/stage2/pkg/util-linux-ng b/stage2/pkg/util-linux-ng
new file mode 100644 (file)
index 0000000..e46e5c3
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+hvconfig_pre()
+{
+    # The FHS recommends that we use /var/lib/hwclock, instead of the usual
+    # /etc, as the location for the adjtime file. To make the hwclock program
+    # FHS-compliant, run the following:
+    sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' -i $(grep -rl '/etc/adjtime' .)
+    mkdir -pv /var/lib/hwclock
+}
+
+hvconfig()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    ./configure \
+        --enable-arch \
+        --enable-partx \
+        --enable-write \
+        --disable-wall
+}
+
+hvbuild_post()
+{
+    # Move the logger  binary to /bin as it is needed by the CLFS-Bootscripts package:
+    mv -v /usr/bin/logger /bin
+}
diff --git a/stage2/pkg/zlib b/stage2/pkg/zlib
new file mode 100644 (file)
index 0000000..0106d36
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+CC="gcc -isystem /usr/include"
+CXX="g++ -isystem /usr/include"
+LDFLAGS="-Wl,-rpath-link,/lib"
+
+CONFIGURE_OPTS="\
+    --shared \
+    ${CONFIGURE_OPTS}"
+
+hvconfig()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+    ./configure ${CONFIGURE_OPTS}
+}
+
+hvbuild_post()
+{
+    # The previous command installed two .so files into /usr/lib.
+    # We will move it into /lib and then relink it to /usr/lib:
+    mv -v /usr/lib/libz.so.* /lib
+    ln -svf ../../lib/libz.so.1 /usr/lib/libz.so
+
+    # Fix the permissions on the static library: 
+    chmod 644 /usr/lib/libz.a
+}
index f27c556..869ab96 100755 (executable)
@@ -23,68 +23,54 @@ init_log_file
 # Scripts directory
 export SCRDIR=$(pwd)
 
-ipkg       ${PERL} cis-perl-pass1 "${PERL}-pass1"
-ipkg_cust  ${KERNEL} cis-kernel
-ipkg_cust  ${MANPAGES} cis-man-pages
-ipkg_cust  ${EGLIBC} cis-eglibc
+PERL_PASS1="1" ipkg ${PERL} cis-ac "${PERL}-pass1"
+ipkg_ac    ${KERNEL}
+ipkg_ac    ${MANPAGES}
+ipkg_ac    ${EGLIBC}
 rscr once  "Adjusting toolchain" cis-toolchain-adjust
 rscr mult  "Testing toolchain"   cis-toolchain-test
 
 CPPFLAGS=-fexceptions CC="gcc -isystem /usr/include" \
     CXX="g++ -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_ac   ${GMP}  "--enable-cxx --enable-mpbsd"
+    ipkg_ac ${GMP} "--enable-cxx --enable-mpbsd"
 
 CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_ac   ${MPFR} "--enable-shared --with-gmp=/usr"
+    ipkg_ac ${MPFR} "--enable-shared --with-gmp=/usr"
+
+CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \
+    ipkg_ac ${MPC}
 
 CPPFLAGS=-fexceptions CC="gcc -isystem /usr/include" \
     CXX="g++ -isystem /usr/include" \
     LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_ac   ${PPL}  "--enable-shared --disable-optimization"
+    ipkg_ac ${PPL} "--enable-shared --disable-optimization"
 
 CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_ac   ${CLOOG_PPL} "--enable-shared --with-gmp --with-ppl"
-
-CC="gcc -isystem /usr/include" CXX="g++ -isystem /usr/include" \
-    LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_cust  ${ZLIB} cis-zlib "--shared"
-
-CC="gcc -isystem /usr/include" \
-    LDFLAGS="-Wl,-rpath-link,/lib" \
-    ipkg_cust  ${BINUTILS} cis-binutils \
-    --libdir=/usr/lib \
-    --enable-shared \
-    --disable-multilib
-
-CC="gcc -Wl,-rpath-link,/lib -isystem /usr/include" \
-    CXX="g++ -Wl,-rpath-link,/lib -isystem /usr/include" \
-    ipkg_cust  ${GCC} cis-gcc \
-    --libexecdir=/usr/lib \
-    --enable-shared \
-    --enable-threads=posix \
-    --enable-__cxa_atexit \
-    --enable-c99 \
-    --enable-long-long \
-    --enable-clocale=gnu \
-    --enable-languages=c,c++ \
-    --disable-multilib \
-    --disable-libstdcxx-pch
+    ipkg_ac ${CLOOG_PPL} "--enable-shared --with-gmp --with-ppl"
 
+ipkg_ac ${ZLIB}
+ipkg_ac ${BINUTILS}
+ipkg_ac ${GCC}
 rscr mult  "Testing toolchain" cis-toolchain-test
 
-ipkg_ac    ${SED} "--bindir=/bin"
-ipkg_cust  ${PKG_CONFIG} cis-pkg-config
-ipkg_cust  ${NCURSES} cis-ncurses
-ipkg_cust  ${UTIL_LINUX_NG} cis-util-linux-ng
-ipkg_cust  ${E2FSPROGS} cis-e2fsprogs
-ipkg_cust  ${COREUTILS} cis-coreutils
-ipkg_cust  ${IANA} cis-iana
-ipkg_ac    ${MFOUR}
-ipkg_cust  ${BISON} cis-bison
-ipkg_cust  ${PROCPS} cis-procps
-ipkg_ac    ${GREP} "--bindir=/bin --without-included-regex"
-ipkg_cust  ${READLINE} cis-readline
-ipkg_ac    ${BASH} "--bindir=/bin --without-bash-malloc --with-installed-readline"
+ipkg_ac ${SED} "--bindir=/bin"
+ipkg_ac ${PKG_CONFIG}
+ipkg_ac ${NCURSES}
+ipkg_ac ${UTIL_LINUX_NG}
+ipkg_ac ${E2FSPROGS}
+ipkg_ac ${COREUTILS}
+HV_NO_CONFIGURE_SCRIPT=1 ipkg_ac ${IANA}
+ipkg_ac ${MFOUR}
+ipkg_ac ${BISON}
+ipkg_ac ${PROCPS}
+ipkg_ac ${LIBTOOL}
+ipkg_ac ${FLEX}
+ipkg_ac ${IPROUTE2}
+PERL_PASS2="1" ipkg ${PERL} cis-ac "${PERL}-pass2"
+ipkg_ac ${READLINE}
+ipkg_ac ${AUTOCONF}
+ipkg_ac ${AUTOMAKE}
+ipkg_ac ${BASH} "--bindir=/bin --without-bash-malloc --with-installed-readline"
 
 /bin/bash +h -c ./install-2