1#!/bin/sh
2#
3# Copyright 2016, NICTA
4#
5# This software may be distributed and modified according to the terms of
6# the GNU General Public License version 2. Note that NO WARRANTY is provided.
7# See "LICENSE_GPLv2.txt" for details.
8#
9# @TAG(NICTA_GPL)
10#
11
12# Common environment variables.
13# All build scripts should ���source��� this file. For makefiles, use ���build-env.mk��� instead.
14#
15# Variables:
16#   AC_DIR: location of AutoCorres (http://ts.data61.csiro.au/projects/TS/autocorres/) directory.
17#            AutoCorres is a dependency of proof builds.
18#
19# Extra PATH variables:
20#   ISABELLE_TOOLDIR: location of ���isabelle��� theorem prover.
21#                     Defaults to isabelle/bin.
22#
23#   COGENT_TOOLDIR: location of ���cogent��� compiler.
24#
25# These will be added to the PATH if not already present.
26#
27# If any variable has already been defined, it will be left alone.
28
29find_script_dir() {
30   (
31       while test "$PWD" != '/' -a ! -f build-env.mk
32       do
33	  cd ..
34       done
35       echo "$PWD"
36   )
37}
38
39set_build_env()
40{
41  
42  local SCRIPT_DIR=`find_script_dir`
43  # Extract of the AutoCorres release
44  : ${AC_DIR:="$SCRIPT_DIR/autocorres"}
45
46  # Location of Isabelle (sub-module)
47  : ${ISABELLE_TOOLDIR:="$SCRIPT_DIR/isabelle/bin"}
48  : ${ISABELLE:="$ISABELLE_TOOLDIR/isabelle"}
49  : ${ISABELLE_BUILD:="$ISABELLE build -v"}
50
51  [ -d "$AC_DIR"  ] || {
52  echo >&2 "Cannot find \$AC_DIR ($AC_DIR)"
53	exit 1
54  }
55
56  # Location of Cogent compiler (if not already defined)
57  : ${COGENT_TOOLDIR:="$HOME/.cabal/bin"}
58  if ! type cogent >/dev/null 2>&1
59  then PATH="$COGENT_TOOLDIR:$PATH"
60  fi
61
62  # Location of Cogent shared library
63  : ${COGENT_LIBGUM_DIR:="$SCRIPT_DIR/cogent/lib"}
64
65  # Environment variable for running AutoCorres
66  : ${L4V_ARCH:="ARM"}
67}
68
69set_build_env
70