-Now using a single file for all custom definitions and functions for each package.
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Wed, 3 Nov 2010 05:56:27 +0000 (05:56 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Wed, 3 Nov 2010 05:56:27 +0000 (05:56 +0000)
 Stage 1 and 2 build ok, and we can boot ok also.

70 files changed:
functions
stage0/cis-ac
stage0/cis-binutils [deleted file]
stage0/cis-cloog-ppl [deleted file]
stage0/cis-eglibc [deleted file]
stage0/cis-gcc-common [deleted file]
stage0/cis-gcc-pass1 [deleted file]
stage0/cis-gcc-pass2 [deleted file]
stage0/cis-linux-api-headers [deleted file]
stage0/cis-ncurses [deleted file]
stage0/cis-uclibc [deleted file]
stage0/install-1
stage0/pkg/binutils [new file with mode: 0644]
stage0/pkg/cloog-ppl [new file with mode: 0644]
stage0/pkg/eglibc [new file with mode: 0644]
stage0/pkg/gcc [new file with mode: 0644]
stage0/pkg/linux [new file with mode: 0644]
stage0/pkg/ncurses [new file with mode: 0644]
stage0/pkg/uclibc [new file with mode: 0644]
stage1/build.bash [deleted file]
stage1/build.binutils [deleted file]
stage1/build.ppl [deleted file]
stage1/build.texinfo [deleted file]
stage1/cis-ac
stage1/cis-ac-nobuild [deleted file]
stage1/cis-bzip2 [deleted file]
stage1/cis-common [deleted file]
stage1/cis-e2fsprogs [deleted file]
stage1/cis-gcc [deleted file]
stage1/cis-gettext [deleted file]
stage1/cis-module-init-tools [deleted file]
stage1/cis-ppl [deleted file]
stage1/cis-sysvinit [deleted file]
stage1/cis-udev [deleted file]
stage1/cis-util-linux-ng [deleted file]
stage1/cis-zlib [deleted file]
stage1/config.cache.bash [deleted file]
stage1/config.cache.coreutils [deleted file]
stage1/config.cache.findutils [deleted file]
stage1/config.cache.flex [deleted file]
stage1/config.cache.gettext [deleted file]
stage1/config.cache.grep [deleted file]
stage1/config.cache.m4 [deleted file]
stage1/config.cache.tar [deleted file]
stage1/configure.pre.binutils [deleted file]
stage1/configure.pre.cloog-ppl [deleted file]
stage1/configure.pre.coreutils [deleted file]
stage1/configure.pre.flex [deleted file]
stage1/configure.pre.m4 [deleted file]
stage1/install-1
stage1/pkg/bash [new file with mode: 0644]
stage1/pkg/binutils [new file with mode: 0644]
stage1/pkg/bzip2 [new file with mode: 0644]
stage1/pkg/cloog-ppl [new file with mode: 0644]
stage1/pkg/coreutils [new file with mode: 0644]
stage1/pkg/e2fsprogs [new file with mode: 0644]
stage1/pkg/findutils [new file with mode: 0644]
stage1/pkg/flex [new file with mode: 0644]
stage1/pkg/gcc [new file with mode: 0644]
stage1/pkg/gettext [new file with mode: 0644]
stage1/pkg/grep [new file with mode: 0644]
stage1/pkg/m4 [new file with mode: 0644]
stage1/pkg/module-init-tools [new file with mode: 0644]
stage1/pkg/ppl [new file with mode: 0644]
stage1/pkg/sysvinit [new file with mode: 0644]
stage1/pkg/tar [new file with mode: 0644]
stage1/pkg/texinfo [new file with mode: 0644]
stage1/pkg/udev [new file with mode: 0644]
stage1/pkg/util-linux-ng [new file with mode: 0644]
stage1/pkg/zlib [new file with mode: 0644]

index 9a6496f..53747fd 100644 (file)
--- a/functions
+++ b/functions
@@ -130,8 +130,10 @@ get_pkg_name()
        return 1
     fi
 
-    # \1 matches anything followed by a dash and a number
-    echo ${1} | sed "s!^\(.*\)-[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.
@@ -726,12 +728,6 @@ ipkg()
        exit ${EXIT_FAILURE}
     fi
 
-    # Checking if there is a corresponding config.cache file
-    local cache_file=$(pwd)/config.cache.$(get_pkg_name ${PACKAGE_NAME})
-    if [ -f ${cache_file} ]; then
-        CONFIGURE_OPTS="${CONFIGURE_OPTS} --cache-file=${cache_file}"
-    fi
-
     PACKAGE_LOG=${LFS_LOG_DIR}/${LABEL}.log
 
     # Checking if package was previously successfully installed
index 4f32036..e6e6803 100755 (executable)
@@ -9,18 +9,75 @@ shift
 CONFIGURE_OPTS=${*}
 
 # Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/cross-tools \
-    ${CONFIGURE_OPTS}
-${HVMAKE}
-${HVMAKE} install
+source ${SCRDIR}/../sysinfos
+source ${SCRDIR}/../functions
+source ${SCRDIR}/../packages-list
+
+DEFAULT_CONFIGURE_PREFIX=/cross-tools
+
+# Default configure function
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    FINAL_CFG_OPTS="\
+      --prefix=${DEFAULT_CONFIGURE_PREFIX} \
+      ${CONFIGURE_OPTS}"
+
+    echo "Running configure with options:"
+    echo "  <${FINAL_CFG_OPTS}>"
+
+    ../${PACKAGE}/configure ${FINAL_CFG_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 config_cache ; then
+    echo "Running configure cache script"
+    config_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
+    echo "Running configure pre-script"
+    configure_pre
+fi
+
+if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then
+    echo "Not calling configure because ${PACKAGE} has no configure script"
+else
+    hvconfigure
+fi
+
+# Execute post-configure function if applicable
+if function_exists configure_post ; then
+    echo "Running configure post-script"
+    configure_post
+fi
+
+hvbuild
 
 exit $?
diff --git a/stage0/cis-binutils b/stage0/cis-binutils
deleted file mode 100755 (executable)
index 336b1ac..0000000
+++ /dev/null
@@ -1,57 +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}
-
-case "${HVL_TARGET}" in
-    "x86_64")
-        # This adds 64 bit support to Binutils.
-       TARGET_CONFIGURE_OPTS="--enable-64-bit-bfd"
-       ;;
-esac
-
-# --prefix=/cross-tools
-#     This tells the configure script to prepare to install the package in the
-#     /cross-tools directory.
-# --host=${CLFS_HOST}
-#     When used with --target, this creates a cross-architecture executable
-#     that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
-# --target=${CLFS_TARGET}
-#     When used with --host, this creates a cross-architecture executable that
-#     creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
-# --with-lib-path=/tools/lib
-#     This tells the configure script to specify the library search path during
-#     the compilation of Binutils, resulting in /tools/lib being passed to the
-#     linker. This prevents the linker from searching through library
-#     directories on the host.
-# --disable-nls
-#     This disables internationalization as i18n is not needed for the
-#     cross-compile tools.
-# --enable-shared
-#     Enable the creation of the shared libraries.
-# --disable-multilib
-#     This option disables the building of a multilib capable Binutils.
-
-cd ${LFS_TMP}/${1}-build
-AR=ar AS=as ../${1}/configure \
-    --prefix=/cross-tools \
-    --host=${CLFS_HOST} \
-    --target=${CLFS_TARGET} \
-    --with-sysroot=${CLFS} \
-    --with-lib-path=/tools/lib \
-    --disable-nls \
-    --enable-shared \
-    --disable-multilib \
-    ${TARGET_CONFIGURE_OPTS}
-${HVMAKE} configure-host
-${HVMAKE}
-${HVMAKE} install
-cp -v ../${1}/include/libiberty.h /tools/include
-
-exit $?
diff --git a/stage0/cis-cloog-ppl b/stage0/cis-cloog-ppl
deleted file mode 100755 (executable)
index e4bad6d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-# 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
-
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/cross-tools \
-    ${CONFIGURE_OPTS}
-${HVMAKE}
-${HVMAKE} install
-
-exit $?
diff --git a/stage0/cis-eglibc b/stage0/cis-eglibc
deleted file mode 100755 (executable)
index 0591177..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-case "${HVL_TARGET}" in
-    "x86" | "x86_64")
-        # Manually apply patch
-        #apply_patch ${1}-rpath.patch ${1}
-        ;;
-esac
-
-case "${HVL_TARGET}" in
-    "x86")
-        TMP_CFLAGS="-march=$(cut -d- -f1 <<< ${CLFS_TARGET}) -mtune=native -g -O2"
-        ;;
-    "x86_64")
-        TMP_CFLAGS="-mtune=native -g -O2"
-        ;;
-esac
-
-cd ${LFS_TMP}/${1}
-
-decompress_package ${EGLIBC_PORTS} $(pwd) 1> /dev/null
-
-# Disable linking to libgcc_eh:
-sed -e 's/-lgcc_eh//g' -i Makeconfig
-
-cd ${LFS_TMP}/${1}-build
-
-# The following lines need to be added to config.cache for Glibc to support NPTL:
-cat > config.cache << "EOF"
-libc_cv_forced_unwind=yes
-libc_cv_c_cleanup=yes
-libc_cv_gnu89_inline=yes
-libc_cv_ssp=no
-EOF
-
-# Configure options:
-# BUILD_CC="gcc"
-#     This sets Glibc to use the current compiler on our system. This is used to
-#     create the tools Glibc uses during its build.
-# CC="${CLFS_TARGET}-gcc ${CLFS_BUILDFLAGS}"
-#     Forces Glibc to build using our target architecture GCC utilizing any
-#     special CLFS build flags.
-# AR="${CLFS_TARGET}-ar"
-#     This forces Glibc to use the ar utility we made for our target
-#     architecture.
-# RANLIB="${CLFS_TARGET}-ranlib"
-#     This forces Glibc to use the ranlib utility we made for our target
-#     architecture.
-#
-# --disable-profile
-#     This builds the libraries without profiling information.
-# --enable-add-ons
-#     This tells Glibc to utilize all add-ons that are available.
-# --with-tls
-#     This tells Glibc to use Thread Local Storage.
-# --enable-kernel=2.x.x
-#     Compile the library for support of linux 2.6.x kernels.
-#     The kernel version specified must not be newer than the
-#     version of the kernel running on the build machine.
-# --with-headers=/tools/include
-#     Forces glibc to use the linux-libc-headers installed
-#     in /tools/include, rather than those on the host, which
-#     may be too old to support needed functionality.
-# --with-__thread
-#     This tells Glibc to use use the __thread for libc and libpthread builds.
-# --with-binutils=/cross-tools/bin
-#     This tells Glibc to use the Binutils that are specific to our target
-#     architecture.
-# --disable-profile
-#     Builds the libraries without profiling information.
-BUILD_CC="gcc" \
-    CC="${CLFS_TARGET}-gcc ${CLFS_BUILDFLAGS}" \
-    AR="${CLFS_TARGET}-ar" \
-    RANLIB="${CLFS_TARGET}-ranlib" \
-    CFLAGS=${TMP_CFLAGS} \
-    ../${1}/configure \
-    --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 \
-    --cache-file=config.cache
-${HVMAKE}
-${HVMAKE} install
-
-exit $?
diff --git a/stage0/cis-gcc-common b/stage0/cis-gcc-common
deleted file mode 100755 (executable)
index 0e870b2..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-# Manually applying patches if specified
-if [ -n "${GCC_PATCHES}" ]; then
-    for p in ${GCC_PATCHES}; do
-        apply_patch ${1}-${p}.patch ${1}
-    done
-fi
-
-case "${HVL_TARGET}" in
-    *)
-        TARGET_CONFIGURE_OPTS="--with-ppl=/cross-tools \
-            --with-cloog=/cross-tools \
-            --disable-multilib"
-        ;;
-esac
-
-case "${HVL_TARGET}" in
-    "x86")
-        apply_patch ${1}-specs-1.patch ${1}
-        ;;
-    "x86_64")
-        apply_patch ${1}-pure64_specs-1.patch ${1}
-       ;;
-esac
-
-cd ${LFS_TMP}/${1}
-
-# Change the StartFile Spec to point to the correct library location:
-echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h
-echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
-echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
-
-# Alter gcc's C preprocessor's default include search path to use /tools only:
-cp -v gcc/Makefile.in{,.orig}
-sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
-    gcc/Makefile.in.orig > gcc/Makefile.in
diff --git a/stage0/cis-gcc-pass1 b/stage0/cis-gcc-pass1
deleted file mode 100755 (executable)
index 961f61e..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
-
-source ./cis-gcc-common
-
-# We will create a dummy limits.h so the build will not use the one provided by the host distro:
-touch /tools/include/limits.h
-
-# Configure options:
-# --with-local-prefix=/tools
-#     Remove /usr/local/include from gcc's include search path. This is not
-#     absolutely essential, however, it helps to minimize the influence of the
-#     host system.
-# --disable-shared
-#     Disables the creation of the shared libraries.
-# --disable-threads
-#     Prevents GCC from looking for the multi-thread include files, since they
-#     haven't been created for this architecture yet. GCC will be able to find
-#     the multi-thread information after the libc headers are created.
-# --enable-languages=c
-#     This option ensures that only the C compiler is built.
-cd ${LFS_TMP}/${1}-build
-AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
-    ../${1}/configure \
-    --prefix=/cross-tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_HOST} \
-    --target=${CLFS_TARGET} \
-    --with-sysroot=${CLFS} \
-    --with-local-prefix=/tools \
-    --disable-nls \
-    --disable-shared \
-    --with-mpfr=/cross-tools \
-    --with-gmp=/cross-tools \
-    --without-headers \
-    --with-newlib \
-    --disable-decimal-float \
-    --disable-libgomp \
-    --disable-libmudflap \
-    --disable-libssp \
-    --disable-threads \
-    --enable-languages=c \
-    ${TARGET_CONFIGURE_OPTS}
-${HVMAKE} all-gcc all-target-libgcc
-${HVMAKE} install-gcc install-target-libgcc
-
-exit $?
diff --git a/stage0/cis-gcc-pass2 b/stage0/cis-gcc-pass2
deleted file mode 100755 (executable)
index 2dea487..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-source ./cis-gcc-common
-
-# Configure options:
-# --enable-__cxa_atexit
-#     This option allows use of __cxa_atexit, rather than atexit, to register
-#     C++ destructors for local
-#     statics and global objects and is essential for fully standards-compliant
-#     handling of destructors. It also affects the C++ ABI and therefore results
-#     in C++ shared libraries and C++ programs that are interoperable with other
-#     Linux distributions.
-# --enable-c99
-#     Enable C99 support for C programs.
-# --enable-long-long
-#     Enables long long support in the compiler.
-# --enable-threads=posix
-#     This enables C++ exception handling for multi-threaded code.
-# --enable-languages=c,c++
-#     This option ensures that only the C and C++ compilers are built.
-cd ${LFS_TMP}/${1}-build
-AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
-    ../${1}/configure \
-    --prefix=/cross-tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_HOST} \
-    --target=${CLFS_TARGET} \
-    --with-sysroot=${CLFS} \
-    --with-local-prefix=/tools \
-    --disable-nls \
-    --enable-shared \
-    --enable-languages=c,c++ \
-    --enable-__cxa_atexit \
-    --with-mpfr=/cross-tools \
-    --with-gmp=/cross-tools \
-    --enable-c99 \
-    --enable-long-long \
-    --enable-threads=posix \
-    ${TARGET_CONFIGURE_OPTS}
-${HVMAKE} \
-    AS_FOR_TARGET="${CLFS_TARGET}-as" \
-    LD_FOR_TARGET="${CLFS_TARGET}-ld"
-${HVMAKE} install
-
-exit $?
diff --git a/stage0/cis-linux-api-headers b/stage0/cis-linux-api-headers
deleted file mode 100755 (executable)
index e51344a..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}
-
-cd ${LFS_TMP}/${1}
-
-${HVMAKE} mrproper
-${HVMAKE} ARCH=${CLFS_ARCH} headers_check
-${HVMAKE} ARCH=${CLFS_ARCH} INSTALL_HDR_PATH=dest headers_install
-install -dv /tools/include
-cp -rv dest/include/* /tools/include
-
-exit $?
diff --git a/stage0/cis-ncurses b/stage0/cis-ncurses
deleted file mode 100755 (executable)
index 1e100f7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-../${PACKAGE}/configure \
-    --prefix=/cross-tools \
-    ${CONFIGURE_OPTS}
-
-# Only one binary is needed for the Cross-Tools.
-${HVMAKE} -C include
-${HVMAKE} -C progs tic
-
-# Install tic
-install -m755 progs/tic /cross-tools/bin
-
-exit $?
diff --git a/stage0/cis-uclibc b/stage0/cis-uclibc
deleted file mode 100755 (executable)
index e1b6d73..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Manually apply patch
-apply_patch ${1}-branch_update-1.patch ${1}
-
-case "${HVL_TARGET}" in
-    arm926t)
-        apply_patch ${1}-config-arm926t.patch ${1}
-        ;;
-esac
-
-cd ${LFS_TMP}/${1}
-
-sed -e "s@\(^CROSS_COMPILER_PREFIX=\).*@\1\"${CLFS_TARGET}-\"@" \
-    -e "s@\(^KERNEL_HEADERS=\).*@\1\"/tools/include\"@" \
-    -e "s@.*\(DEVEL_PREFIX=\).*@\1\"/tools/\"@" \
-    -e "s@.*\(^ARCH_${CLFS_NOT_ENDIAN}_ENDIAN\).*@# \1 is not set@g" \
-    -e "s@.*\(ARCH_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \
-    -e "s@.*\(ARCH_WANTS_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \
-    -i .config
-
-${HVMAKE} CROSS=${CLFS_TARGET}- CC="${CLFS_TARGET}-gcc ${BUILD}"
-${HVMAKE} PREFIX=${CLFS} install
-
-exit $?
index 4b7a85a..d8e60eb 100755 (executable)
@@ -16,12 +16,15 @@ export LFS_TMP="${LFS}/tmp"
 
 init_log_file
 
-ipkg_cust ${KERNEL}   cis-linux-api-headers
+# Scripts directory
+export SCRDIR=$(pwd)
+
+ipkg_ac   ${KERNEL}
 
 case "${HVL_TARGET}" in
     x86*)
         ipkg_ac   ${FILE_PKG}
-        ipkg_cust ${NCURSES} cis-ncurses "\
+        ipkg_ac   ${NCURSES} "\
             --without-debug \
             --without-shared"
         ;;
@@ -44,7 +47,7 @@ ipkg_ac   ${PPL} "\
     --disable-optimization \
     --with-libgmp-prefix=/cross-tools \
     --with-libgmpxx-prefix=/cross-tools"
-ipkg_cust ${CLOOG_PPL} cis-cloog-ppl "\
+ipkg_ac   ${CLOOG_PPL} "\
     --enable-shared \
     --with-bits=gmp \
     --with-gmp=/cross-tools \
@@ -52,9 +55,35 @@ ipkg_cust ${CLOOG_PPL} cis-cloog-ppl "\
 
 LDFLAGS=""
 
-ipkg_cust ${BINUTILS} cis-binutils
-ipkg      ${GCC} cis-gcc-pass1 "${GCC}-pass1"
-ipkg_cust ${EGLIBC} cis-eglibc
-ipkg      ${GCC} cis-gcc-pass2 "${GCC}-pass2"
+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"
 
 exit $?
diff --git a/stage0/pkg/binutils b/stage0/pkg/binutils
new file mode 100644 (file)
index 0000000..209859b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+configure_pre()
+{
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # This adds 64 bit support to Binutils.
+           CONFIGURE_OPTS="${CONFIGURE_OPTS} --enable-64-bit-bfd"
+           ;;
+    esac
+
+}
+
+hvbuild()
+{
+    ${HVMAKE} configure-host
+    ${HVMAKE}
+    ${HVMAKE} install
+    cp -v ../${PACKAGE}/include/libiberty.h /tools/include
+}
diff --git a/stage0/pkg/cloog-ppl b/stage0/pkg/cloog-ppl
new file mode 100644 (file)
index 0000000..6e06827
--- /dev/null
@@ -0,0 +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()
+{
+    sed -e "/LD_LIBRARY_PATH=/d" -i ${LFS_TMP}/${PACKAGE}/configure
+}
diff --git a/stage0/pkg/eglibc b/stage0/pkg/eglibc
new file mode 100644 (file)
index 0000000..4d98d1b
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+hvpatch()
+{
+    case "${HVL_TARGET}" in
+        "x86" | "x86_64")
+            # Manually apply patch
+            #apply_patch ${1}-rpath.patch ${1}
+            ;;
+    esac
+}
+
+# For Glibc to support NPTL:
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+libc_cv_forced_unwind=yes
+libc_cv_c_cleanup=yes
+libc_cv_gnu89_inline=yes
+libc_cv_ssp=no
+EOF
+}
+
+configure_pre()
+{
+    case "${HVL_TARGET}" in
+        "x86")
+            CFLAGS="-march=$(cut -d- -f1 <<< ${CLFS_TARGET}) -mtune=native -g -O2"
+            ;;
+        "x86_64")
+            CFLAGS="-mtune=native -g -O2"
+            ;;
+    esac
+
+    cd ${LFS_TMP}/${PACKAGE}
+
+    decompress_package ${EGLIBC_PORTS} $(pwd) 1> /dev/null
+
+    # Disable linking to libgcc_eh:
+    sed -e 's/-lgcc_eh//g' -i Makeconfig
+
+    DEFAULT_CONFIGURE_PREFIX=/tools
+}
diff --git a/stage0/pkg/gcc b/stage0/pkg/gcc
new file mode 100644 (file)
index 0000000..5746dab
--- /dev/null
@@ -0,0 +1,94 @@
+#!/bin/bash
+
+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")
+            apply_patch ${PACKAGE}-specs-1.patch ${PACKAGE}
+            ;;
+        "x86_64")
+            apply_patch ${PACKAGE}-pure64_specs-1.patch ${PACKAGE}
+           ;;
+    esac
+}
+
+configure_pre()
+{
+    # Common options for passes 1 & 2
+    CONFIGURE_OPTS="${CONFIGURE_OPTS} \
+        --build=${CLFS_HOST} \
+        --host=${CLFS_HOST} \
+        --target=${CLFS_TARGET} \
+        --with-sysroot=${CLFS} \
+        --with-local-prefix=/tools \
+        --disable-nls \
+        --with-mpfr=/cross-tools \
+        --with-gmp=/cross-tools"
+
+    if [ -n "${GCC_PASS1}" ]; then
+        CONFIGURE_OPTS="${CONFIGURE_OPTS} \
+            --disable-shared \
+            --without-headers \
+            --with-newlib \
+            --disable-decimal-float \
+            --disable-libgomp \
+            --disable-libmudflap \
+            --disable-libssp \
+            --disable-threads \
+            --enable-languages=c"
+    else
+        CONFIGURE_OPTS="${CONFIGURE_OPTS} \
+            --enable-shared \
+            --enable-languages=c,c++ \
+            --enable-__cxa_atexit \
+            --enable-c99 \
+            --enable-long-long \
+            --enable-threads=posix"
+    fi
+
+    case "${HVL_TARGET}" in
+        *)
+            CONFIGURE_OPTS="${CONFIGURE_OPTS} --with-ppl=/cross-tools \
+            --with-cloog=/cross-tools \
+            --disable-multilib"
+            ;;
+    esac
+
+    cd ${LFS_TMP}/${PACKAGE}
+
+    # Change the StartFile Spec to point to the correct library location:
+    echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h
+    echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
+    echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
+
+    # Alter gcc's C preprocessor's default include search path to use /tools
+    # only:
+    sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
+        -i gcc/Makefile.in
+
+    if [ -n "${GCC_PASS1}" ]; then
+        # We will create a dummy limits.h so the build will not use the one
+        # provided by the host distro:
+        touch /tools/include/limits.h
+    fi
+}
+
+hvbuild()
+{
+    if [ -n "${GCC_PASS1}" ]; then
+        ${HVMAKE} all-gcc all-target-libgcc
+        ${HVMAKE} install-gcc install-target-libgcc
+    else
+        ${HVMAKE} \
+            AS_FOR_TARGET="${CLFS_TARGET}-as" \
+            LD_FOR_TARGET="${CLFS_TARGET}-ld"
+        ${HVMAKE} install
+    fi
+}
diff --git a/stage0/pkg/linux b/stage0/pkg/linux
new file mode 100644 (file)
index 0000000..b5d275f
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvbuild()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    ${HVMAKE} mrproper
+    ${HVMAKE} ARCH=${CLFS_ARCH} headers_check
+    ${HVMAKE} ARCH=${CLFS_ARCH} INSTALL_HDR_PATH=dest headers_install
+    install -dv /tools/include
+    cp -rv dest/include/* /tools/include
+}
diff --git a/stage0/pkg/ncurses b/stage0/pkg/ncurses
new file mode 100644 (file)
index 0000000..18a27ae
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+hvbuid()
+{
+    # Only one binary is needed for the Cross-Tools.
+    ${HVMAKE} -C include
+    ${HVMAKE} -C progs tic
+
+    # Install tic
+    install -m755 progs/tic /cross-tools/bin
+}
diff --git a/stage0/pkg/uclibc b/stage0/pkg/uclibc
new file mode 100644 (file)
index 0000000..3fb5e22
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+hvpatch()
+{
+    # Manually apply patch
+    apply_patch ${1}-branch_update-1.patch ${PACKAGE}
+
+    case "${HVL_TARGET}" in
+        arm926t)
+            apply_patch ${PACKAGE}-config-arm926t.patch ${PACKAGE}
+            ;;
+    esac
+}
+
+hvbuild()
+{
+    cd ${LFS_TMP}/${1}
+
+    sed -e "s@\(^CROSS_COMPILER_PREFIX=\).*@\1\"${CLFS_TARGET}-\"@" \
+        -e "s@\(^KERNEL_HEADERS=\).*@\1\"/tools/include\"@" \
+        -e "s@.*\(DEVEL_PREFIX=\).*@\1\"/tools/\"@" \
+        -e "s@.*\(^ARCH_${CLFS_NOT_ENDIAN}_ENDIAN\).*@# \1 is not set@g" \
+        -e "s@.*\(ARCH_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \
+        -e "s@.*\(ARCH_WANTS_${CLFS_ENDIAN}_ENDIAN\).*@\1=y@g" \
+        -i .config
+    
+    ${HVMAKE} CROSS=${CLFS_TARGET}- CC="${CLFS_TARGET}-gcc ${BUILD}"
+    ${HVMAKE} PREFIX=${CLFS} install
+}
diff --git a/stage1/build.bash b/stage1/build.bash
deleted file mode 100644 (file)
index 520600d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-build_custom()
-{
-    ${HVMAKE}
-    ${HVMAKE} install
-
-    ln -svfT bash /tools/bin/sh
-}
diff --git a/stage1/build.binutils b/stage1/build.binutils
deleted file mode 100644 (file)
index 2c97380..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-build_custom()
-{
-    ${HVMAKE} configure-host
-    ${HVMAKE}
-    ${HVMAKE} install
-}
diff --git a/stage1/build.ppl b/stage1/build.ppl
deleted file mode 100644 (file)
index d956d1d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-build_custom()
-{
-    # When PPL is cross-compiled, it does not check whether GMP was compiled
-    # with support for exceptions, and simply assumes it was not. This
-    # assumption is incorrect, so we will fix that:
-    echo '#define PPL_GMP_SUPPORTS_EXCEPTIONS 1' >> confdefs.h
-
-    ${HVMAKE}
-    ${HVMAKE} install
-}
diff --git a/stage1/build.texinfo b/stage1/build.texinfo
deleted file mode 100644 (file)
index 7dce23f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-build_custom()
-{
-    ${HVMAKE} -C tools/gnulib/lib
-    ${HVMAKE} -C tools
-    ${HVMAKE}
-    ${HVMAKE} install
-}
index a0adcad..cf16137 100755 (executable)
@@ -9,13 +9,78 @@ shift
 CONFIGURE_OPTS=${*}
 
 # Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
+source ${SCRDIR}/../sysinfos
+source ${SCRDIR}/../functions
+source ${SCRDIR}/../packages-list
 
-# Applying patches (if any)
-apply_patches ${PACKAGE}
+DEFAULT_CONFIGURE_PREFIX=/tools
 
-${SCRDIR}/cis-common ${PACKAGE} ${CONFIGURE_OPTS}
+# Default configure function
+hvconfigure()
+{
+    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}>"
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
+        ../${PACKAGE}/configure ${FINAL_CFG_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 config_cache ; then
+    echo "Running configure cache script"
+    config_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
+    echo "Running configure pre-script"
+    configure_pre
+fi
+
+if [ -n "${HV_NO_CONFIGURE_SCRIPT}" ]; then
+    echo "Not calling configure because ${PACKAGE} has no configure script"
+else
+    hvconfigure
+fi
+
+# Execute post-configure function if applicable
+if function_exists configure_post ; then
+    echo "Running configure post-script"
+    configure_post
+fi
+
+hvbuild
 
 exit $?
diff --git a/stage1/cis-ac-nobuild b/stage1/cis-ac-nobuild
deleted file mode 100755 (executable)
index 475733b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}
-
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ./configure \
-    --prefix=/tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    ${CONFIGURE_OPTS}
-${HVMAKE}
-${HVMAKE} install
-
-exit $?
diff --git a/stage1/cis-bzip2 b/stage1/cis-bzip2
deleted file mode 100755 (executable)
index ab48063..0000000
+++ /dev/null
@@ -1,22 +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}
-
-cd ${LFS_TMP}/${1}
-
-# Bzip2's default Makefile target automatically runs the testsuite as well.
-# Disable the tests since they won't work on a multi-architecture build:
-sed -e 's@^\(all:.*\) test@\1@g' -i Makefile
-
-# This package doesn't have a configure script...
-${HVMAKE} CC="${CC} ${CLFS_BUILDFLAGS}" AR="${AR}" RANLIB="${RANLIB}"
-${HVMAKE} PREFIX=/tools install
-
-exit $?
diff --git a/stage1/cis-common b/stage1/cis-common
deleted file mode 100755 (executable)
index 3d55ae9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ${SCRDIR}/../sysinfos
-source ${SCRDIR}/../functions
-source ${SCRDIR}/../packages-list
-
-suf=$(get_pkg_name ${PACKAGE})
-for scrtype in configure.pre build; do
-    myscr=${SCRDIR}/${scrtype}.${suf}
-
-    if [ -f ${myscr} ]; then
-        source ${myscr}
-    fi
-done
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-# Execute pre-configure function if applicable
-if function_exists configure_pre ; then
-    echo "Running configure pre-script"
-    configure_pre
-fi
-
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ../${PACKAGE}/configure \
-    --prefix=/tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    ${CONFIGURE_OPTS}
-
-if function_exists build_custom ; then
-    # Execute custom build function if applicable
-    echo "Running custom build function"
-    build_custom
-else
-    # Standard build
-    ${HVMAKE}
-    ${HVMAKE} install
-fi
-
-exit $?
diff --git a/stage1/cis-e2fsprogs b/stage1/cis-e2fsprogs
deleted file mode 100755 (executable)
index 716a1c1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-CC="${CC} ${CLFS_BUILDFLAGS}" PKG_CONFIG=true \
-    ../${PACKAGE}/configure \
-    --prefix=/tools \
-    --enable-elf-shlibs \
-    --with-linker=${LD} \
-    --host=${CLFS_TARGET} \
-    --disable-libblkid \
-    --disable-libuuid \
-    --disable-fsck \
-    --disable-uuidd
-${HVMAKE} LIBUUID="-luuid" STATIC_LIBUUID="-luuid" \
-    LIBBLKID="-lblkid" STATIC_LIBBLKID="-lblkid"
-${HVMAKE} install
-# Install the static libraries and headers:
-${HVMAKE} install-libs
-
-# Create needed symlinks for a bootable system:
-LINKS="fsck.ext2 fsck.ext3 fsck.ext4 e2fsck"
-
-for link in ${LINKS}; do
-    ln -svfT /tools/sbin/${link} ${LFS}/sbin/${link}
-done
-
-exit $?
diff --git a/stage1/cis-gcc b/stage1/cis-gcc
deleted file mode 100755 (executable)
index ae99b97..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Manually applying patches if specified
-if [ -n "${GCC_PATCHES}" ]; then
-    for p in ${GCC_PATCHES}; do
-        apply_patch ${1}-${p}.patch ${1}
-    done
-fi
-
-case "${HVL_TARGET}" in
-    "x86")
-        apply_patch ${1}-specs-1.patch ${1}
-        ;;
-    "x86_64")
-        apply_patch ${1}-pure64_specs-1.patch ${1}
-       ;;
-esac
-
-cd ${LFS_TMP}/${1}
-
-# Change the StartFile Spec to point to the correct library location:
-echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h
-echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
-echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
-
-# Set the directory searched by the fixincludes process for system headers, so it won't look at the host's headers:
-cp -v gcc/Makefile.in{,.orig}
-sed -e 's@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g' \
-    gcc/Makefile.in.orig > gcc/Makefile.in
-
-# --with-local-prefix=/tools
-#     The purpose of this switch is to remove /usr/local/include from gcc's include search path.
-#     This is not absolutely essential, however, it helps to minimize the influence of the host system.
-# --disable-shared
-#     Disables the creation of the shared libraries.
-# --disable-threads
-#     This will prevent GCC from looking for the multi-thread include files, since they haven't been
-#     created for this architecture yet. GCC will be able to find the multi-thread information after
-#     the Glibc headers are created.
-# --enable-languages=c
-#     This option ensures that only the C compiler is built.
-cd ${LFS_TMP}/${1}-build
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ../${1}/configure \
-    --prefix=/tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    --target=${CLFS_TARGET} \
-    --disable-multilib \
-    --with-local-prefix=/tools \
-    --libexecdir=/tools/lib \
-    --disable-nls \
-    --disable-libstdcxx-pch \
-    --enable-long-long \
-    --enable-c99 \
-    --enable-shared \
-    --enable-threads=posix \
-    --enable-__cxa_atexit \
-    --enable-languages=c,c++
-# Prevent GCC from looking in the wrong directories for headers and libraries:
-sed -e "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" \
-    -i Makefile
-${HVMAKE} AS_FOR_TARGET="${AS}" LD_FOR_TARGET="${LD}"
-${HVMAKE} install
-
-exit $?
diff --git a/stage1/cis-gettext b/stage1/cis-gettext
deleted file mode 100755 (executable)
index c6e0149..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}/gettext-tools
-
-# 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:
-echo "gl_cv_func_wcwidth_works=yes" > config.cache
-
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ./configure \
-    --prefix=/tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    --disable-shared \
-    --cache-file=config.cache
-${HVMAKE} -C gnulib-lib
-${HVMAKE} -C src msgfmt
-cp -v src/msgfmt /tools/bin
-
-exit $?
diff --git a/stage1/cis-module-init-tools b/stage1/cis-module-init-tools
deleted file mode 100755 (executable)
index c79add6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-CC="${CC} ${CLFS_BUILDFLAGS}" ../${PACKAGE}/configure \
-    --prefix=/ \
-    --bindir=/bin \
-    --sbindir=/sbin \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET}
-make DOCBOOKTOMAN=""
-make DESTDIR=${LFS} install
-
-exit $?
diff --git a/stage1/cis-ppl b/stage1/cis-ppl
deleted file mode 100755 (executable)
index d09b5b6..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.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ../${PACKAGE}/configure \
-    --prefix=/tools \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    ${CONFIGURE_OPTS}
-# When PPL is cross-compiled, it does not check whether GMP was compiled with
-# support for exceptions, and simply assumes it was not. This assumption is
-# incorrect, so we will fix that:
-echo '#define PPL_GMP_SUPPORTS_EXCEPTIONS 1' >> confdefs.h
-
-${HVMAKE}
-${HVMAKE} install
-
-exit $?
diff --git a/stage1/cis-sysvinit b/stage1/cis-sysvinit
deleted file mode 100755 (executable)
index 319e885..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}
-cp -v src/Makefile src/Makefile.orig
-sed -e 's@root@0@g' \
-    -e "s@/dev/initctl@${CLFS}&@g" \
-    -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
-    -e "s@/usr/lib@/tools/lib@" \
-    src/Makefile.orig > src/Makefile
-make -C src clobber
-make -C src CC="${CC} ${CLFS_BUILDFLAGS}"
-make -C src install INSTALL=install ROOT=${LFS}
-
-install -m644 ${SCRDIR}/misc/inittab ${LFS}/etc
-
-exit $?
diff --git a/stage1/cis-udev b/stage1/cis-udev
deleted file mode 100755 (executable)
index ff0c1b8..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}
-
-install -dv ${LFS}/lib/{firmware,udev/devices/{pts,shm}}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-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
-make
-make DESTDIR=${LFS} install
-
-exit $?
diff --git a/stage1/cis-util-linux-ng b/stage1/cis-util-linux-ng
deleted file mode 100755 (executable)
index 18c8d34..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${PACKAGE}
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
-    ../${PACKAGE}/configure \
-    --build=${CLFS_HOST} \
-    --host=${CLFS_TARGET} \
-    --enable-login-utils \
-    --disable-makeinstall-chown
-${HVMAKE}
-${HVMAKE} DESTDIR=${LFS} install
-
-# 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
-cp -v ${LFS}/lib/lib{blkid,uuid}* /tools/lib
-ln -sfvT libblkid.so.1.1.0 /tools/lib/libblkid.so
-ln -sfvT libuuid.so.1.3.0 /tools/lib/libuuid.so
-install -dv /tools/include/{blkid,uuid}
-cp -av ${LFS}/usr/include/blkid/* /tools/include/blkid/
-cp -av ${LFS}/usr/include/uuid/* /tools/include/uuid/
-
-exit $?
diff --git a/stage1/cis-zlib b/stage1/cis-zlib
deleted file mode 100755 (executable)
index b5ba571..0000000
+++ /dev/null
@@ -1,22 +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}
-CC="${CC} ${CLFS_BUILDFLAGS}" ./configure \
-    --prefix=/tools
-${HVMAKE}
-
-# Installing the shared library
-${HVMAKE} install
-
-exit $?
diff --git a/stage1/config.cache.bash b/stage1/config.cache.bash
deleted file mode 100644 (file)
index fe0f9e9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# When Bash is cross-compiled, it cannot test for the presence of named pipes,
-# among other things. If you used su to become an unprivileged user, this
-# combination will cause Bash to build without process substitution, which
-# 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:
-
-ac_cv_func_mmap_fixed_mapped=yes
-ac_cv_func_strcoll_works=yes
-ac_cv_func_working_mktime=yes
-bash_cv_func_sigsetjmp=present
-bash_cv_getcwd_malloc=yes
-bash_cv_job_control_missing=present
-bash_cv_printf_a_format=yes
-bash_cv_sys_named_pipes=present
-bash_cv_ulimit_maxfds=yes
-bash_cv_under_sys_siglist=yes
-bash_cv_unusable_rtsigs=no
-gt_cv_int_divbyzero_sigfpe=yes
diff --git a/stage1/config.cache.coreutils b/stage1/config.cache.coreutils
deleted file mode 100644 (file)
index 6094db5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Configure can not properly determine how to get free space when
-# cross-compiling - 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:
-fu_cv_sys_stat_statfs2_bsize=yes
-gl_cv_func_working_mkstemp=yes
diff --git a/stage1/config.cache.findutils b/stage1/config.cache.findutils
deleted file mode 100755 (executable)
index 5587147..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# The following cache entries set the values for tests that do not run while
-# cross-compiling:
-gl_cv_func_wcwidth_works=yes
-ac_cv_func_fnmatch_gnu=yes
diff --git a/stage1/config.cache.flex b/stage1/config.cache.flex
deleted file mode 100755 (executable)
index 179e8d5..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# When Cross Compiling the configure script does not determine the correct
-# values for the following, Set the values manually:
-ac_cv_func_malloc_0_nonnull=yes
-ac_cv_func_realloc_0_nonnull=yes
diff --git a/stage1/config.cache.gettext b/stage1/config.cache.gettext
deleted file mode 100755 (executable)
index 302f11e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# 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:
-gl_cv_func_wcwidth_works=yes
diff --git a/stage1/config.cache.grep b/stage1/config.cache.grep
deleted file mode 100644 (file)
index 0ce838e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-ac_cv_func_malloc_0_nonnull=yes
-ac_cv_func_realloc_0_nonnull=yes
diff --git a/stage1/config.cache.m4 b/stage1/config.cache.m4
deleted file mode 100755 (executable)
index e4dc725..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#  Configure can not properly determine the results of the following tests:
-gl_cv_func_btowc_eof=yes
-gl_cv_func_mbrtowc_incomplete_state=yes
-gl_cv_func_mbrtowc_sanitycheck=yes
-gl_cv_func_mbrtowc_null_arg=yes
-gl_cv_func_mbrtowc_retval=yes
-gl_cv_func_mbrtowc_nul_retval=yes
-gl_cv_func_wcrtomb_retval=yes
-gl_cv_func_wctob_works=yes
diff --git a/stage1/config.cache.tar b/stage1/config.cache.tar
deleted file mode 100755 (executable)
index 803877e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# Configure can not properly determine the results of a few tests.
-gl_cv_func_wcwidth_works=yes
-gl_cv_func_btowc_eof=yes
-ac_cv_func_malloc_0_nonnull=yes
-ac_cv_func_realloc_0_nonnull=yes
-gl_cv_func_mbrtowc_incomplete_state=yes
-gl_cv_func_mbrtowc_nul_retval=yes
-gl_cv_func_mbrtowc_null_arg=yes
-gl_cv_func_mbrtowc_retval=yes
-gl_cv_func_wcrtomb_retval=yes
diff --git a/stage1/configure.pre.binutils b/stage1/configure.pre.binutils
deleted file mode 100644 (file)
index 4a9a672..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-configure_pre()
-{
-    case "${HVL_TARGET}" in
-        "x86_64")
-            # This adds 64 bit support to Binutils.
-           CONFIGURE_OPTS="${CONFIGURE_OPTS} --enable-64-bit-bfd"
-           ;;
-    esac
-}
diff --git a/stage1/configure.pre.cloog-ppl b/stage1/configure.pre.cloog-ppl
deleted file mode 100755 (executable)
index 6e06827..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/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()
-{
-    sed -e "/LD_LIBRARY_PATH=/d" -i ${LFS_TMP}/${PACKAGE}/configure
-}
diff --git a/stage1/configure.pre.coreutils b/stage1/configure.pre.coreutils
deleted file mode 100644 (file)
index 12198fd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-configure_pre()
-{
-    # Fix a bug when the uname patch is automatically applied
-    touch ${LFS_TMP}/${PACKAGE}/man/{uname,hostname}.1
-}
diff --git a/stage1/configure.pre.flex b/stage1/configure.pre.flex
deleted file mode 100755 (executable)
index 37f8735..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-configure_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
-}
diff --git a/stage1/configure.pre.m4 b/stage1/configure.pre.m4
deleted file mode 100755 (executable)
index 6b59f81..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-configure_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 c23163a..5a8a9cf 100755 (executable)
@@ -42,14 +42,26 @@ ipkg_ac   ${CLOOG_PPL} "\
     --with-bits=gmp \
     --with-gmp=/tools \
     --with-ppl=/tools"
-ipkg_cust ${ZLIB} cis-zlib
+ipkg_ac   ${ZLIB}
 ipkg_ac   ${BINUTILS} "\
     --target=${CLFS_TARGET} \
     --with-lib-path=/tools/lib \
     --disable-nls \
     --enable-shared \
     --disable-multilib"
-ipkg_cust ${GCC} cis-gcc
+ipkg_ac   ${GCC} "\
+    --target=${CLFS_TARGET} \
+    --disable-multilib \
+    --with-local-prefix=/tools \
+    --libexecdir=/tools/lib \
+    --disable-nls \
+    --disable-libstdcxx-pch \
+    --enable-long-long \
+    --enable-c99 \
+    --enable-shared \
+    --enable-threads=posix \
+    --enable-__cxa_atexit \
+    --enable-languages=c,c++"
 ipkg_ac   ${NCURSES} "\
     --with-shared \
     --without-debug \
@@ -58,14 +70,14 @@ ipkg_ac   ${NCURSES} "\
     --with-build-cc=gcc"
 ipkg_ac   ${BASH} "--without-bash-malloc"
 ipkg_ac   ${BISON}
-ipkg_cust ${BZIP2} cis-bzip2
+ipkg_ac   ${BZIP2}
 ipkg_ac   ${COREUTILS} "--enable-install-program=hostname"
 ipkg_ac   ${DIFFUTILS}
 ipkg_ac   ${FINDUTILS}
 ipkg_ac   ${FILE_PKG}
 ipkg_ac   ${FLEX}
 ipkg_ac   ${GAWK}
-ipkg_cust ${GETTEXT} cis-gettext
+ipkg_ac   ${GETTEXT} "--disable-shared"
 ipkg_ac   ${GREP} "\
     --disable-perl-regexp \
     --without-included-regex"
@@ -83,11 +95,11 @@ rscr once "Creating directory structure" create-directories
 rscr once "Creating symbolic links" create-symlinks
 
 ipkg_ac   ${NANO} "--enable-color --enable-multibuffer"
-ipkg_cust ${UTIL_LINUX_NG} cis-util-linux-ng
-ipkg_cust ${E2FSPROGS} cis-e2fsprogs
-ipkg_cust ${SYSVINIT} cis-sysvinit
-ipkg_cust ${MODULE_INIT_TOOLS} cis-module-init-tools
-ipkg_cust ${UDEV} cis-udev
+ipkg_ac   ${UTIL_LINUX_NG}
+ipkg_ac   ${E2FSPROGS}
+ipkg_ac   ${SYSVINIT}
+ipkg_ac   ${MODULE_INIT_TOOLS}
+ipkg_ac   ${UDEV}
 
 rscr once "Creating default users" create-users
 rscr once "Creating default groups" create-groups
diff --git a/stage1/pkg/bash b/stage1/pkg/bash
new file mode 100644 (file)
index 0000000..30ad517
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# When Bash is cross-compiled, it cannot test for the presence of named pipes,
+# among other things. If you used su to become an unprivileged user, this
+# combination will cause Bash to build without process substitution, which
+# 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()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+ac_cv_func_mmap_fixed_mapped=yes
+ac_cv_func_strcoll_works=yes
+ac_cv_func_working_mktime=yes
+bash_cv_func_sigsetjmp=present
+bash_cv_getcwd_malloc=yes
+bash_cv_job_control_missing=present
+bash_cv_printf_a_format=yes
+bash_cv_sys_named_pipes=present
+bash_cv_ulimit_maxfds=yes
+bash_cv_under_sys_siglist=yes
+bash_cv_unusable_rtsigs=no
+gt_cv_int_divbyzero_sigfpe=yes
+EOF
+}
+
+hvbuild()
+{
+    ${HVMAKE}
+    ${HVMAKE} install
+
+    ln -svfT bash /tools/bin/sh
+}
diff --git a/stage1/pkg/binutils b/stage1/pkg/binutils
new file mode 100644 (file)
index 0000000..9f34be4
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+configure_pre()
+{
+    case "${HVL_TARGET}" in
+        "x86_64")
+            # This adds 64 bit support to Binutils.
+           CONFIGURE_OPTS="${CONFIGURE_OPTS} --enable-64-bit-bfd"
+           ;;
+    esac
+}
+
+hvbuild()
+{
+    ${HVMAKE} configure-host
+    ${HVMAKE}
+    ${HVMAKE} install
+}
diff --git a/stage1/pkg/bzip2 b/stage1/pkg/bzip2
new file mode 100644 (file)
index 0000000..bedd643
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# This package doesn't have a configure script...
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    # Bzip2's default Makefile target automatically runs the testsuite as well.
+    # Disable the tests since they won't work on a multi-architecture build:
+    sed -e 's@^\(all:.*\) test@\1@g' -i Makefile
+}
+
+hvbuild()
+{
+    ${HVMAKE} CC="${CC} ${CLFS_BUILDFLAGS}" AR="${AR}" RANLIB="${RANLIB}"
+    ${HVMAKE} PREFIX=/tools install
+}
diff --git a/stage1/pkg/cloog-ppl b/stage1/pkg/cloog-ppl
new file mode 100644 (file)
index 0000000..6e06827
--- /dev/null
@@ -0,0 +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()
+{
+    sed -e "/LD_LIBRARY_PATH=/d" -i ${LFS_TMP}/${PACKAGE}/configure
+}
diff --git a/stage1/pkg/coreutils b/stage1/pkg/coreutils
new file mode 100644 (file)
index 0000000..c90f4fe
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# 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()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+fu_cv_sys_stat_statfs2_bsize=yes
+gl_cv_func_working_mkstemp=yes
+EOF
+}
+
+configure_pre()
+{
+    # Fix a bug when the uname patch is automatically applied
+    touch ${LFS_TMP}/${PACKAGE}/man/{uname,hostname}.1
+}
diff --git a/stage1/pkg/e2fsprogs b/stage1/pkg/e2fsprogs
new file mode 100644 (file)
index 0000000..159f339
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" PKG_CONFIG=true \
+        ../${PACKAGE}/configure \
+        --prefix=/tools \
+        --enable-elf-shlibs \
+        --with-linker=${LD} \
+        --host=${CLFS_TARGET} \
+        --disable-libblkid \
+        --disable-libuuid \
+        --disable-fsck \
+        --disable-uuidd
+}
+
+hvbuild()
+{
+    ${HVMAKE} LIBUUID="-luuid" STATIC_LIBUUID="-luuid" \
+        LIBBLKID="-lblkid" STATIC_LIBBLKID="-lblkid"
+    ${HVMAKE} install
+
+    # Install the static libraries and headers:
+    ${HVMAKE} install-libs
+
+    # Create needed symlinks for a bootable system:
+    LINKS="fsck.ext2 fsck.ext3 fsck.ext4 e2fsck"
+
+    for link in ${LINKS}; do
+        ln -svfT /tools/sbin/${link} ${LFS}/sbin/${link}
+    done
+}
diff --git a/stage1/pkg/findutils b/stage1/pkg/findutils
new file mode 100644 (file)
index 0000000..b833e36
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# The following cache entries set the values for tests that do not run while
+# cross-compiling:
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+gl_cv_func_wcwidth_works=yes
+ac_cv_func_fnmatch_gnu=yes
+EOF
+}
diff --git a/stage1/pkg/flex b/stage1/pkg/flex
new file mode 100644 (file)
index 0000000..c3c4a77
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# When Cross Compiling the configure script does not determine the correct
+# values for the following, Set the values manually:
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+ac_cv_func_malloc_0_nonnull=yes
+ac_cv_func_realloc_0_nonnull=yes
+EOF
+}
+
+configure_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
+}
diff --git a/stage1/pkg/gcc b/stage1/pkg/gcc
new file mode 100644 (file)
index 0000000..c6df1c7
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+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")
+            apply_patch ${PACKAGE}-specs-1.patch ${PACKAGE}
+            ;;
+        "x86_64")
+            apply_patch ${PACKAGE}-pure64_specs-1.patch ${PACKAGE}
+           ;;
+    esac
+}
+
+configure_pre()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    # Change the StartFile Spec to point to the correct library location:
+    echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h
+    echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
+    echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
+
+    # Set the directory searched by the fixincludes process for system headers,
+    # so it won't look at the host's headers:
+    cp -v gcc/Makefile.in{,.orig}
+    sed -e 's@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g' \
+        gcc/Makefile.in.orig > gcc/Makefile.in
+}
+
+configure_post()
+{
+    # Prevent GCC from looking in the wrong directories for headers and
+    # libraries:
+    sed -e "/^HOST_\(GMP\|PPL\|CLOOG\)\(LIBS\|INC\)/s:-[IL]/\(lib\|include\)::" \
+        -i Makefile
+}
+
+hvbuild()
+{
+    ${HVMAKE} AS_FOR_TARGET="${AS}" LD_FOR_TARGET="${LD}"
+    ${HVMAKE} install
+}
diff --git a/stage1/pkg/gettext b/stage1/pkg/gettext
new file mode 100644 (file)
index 0000000..670907b
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# 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()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+gl_cv_func_wcwidth_works=yes
+EOF
+}
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}/gettext-tools
+
+    FINAL_CFG_OPTS="\
+      --prefix=/tools \
+      --build=${CLFS_HOST} \
+      --host=${CLFS_TARGET} \
+      ${CONFIGURE_OPTS}"
+
+    echo "Running configure with options:"
+    echo "  <${FINAL_CFG_OPTS}>"
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
+        ./configure ${FINAL_CFG_OPTS}
+}
+
+hvbuild()
+{
+    cd ${LFS_TMP}/${PACKAGE}/gettext-tools
+
+    ${HVMAKE} -C gnulib-lib
+    ${HVMAKE} -C src msgfmt
+    cp -v src/msgfmt /tools/bin
+}
diff --git a/stage1/pkg/grep b/stage1/pkg/grep
new file mode 100644 (file)
index 0000000..7fe6d0f
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# When Cross Compiling the configure script does not determine the correct values
+# for the following, Set the values manually:
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+ac_cv_func_malloc_0_nonnull=yes
+ac_cv_func_realloc_0_nonnull=yes
+EOF
+}
+
diff --git a/stage1/pkg/m4 b/stage1/pkg/m4
new file mode 100644 (file)
index 0000000..d048865
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Configure can not properly determine the results of the following tests:
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+gl_cv_func_btowc_eof=yes
+gl_cv_func_mbrtowc_incomplete_state=yes
+gl_cv_func_mbrtowc_sanitycheck=yes
+gl_cv_func_mbrtowc_null_arg=yes
+gl_cv_func_mbrtowc_retval=yes
+gl_cv_func_mbrtowc_nul_retval=yes
+gl_cv_func_wcrtomb_retval=yes
+gl_cv_func_wctob_works=yes
+EOF
+}
+
+configure_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
+}
diff --git a/stage1/pkg/module-init-tools b/stage1/pkg/module-init-tools
new file mode 100644 (file)
index 0000000..d458647
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" \
+        ../${PACKAGE}/configure \
+        --prefix=/ \
+        --bindir=/bin \
+        --sbindir=/sbin \
+        --build=${CLFS_HOST} \
+        --host=${CLFS_TARGET}
+}
+
+hvbuild()
+{
+    make DOCBOOKTOMAN=""
+    make DESTDIR=${LFS} install
+}
diff --git a/stage1/pkg/ppl b/stage1/pkg/ppl
new file mode 100644 (file)
index 0000000..87f279d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+configure_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
+    # assumption is incorrect, so we will fix that:
+    echo '#define PPL_GMP_SUPPORTS_EXCEPTIONS 1' >> confdefs.h
+}
diff --git a/stage1/pkg/sysvinit b/stage1/pkg/sysvinit
new file mode 100644 (file)
index 0000000..4cf5905
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+HV_NO_CONFIGURE_SCRIPT=1
+
+configure_pre()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    sed -e 's@root@0@g' \
+        -e "s@/dev/initctl@${CLFS}&@g" \
+        -e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
+        -e "s@/usr/lib@/tools/lib@" \
+        -i src/Makefile
+}
+
+hvbuild()
+{
+    make -C src clobber
+    make -C src CC="${CC} ${CLFS_BUILDFLAGS}"
+    make -C src install INSTALL=install ROOT=${LFS}
+    
+    install -m644 ${SCRDIR}/misc/inittab ${LFS}/etc
+}
diff --git a/stage1/pkg/tar b/stage1/pkg/tar
new file mode 100644 (file)
index 0000000..d2c52da
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# Configure can not properly determine the results of a few tests.
+config_cache()
+{
+cat > ${LFS_TMP}/${PACKAGE}-build/config.cache << EOF
+gl_cv_func_wcwidth_works=yes
+gl_cv_func_btowc_eof=yes
+ac_cv_func_malloc_0_nonnull=yes
+ac_cv_func_realloc_0_nonnull=yes
+gl_cv_func_mbrtowc_incomplete_state=yes
+gl_cv_func_mbrtowc_nul_retval=yes
+gl_cv_func_mbrtowc_null_arg=yes
+gl_cv_func_mbrtowc_retval=yes
+gl_cv_func_wcrtomb_retval=yes
+EOF
+}
diff --git a/stage1/pkg/texinfo b/stage1/pkg/texinfo
new file mode 100644 (file)
index 0000000..fc6050f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+hvbuild()
+{
+    ${HVMAKE} -C tools/gnulib/lib
+    ${HVMAKE} -C tools
+    ${HVMAKE}
+    ${HVMAKE} install
+}
diff --git a/stage1/pkg/udev b/stage1/pkg/udev
new file mode 100644 (file)
index 0000000..0d46963
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+configure_pre()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    install -dv ${LFS}/lib/{firmware,udev/devices/{pts,shm}}
+}
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    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
+}
+
+hvbuild()
+{
+    make
+    make DESTDIR=${LFS} install
+}
diff --git a/stage1/pkg/util-linux-ng b/stage1/pkg/util-linux-ng
new file mode 100644 (file)
index 0000000..b6a89cf
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}-build
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" CXX="${CXX} ${CLFS_BUILDFLAGS}" \
+        ../${PACKAGE}/configure \
+        --build=${CLFS_HOST} \
+        --host=${CLFS_TARGET} \
+        --enable-login-utils \
+        --disable-makeinstall-chown
+}
+
+hvbuild()
+{
+    ${HVMAKE}
+    ${HVMAKE} DESTDIR=${LFS} install
+
+    # 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
+    cp -v ${LFS}/lib/lib{blkid,uuid}* /tools/lib
+    ln -sfvT libblkid.so.1.1.0 /tools/lib/libblkid.so
+    ln -sfvT libuuid.so.1.3.0 /tools/lib/libuuid.so
+    install -dv /tools/include/{blkid,uuid}
+    cp -av ${LFS}/usr/include/blkid/* /tools/include/blkid/
+    cp -av ${LFS}/usr/include/uuid/* /tools/include/uuid/
+}
diff --git a/stage1/pkg/zlib b/stage1/pkg/zlib
new file mode 100644 (file)
index 0000000..0be85a5
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+hvconfigure()
+{
+    cd ${LFS_TMP}/${PACKAGE}
+
+    CC="${CC} ${CLFS_BUILDFLAGS}" ./configure \
+        --prefix=/tools
+}