forked from sighthoundinc/SighthoundVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupEnvironment
executable file
·154 lines (138 loc) · 5.14 KB
/
setupEnvironment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
#*****************************************************************************
#
# setupEnvironment
# Setting up environment variables when running in dev environment,
# or during build process.
#
#
#
#*****************************************************************************
#
#
# Copyright 2013-2022 Sighthound, Inc.
#
# Licensed under the GNU GPLv3 license found at
# https://www.gnu.org/licenses/gpl-3.0.txt
#
# Alternative licensing available from Sighthound, Inc.
# by emailing [email protected]
#
# This file is part of the Sighthound Video project which can be found at
# https://github.com/sighthoundinc/SighthoundVideo
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; using version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
#
#
#*****************************************************************************
#
# Shell script to setup the environment for SmartVideo.
# This is intended to be sourced by other scripts, since that's the only way
# that it can modify the caller's environment. In other words, run with
# source setupEnvironment
#
# Things that this script does
# * Modify path-like variables (PATH, PYTHONPATH, DYLD_XXX_PATH) to point to
# our libraries.
# * Create a few environment variables describing where certain libraries are,
# in case other people need to find them.
#
# Conventions:
# * Variables starting with _se_ should be considered private to this Makefile.
# If you need them elsewhere, rename them (PLEASE!)
# * When you see DIR, that will be a Windows dir on Windows ("C:\..."). When
# you see UNIXDIR, that will always be a unix dir ("/cygdrive/c/..."). On
# Mac, these should always be the same.
# Only execute this file once...
if [ -z "$_se_ALREADYRAN" ]; then
export _se_ALREADYRAN=1
# Get this path (absolute!)
_se_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "=================================================================== Running setupEnvironment in ${_se_SCRIPTDIR}"
export SMARTVIDEO_UNIXDIR=$_se_SCRIPTDIR
export SMARTVIDEO_SRCDIR=$_se_SCRIPTDIR
echo "Params passed $@, params count $#"
while [[ $# > 0 ]]
do
param="$1"
case $param in
-srcdir|--srcdir)
shift
if [[ $# -eq 0 ]]; then
"Source directory parameter missing"
exit 1
fi
export SMARTVIDEO_SRCDIR=$1
shift # past argument
;;
*)
break
;;
esac
done
# PLATFORM-SPECIFIC DEFINES
# -------------------------
# With these, we can make the rest of the makefile generic.
echo `which python`
export SVARCH="x86_64"
if [ `uname` = "Darwin" ]; then
_se_PLATFORM="Mac"
_se_PATHSEP=":"
_se_SHARED_LIB_FOLDER="lib"
export SMARTVIDEODIR=$_se_SCRIPTDIR
_se_ROOT_TMP=$_se_SCRIPTDIR
else
_se_PLATFORM="Win"
_se_PATHSEP=";"
_se_SHARED_LIB_FOLDER="bin"
_se_ROOT_TMP="${TMP}"
export SMARTVIDEODIR=`cygpath -w $_se_SCRIPTDIR`
fi
# If we're in the middle of obfuscating, we have to place certain libraries
# that we don't want to obfuscate one level up...
if [ -z "$OBS" ]; then
_se_LIBDIR="$SMARTVIDEODIR"
_se_LIB_UNIXDIR="$SMARTVIDEO_UNIXDIR"
else
_se_LIBDIR="$SMARTVIDEODIR""/.."
_se_LIB_UNIXDIR="$SMARTVIDEO_UNIXDIR""/.."
fi
# Find libraries that we need the native path for...
export XNATDIR="$_se_LIBDIR""/xnat"
export LAUNCHDIR="$_se_LIBDIR""/launch"
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
if [ `uname` = "Darwin" ]; then
PYMODULES_DIR1=${SV3RDPARTYDIR}/lib/python2.7/site-packages
else
PYMODULES_DIR1=`cygpath -w ${SV3RDPARTYDIR}/lib/python2.7/site-packages`
fi
# Setup PYTHONPATH to include anything we need. Since python is the
# Win32 version of python, we need to use native dirs/path separators.
# PYTHONPATH=
echo PYTHONPATH=$PYTHONPATH
echo SVINSTALLDIR=$SVINSTALLDIR
echo SV3RDPARTYDIR=$SV3RDPARTYDIR
python -c 'import sys; print sys.path'
PYTHONPATH="${PYTHONPATH}${_se_PATHSEP}${SMARTVIDEODIR}"
PYTHONPATH="${PYTHONPATH}${_se_PATHSEP}${XNATDIR}"
PYTHONPATH="${PYTHONPATH}${_se_PATHSEP}${LAUNCHDIR}"
PYTHONPATH="${PYTHONPATH}${_se_PATHSEP}${PYMODULES_DIR1}"
echo "PYTHONPATH=${PYTHONPATH}"
export PYTHONPATH
echo "PATH=${PATH}"
echo "Python=`which python`"
echo "=================================================================== Done running setupEnvironment"
else
echo "Environment is already set up!"
fi