Skip to content
Snippets Groups Projects
build-all.sh 3.78 KiB
Newer Older
jdh8d's avatar
jdh8d committed
#!/bin/bash



if [[ "$*" =~ "--debug" ]]; then
	SCONSDEBUG=" debug=1 "
fi

if [[ $(uname -m) == 'armv7l' ]] || [[ $(uname -m) == 'aarch64' ]]; then
	scons $SCONSDEBUG 
else 
	scons $SCONSDEBUG -j 3
fi
jdh8d's avatar
jdh8d committed
# check if DIR is the directory containing the build script.
BUILD_LOC=`dirname $0`
FULL_BUILD_LOC=`cd $BUILD_LOC; pwd`
echo $PEASOUP_UMBRELLA_DIR
if [ "$PEASOUP_UMBRELLA_DIR" != "$FULL_BUILD_LOC" ]; then
    echo "PEASOUP_UMBRELLA_DIR differs from build-all.sh location ($FULL_BUILD_LOC).";
    echo "Did you source set_env_vars from the root of the umbrella working copy?";
    exit 1;
fi

echo
echo "Building Zipr toolchain."
echo


SCONSDEBUG=""
if [[ "$*" =~ "--debug" ]]; then
	SCONSDEBUG=" debug=1 "
fi

if [ `basename $FULL_BUILD_LOC` == "cfar_umbrella" ]; then
	cfar_mode="--enable-cfar"
fi

mkdir -p $ZEST_RUNTIME/lib32
mkdir -p $ZEST_RUNTIME/lib64
jdh8d's avatar
jdh8d committed
mkdir -p $ZEST_RUNTIME/bin
mkdir -p $ZEST_RUNTIME/sbin
if [ "$(ls -A "$PEDI_HOME" 2> /dev/null)" == "" ]; then
	echo "pedi submodule is empty. Did you clone using --recursive?";
	exit 1;
fi 

jdh8d's avatar
 
jdh8d committed
if [ ! -f manifest.txt.config -o ! -d "$PS_INSTALL" ]; then
	mkdir -p "$PS_INSTALL"
	$PEDI_HOME/pedi --setup -m manifest.txt -l ida -l ida_key -l ps -l zipr -l stars -i $PS_INSTALL
jdh8d's avatar
jdh8d committed

use_strata=0
if [[ $use_strata = 1 ]]; then
	# stratafier
	cd $PEASOUP_UMBRELLA_DIR/stratafier
jdh8d's avatar
jdh8d committed

	# strata
	if [ ! "$STRATA_HOME" ]; then 
	    echo "STRATA_HOME not set.";
	    exit 1; 
jdh8d's avatar
jdh8d committed
	fi

	if [ `uname -m` = 'x86_64' ]; then
		# build 32-bit strata
		if [ ! -d $STRATA_HOME32 ] ; then 
			cd $STRATA
			if [ -f Makefile ] ; then
				make clean distclean
			fi
			cd $PEASOUP_UMBRELLA_DIR
			echo Creating strata 32-bit build directory
			cp -R $STRATA $STRATA32
		fi
		
		cd $STRATA_HOME32
		STRATA_HOME=$STRATA_HOME32 STRATA=$STRATA_HOME32 ./build -host=i386-linux || exit 1

		# build x86-64 strata
		cd $STRATA_HOME
		if [ -f Makefile -a Makefile -nt configure -a Makefile -nt Makefile.in ]; then
			echo Skipping Strata reconfigure step
		else
jdh8d's avatar
jdh8d committed
fi

# smp-static-analyzer
if [ ! "$SMPSA_HOME" ]; then
    echo "SMPSA_HOME not set."; 
    exit 1; 
fi

# security-transforms
if [ ! "$SECURITY_TRANSFORMS_HOME" ]; then 
    echo "SECURITY_TRANSFORMS_HOME not set."; 
    exit 1; 
fi
jdh8d's avatar
jdh8d committed
cd $SECURITY_TRANSFORMS_HOME
jdh8d's avatar
jdh8d committed

cd $SMPSA_HOME
cd $SECURITY_TRANSFORMS_HOME
scons build_deep=1 $SCONSDEBUG -j 3 || exit 1

jdh8d's avatar
jdh8d committed
cd $PEASOUP_HOME
jdh8d's avatar
jdh8d committed

if [ -d $ZIPR_CALLBACKS ]; then 
	cd $ZIPR_CALLBACKS
	./configure --enable-p1 --prefix=$ZIPR_INSTALL
jdh8d's avatar
jdh8d committed

if [ -d $ZIPR_HOME ]; then
jdh8d's avatar
jdh8d committed
	cd $ZIPR_HOME
jdh8d's avatar
jdh8d committed
fi

jdh8d's avatar
jdh8d committed
if [ -d $ZIPR_SCFI_PLUGIN ]; then
jdh8d's avatar
jdh8d committed
	cd $ZIPR_SCFI_PLUGIN
jdh8d's avatar
jdh8d committed
fi
jdh8d's avatar
jdh8d committed

Matthew McGill's avatar
Matthew McGill committed
if [ -d $ZIPR_XEON_PLUGIN ]; then
        cd $ZIPR_XEON_PLUGIN
        scons  $SCONSDEBUG || exit
fi

jdh8d's avatar
jdh8d committed
cd $PEASOUP_UMBRELLA_DIR/zipr_large_only_plugin/
jdh8d's avatar
 
jdh8d committed
if [[ -e $PEASOUP_UMBRELLA_DIR/zipr ]] && [[ -e $PEASOUP_UMBRELLA_DIR/zipr_relax_plugin ]]  ; then
jdh8d's avatar
 
jdh8d committed
	cd $PEASOUP_UMBRELLA_DIR/zipr_relax_plugin/
jdh8d's avatar
 
jdh8d committed
fi
jdh8d's avatar
 
jdh8d committed

jdh8d's avatar
 
jdh8d committed
if [[ -e $PEASOUP_UMBRELLA_DIR/zipr ]] && [[ -e $PEASOUP_UMBRELLA_DIR/zipr_trace_plugin ]]  ; then
jdh8d's avatar
 
jdh8d committed
	cd $PEASOUP_UMBRELLA_DIR/zipr_trace_plugin/
jdh8d's avatar
 
jdh8d committed
fi
jdh8d's avatar
 
jdh8d committed

jdh8d's avatar
jdh8d committed
cd $PEASOUP_UMBRELLA_DIR/zipr_push64_reloc_plugin
cd $PEASOUP_UMBRELLA_DIR/zipr_unpin_plugin
if [[ -d "$DAFFY_HOME" ]] && [[ $(uname -p) == 'x86_64' ]]; then
an7s's avatar
an7s committed
	cd $DAFFY_HOME
an7s's avatar
an7s committed
fi
cd $PEASOUP_UMBRELLA_DIR

$PEDI_HOME/pedi -m manifest.txt 

echo  "Zipr toolchain build complete."