Fix correct commit hash for release 0.7.0 of openXC7
[dev-env-setup.git] / tasyagle-install
index cbc9452ccda99e932607e119f281c52816828263..7e9d8094dc2222dc5f4de53c3ff80b12166936ba 100755 (executable)
@@ -7,9 +7,13 @@ fi
 
 apt-get install -y quilt tcsh swig libedit-dev tcl8.6-dev \
        libmotif-dev libxpa1 libxt-dev libxpm-dev \
-       default-jre-headless libncurses5 libedit-dev \
+       default-jre-headless default-jdk-headless \
+       libncurses5 libedit-dev \
        libsaxon-java libsaxonb-java libservlet3.1-java fop\
-       # tex-live
+       groff # tex-live
+
+# Make sure to use the flex included with tasyagle
+apt-get remove flex
 
 mkdir -p /home/$SUDO_USER/src
 cd /home/$SUDO_USER/src
@@ -17,11 +21,33 @@ git clone https://git.libre-soc.org/git/tas-yagle.git
 cd tas-yagle
 
 # Specify installation dir
-installDir="/usr/local" ./build.sh
+installDir="/usr/local"
+installDir=$installDir ./build.sh
 
 cd /home/$SUDO_USER/src
 chown -R $SUDO_USER .
 chgrp -R $SUDO_USER .
 
-echo "Adding avt_env.sh to .bashrc"
-echo "source /usr/local/avt_env.sh" >> /home/$SUDO_USER/.bashrc
+STRING="source $installDir/bin/avt_env.sh"
+if  grep -q "$STRING" /home/$SUDO_USER/.bashrc ; then
+       echo 'avt_env.sh already in .bashrc'
+else
+       # Default .bashrc usually has a check if shell is
+       # interactive, so adding at the start is a workaround
+       echo 'Adding avt_env.sh to .bashrc'
+       sed -i "1i $STRING" /home/$SUDO_USER/.bashrc
+       chown -R $SUDO_USER /home/$SUDO_USER/.bashrc
+       chgrp -R $SUDO_USER /home/$SUDO_USER/.bashrc
+fi
+
+# Compile the documentation and example
+echo "Entering bash as $SUDO_USER to reload .bashrc and compile docs!"
+runuser $SUDO_USER -c "/bin/bash << EOF
+. ~/.bashrc
+cd /home/$SUDO_USER/src/tas-yagle/distrib/docxml2
+make
+cd /home/$SUDO_USER/src/tas-yagle/distrib/share/tutorials/hitas/inv
+./db.tcl
+EOF"
+
+echo "Finished tas-yagle compilation, make sure to source .bashrc!"