#!/bin/csh -ef

rm -f build-apps-log
touch build-apps-log

echo ""

echo "PRECONDITION:  kernel/include must be a directory or a link to"
echo "a directory that contains the kernel header files.  This directory must"
echo "include the automatically-generated Flask header files."

echo ""
echo "Logging build output to build-apps-log."
echo ""

echo ""
echo "Building libsecure."
echo ""
cd libsecure
make >> ../build-apps-log
cd ..

echo ""
echo "Building syscalls programs."
echo ""
cd syscalls
make depend >> ../build-apps-log
make >> ../build-apps-log
if ( ! -d bin ) then
    mkdir bin
endif
make install >> ../build-apps-log

cd ..

cd utils

echo ""
echo "Building wrappers for passwd, chsh, and chfn."
echo ""
cd spasswd
make >> ../../build-apps-log
cd ..

echo ""
echo "Building file utility programs."
echo ""
cd stat*
make >> ../../build-apps-log
cd ..
foreach dir (fileutils* findutils* tar*)
cd $dir
set d1 = `pwd`
set d2 = `dirname $d1`
set d3 = `dirname $d2`
./configure --prefix=/usr/flask --with-flask --with-flaskroot=$d3 >> ../../build-apps-log
make >> ../../build-apps-log
cd ..
end

echo ""
echo "Building shell utility programs."
echo ""
cd sh-util*
./configure --prefix=/usr/flask --enable-pam >> ../../build-apps-log
touch aclocal.m4 configure.in config.h.in stamp-h.in Makefile.in */Makefile.in configure config.status config.h Makefile */Makefile
make >> ../../build-apps-log
cd ..

echo ""
echo "Building process utility programs."
echo ""
cd procps-010114
make >> ../../build-apps-log
cd ..
cd psmisc
make >> ../../build-apps-log
cd ..

echo ""
echo "Building login program."
echo ""
cd util-linux-2.10
./configure >> ../../build-apps-log
make >> ../../build-apps-log
cd ..

echo ""
echo "Building vixie-cron."
echo ""
cd vixie-cron-*
make >> ../../build-apps-log
cd ..

echo ""
echo "Building logrotate."
echo ""
cd logrotate-*
make >> ../../build-apps-log
cd ..

echo ""
echo "Building newrole."
echo ""
cd newrole
make >> ../../build-apps-log
cd ..

echo ""
echo "Build completed."
echo ""


