Commit d3fca295 authored by Akash Kothari's avatar Akash Kothari
Browse files

Removing llvm installer directory

parent 7c622b02
#!/bin/bash
VERSION="9.0.0"
URL="http://releases.llvm.org"
WGET=wget
CURRENT_DIR=`pwd`
INSTALL_DIR=`pwd`/install
BUILD_DIR=$CURRENT_DIR/$LLVM_SRC/build
# Using 2 threads by default
NUM_THREADS=2
SUFFIX=".tar.xz"
CLANG_SRC="cfe-$VERSION.src"
LLVM_SRC="llvm-$VERSION.src"
LIBCXX_SRC="libcxx-$VERSION.src"
LIBCXXABI_SRC="libcxxabi-$VERSION.src"
AUTOMATE="y"
read -p "Build and install HPVM automatically? (y or n): " AUTOMATE
if [ ! $AUTOMATE == "y" ] && [ ! $AUTOMATE == "n" ]; then
echo invalid input!
exit -1
fi
echo
read -p "Number of threads: " NUM_THREADS
if [ ! $NUM_THREADS -gt 0 ]; then
NUM_THREADS = 2
echo
echo Using $NUM_THREADS threads by default.
echo
fi
if [ -d $LLVM_SRC ]; then
echo Found $LLVM_SRC!
elif [ -d llvm ]; then
echo Found llvm, not downloading $LLVM_SRC!
else
echo $WGET $URL/$VERSION/$LLVM_SRC$SUFFIX
$WGET $URL/$VERSION/$LLVM_SRC$SUFFIX
tar xf $LLVM_SRC$SUFFIX
rm $LLVM_SRC$SUFFIX
fi
if [ -d $LLVM_SRC ]; then
echo Everything looks sane.
mv $LLVM_SRC llvm
elif [ -d llvm ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
LLVM_SRC=llvm
if [ -d $CURRENT_DIR/$LLVM_SRC/tools ]; then
cd $CURRENT_DIR/$LLVM_SRC/tools
echo In tools.
else
echo Fail! Something is wrong with your $LLVM_SRC checkout!
exit 1
fi
if [ -d clang ]; then
echo Found clang! Not downloading clang again.
else
$WGET $URL/$VERSION/$CLANG_SRC$SUFFIX
tar xf $CLANG_SRC$SUFFIX
rm $CLANG_SRC$SUFFIX
mv $CLANG_SRC clang
if [ -d clang ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
cd $CURRENT_DIR
if [ -d $CURRENT_DIR/$LLVM_SRC/projects ]; then
cd $CURRENT_DIR/$LLVM_SRC/projects
else
echo Fail! Something is wrong wint $LLVM_SRC.
exit 1
fi
if [ -d libcxx ]; then
echo Found libcxx! Not downloading libcxx again.
else
$WGET $URL/$VERSION/$LIBCXX_SRC$SUFFIX
tar xf $LIBCXX_SRC$SUFFIX
rm $LIBCXX_SRC$SUFFIX
mv $LIBCXX_SRC libcxx
if [ -d libcxx ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
if [ $LIBCXXABI_SRC != "" ]; then
if [ -d libcxxabi ]; then
echo Found libcxxabi! Not downloading libcxx again.
else
$WGET $URL/$VERSION/$LIBCXXABI_SRC$SUFFIX
tar xf $LIBCXXABI_SRC$SUFFIX
rm $LIBCXXABI_SRC$SUFFIX
mv $LIBCXXABI_SRC libcxxabi
if [ -d libcxxabi ]; then
echo Everything looks sane.
else
echo Install had problems. Quitting.
exit
fi
fi
fi
HPVM_DIR=$CURRENT_DIR/$LLVM_SRC/tools/hpvm
if [ ! -d $HPVM_DIR ]; then
echo Adding HPVM sources to tree
mkdir -p $HPVM_DIR
ln -s $CURRENT_DIR/CMakeLists.txt $HPVM_DIR
ln -s $CURRENT_DIR/include $HPVM_DIR/
ln -s $CURRENT_DIR/lib $HPVM_DIR/
ln -s $CURRENT_DIR/projects $HPVM_DIR/
ln -s $CURRENT_DIR/test $HPVM_DIR/
else
echo $CURRENT_DIR/$LLVM_SRC/tools/hpvm exists.
fi
export LLVM_SRC_ROOT=$CURRENT_DIR/$LLVM_SRC
echo Applying HPVM patches
cd $CURRENT_DIR/llvm_patches
/bin/bash ./construct_patch.sh
/bin/bash ./apply_patch.sh
echo Patches applied.
if [ ! $AUTOMATE == "y" ]; then
echo
echo HPVM not installed. Exiting.
exit
fi
echo
echo Now building...
echo Using $NUM_THREADS threads to build HPVM.
echo
cd $CURRENT_DIR
if [ ! -d $BUILD_DIR ]; then
mkdir -p $BUILD_DIR
fi
if [ ! -d $INSTALL_DIR ]; then
mkdir -p $INSTALL_DIR
fi
cd $BUILD_DIR
echo cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
cmake ../$LLVM_SRC -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR
echo make -j$NUM_THREADS
make -j$NUM_THREADS
#make install
# echo Building HPVM runtime
# HPVM_RT_DIR=$HPVM_DIR/projects/hpvm-rt
# cd $HPVM_RT_DIR
# make
#cp -r $CURRENT_DIR/projects $HPVM_DIR/
#make -j$NUM_THREADS
#if [ -x $INSTALL_DIR/bin/clang ]; then
# true
#else
# echo LLVM not installed properly.
# exit 0
#fi
cd $CURRENT_DIR
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment