cedasetup
#!/bin/bash
# Script arguments:
# $1: subversion usernaame
# $2: subversion password
# $3: 'noprompt' if no prompts should be issued by apt-get
# $4: 'force' to force boost version to be downloaded and installed
PLATFORM=Linuxx64
echo "========================================================================="
echo Setting up ceda on $PLATFORM...
# --no-auth-cache disables caching of authentication information; this prevents a warning
# from requiring user input.
# --trust-server-cert stops the Error validating server certificate for 'https://wush.net:443'
# warning from requiring user input.
# --non-interactive prevents prompting for credentials in the case of an authentication failure.
SVN_OPTIONS="--username $1 --password $2 --no-auth-cache --trust-server-cert --non-interactive"
ROOT=~/developer/_root_
CEDA=$ROOT/Ceda
SOURCE=$CEDA/_BUILD/Init/$PLATFORM
BUILD_XCPP=~/developer/build_linuxx64_xcpp/build
BUILD=~/developer/build_linuxx64/build
WORKSPACE=wsAll
#==================== Ceda svn repos ==============================================================
if [ -d $CEDA ]; then
echo $CEDA already exists. Updating subversion checkout
svn $SVN_OPTIONS update $CEDA
else
echo Checking out Ceda from subversion to $CEDA
mkdir -p $ROOT
cd $ROOT
svn $SVN_OPTIONS co https://wush.net/svn/cedanet/trunk/Ceda
fi
#==================== bin =========================================================================
echo Setting up bin folder...
mkdir -p ~/bin
# This is unnecessary under Ubuntu, because the default .bashrc automatically adds ~/bin to the path if it exists
#if [ -e ~/.profile ]; then
# echo ~/.profile already exists
#else
# echo Writing ~/.profile
# echo export PATH=\$PATH:\$HOME/bin >~/.profile
#fi
# Returns the size of file $1
getFileSize()
{
ls -al "$1" | awk '{print $5}'
}
# Make sure all the bash scripts in directory $1 are executable and have no carriage returns
fixBashScripts()
{
for FILE in $1/*; do
if grep -q "#!/bin/bash" <<< `head -c 11 $FILE` ; then
tr -d '\r' < $FILE > ~/bin/temp
echo Size of "$FILE" = `getFileSize "$FILE"`
if [ `getFileSize "$FILE"` != `getFileSize "$HOME/bin/temp"` ]; then
echo "Note: removed carriage returns from bash script $FILE"
cp ~/bin/temp $FILE
fi
rm ~/bin/temp
chmod 755 $FILE
fi
done
}
fixBashScripts $SOURCE/bin
cp $SOURCE/bin/* ~/bin
fixBashScripts ~/bin
#==================== install prerequisites required for build ====================================
~/bin/cedaprereq $3
#BOOSTVER=60
#~/bin/buildboost ${BOOSTVER} $4
sudo apt-get install libboost-all-dev
#==================== cedatests ===================================================================
mkdir -p ~/cedatests
#==================== XcppConfig ==================================================================
# This is conditional because we don't want to copy over XcppConfig if this is a Linux virtual machine
# and developer is shared with Windows
if [ -d ~/developer/XcppConfig ]; then
echo ~/developer/XcppConfig already exists so not updating
else
mkdir -p ~/developer/XcppConfig
cp $SOURCE/XcppConfig/* ~/developer/XcppConfig
fi
#==================== Xcpp ========================================================================
mkdir -p $BUILD_XCPP/$PLATFORM/Release/cxUtils
mkdir -p $BUILD_XCPP/$PLATFORM/Release/cxMacroExpander
mkdir -p $BUILD_XCPP/$PLATFORM/Release/cxBuild
mkdir -p $BUILD_XCPP/$PLATFORM/Release/GenerateXcpj
mkdir -p $BUILD_XCPP/$PLATFORM/Release/SetupXcws
mkdir -p $BUILD_XCPP/$PLATFORM/Release/Xcpp
mkdir -p $BUILD_XCPP/../lib/$PLATFORM/Release
cp $CEDA/_BUILD/Init/CedaWorkspaceXcpps/wsBuild.xcpp $BUILD_XCPP
cp $CEDA/_BUILD/Init/CedaWorkspaceXcpps/build_local.xcpp $BUILD_XCPP
cp $SOURCE/XcppConfig/selectcompiler.xcpp $BUILD_XCPP
cp $SOURCE/build_xcpp/* $BUILD_XCPP
~/bin/xcppbuild
~/bin/xcppcopy
#==================== build =======================================================================
mkdir -p $BUILD
cp $CEDA/_BUILD/Init/CedaWorkspaceXcpps/* $BUILD
cp $SOURCE/XcppConfig/selectcompiler.xcpp $BUILD
cd $BUILD
echo "----------------- Start generate $WORKSPACE.xcws make files --------------------"
~/bin/Xcpp $WORKSPACE.xcpp mode=gen
echo "----------------- End generate $WORKSPACE.xcws make files --------------------"
echo "You can run make in $BUILD to build the $WORKSPACE.xcws workspace"
echo "You can open $BUILD/$WORKSPACE.workspace with the Code::Blocks IDE"
#==================================================================================================
echo "Setup of ceda on $PLATFORM completed"
echo "========================================================================="