#!/bin/bash
#
# Copyright 2022 N5 Technologies, Inc.
#
# This product includes software developed at N5 Technologies, Inc
# (http://www.n5corp.com/) and software licenced to N5 Technologies,
# Inc under one or more contributor license agreements.
#
# N5 Technologies, Inc licenses this file to you under the Polyform
# Internal Use License Version 1.1.0 (the "License"); you may not use
# this file except in compliance with the License.  You may obtain a
# copy of the License at:
#
#     https://polyformproject.org/licenses/internal-use/1.0.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if [ "$NVXRUNTIMESETUP" = "" ]
then
   . ./setup_jre.sh
   . ./setup_platform.sh
   export NVROOT=`pwd`
   export NVJAVALIBROOT=$NVROOT/bin/java/lib
   if [ "$NVCLIBPATH" == "" ];
   then
       export NVCLIBROOT=$NVROOT/bin/$NVPLATFORM/lib:$NVROOT/bin/$NVPLATFORM/lib/extracted
   else
       export NVCLIBROOT=$NVCLIBPATH:$NVROOT/bin/$NVPLATFORM/lib:$NVROOT/bin/$NVPLATFORM/lib/extracted
   fi
   export NVLICLOCATION=$NVROOT/license
   for i in $NVJAVALIBROOT/*.jar
   do
      if [ "$NVCP" == "" ]; 
      then
          export NVCP=$i
      else
          export NVCP=$NVCP:$i
      fi
   done
   export PATH=$PATH:$NVROOT/bin
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NVCLIBROOT
   export NVXRUNTIMESETUP=true
fi
for setupfile in setup_*.sh
do
   . ./$setupfile
done
