#!/bin/sh
-# System configuration informations (entered by the user)
+LFS_STAGE=stage2
+
+export LFS_PKG_DIR="$(dirname $(pwd))/packages/${LFS_STAGE}"
+export LFS_LOG_DIR=/var/log/hvlinux-install/${LFS_STAGE}
+export LFS_LOG_FILE=${LFS_LOG_DIR}/install.log
+export LFS_TMP=/tmp
+
+# Reading system configuration informations, functions and package versions.
source ../sysinfos
+source ../functions
+source ../packages-list
+source /etc/profile
if [ "x${USER}" != "xroot" ]; then
echo "You must be the superuser to install hvlinux."
exit 1
fi
-# Finding the path, relative to ${LFS} of the sources directory.
-S1=$(pwd)
-CHROOT_WD=${S1#${LFS}}
+init_log_file
-# We need /dev/null and /dev/console before udev is started.
-mkdir -p ${LFS}/dev &&
-if [ ! -c ${LFS}/dev/null ]; then
- mknod ${LFS}/dev/null -m 0666 c 1 3 || exit 1
-fi
-if [ ! -c ${LFS}/dev/console ]; then
- mknod ${LFS}/dev/console -m 0666 c 5 1 || exit 1
-fi
+# Scripts directory
+export SCRDIR=$(pwd)
-# Mounting and populating /dev for the chroot environment.
-# May fail if it is already mountewd, but it is ok.
-mount -v --bind /dev ${LFS}/dev 1> /dev/null 2>&1
-
-# If something went wrong, proc, dev and devpts may still be mounted.
-umount -n ${LFS}/proc 1> /dev/null 2>&1
-umount -n ${LFS}/dev/pts 1> /dev/null 2>&1
-
-# Making sure that if a separate boot partition is defined, it is mounted.
-if [ -n "${BOOT_PARTITION}" ]; then
- if ! grep "${BOOT_PARTITION}" /etc/mtab | grep "${LFS}/boot" 1> /dev/null 2>&1; then
- echo "You defined \"${BOOT_PARTITION}\" as your boot partition,"
- echo "but it is not mounted in your LFS partition. You must"
- echo "mount it before running this script again."
- exit 1;
- fi
-fi
+ipkg ${PERL} cis-perl-pass1 "${PERL}-pass1"
+ipkg_cust ${KERNEL} cis-kernel
+ipkg_cust ${MANPAGES} cis-man-pages
+ipkg_cust ${EGLIBC} cis-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"
+
+CC="gcc -isystem /usr/include" LDFLAGS="-Wl,-rpath-link,/lib" \
+ ipkg_ac ${MPFR} "--enable-shared --with-gmp=/usr"
+
+CPPFLAGS=-fexceptions CC="gcc -isystem /usr/include" \
+ CXX="g++ -isystem /usr/include" \
+ LDFLAGS="-Wl,-rpath-link,/lib" \
+ 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_CORE} 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
-# Option '-i' of env starts with a new environment.
-# The argument to the setup script is the working directory.
-chroot ${LFS} /tools/bin/env -i \
- HOME=/root \
- TERM=$TERM \
- PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
- /tools/bin/bash -c "${CHROOT_WD}/setup ${CHROOT_WD}"
+rscr mult "Testing toolchain" cis-toolchain-test
-# Unmounting /dev for the chroot environment.
-umount ${LFS}/dev
+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"
-# At the end, we should remove the '/tools' directory
-# mv /mnt/linux/tools /mnt/linux/tmp
+/bin/bash +h -c ./install-2
exit $?