Commit dfa5e37b authored by Guillaume Pasero's avatar Guillaume Pasero

PKG: try to improve deployment scripts

parent 7e556eba
......@@ -20,6 +20,17 @@
#
set -e
# verify basic tools are here
which 2>/dev/null || ret=$?
if [ ! $ret -eq 0 ] ; then echo "ERROR: Missing tool 'which'"; exit 1 ; fi
for tool in dirname find file grep cut sed chmod cat readlink ; do
if [ -z "$(which $tool)" ] ; then
echo "ERROR: Missing tool '${tool}'"
echo "Please install it and make sure it can be found from PATH"
exit 1;
fi
done
DIRNAME_0=$(dirname "$0")
cd "$DIRNAME_0"
......@@ -32,20 +43,16 @@ PATCH_ELF_EXE="$OUT_DIR/patchelf"
#do not move below block. it must be before "unset LD_LIBRARY_PATH" code
#check if we have any python bindings
OTB_PYTHON_LIB_PATH=
if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then
sed -i "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh"
chmod +x $OUT_DIR/setup_python.sh
. ./setup_python.sh
OTB_PYTHON_LIB_PATH=$OUT_DIR/lib/python
./setup_python.sh || setup_python_ret=$?
fi
# No no interference with LD_LIBRARY_PATH
unset LD_LIBRARY_PATH
#RK: We cannot avoid -maxdepth 1 option in find command below because,
# there are files in $OUT_DIR/lib/gtk which we CANNOT add new rpath
BINARY_FILES=$(find $OTB_PYTHON_LIB_PATH $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':')
# we remove files in $OUT_DIR/lib/gtk which we CANNOT add new rpath
BINARY_FILES=$(find $OUT_DIR/lib $OUT_DIR/bin -type f -exec file {} \; | grep -v '/lib/gtk/' | grep -i elf|cut -f1 -d':')
# run patchelf
for bin_file in $BINARY_FILES; do
#echo "adding rpath to $bin_file"
......
......@@ -20,6 +20,17 @@
#
set -e
# verify basic tools are here (install_name_tool is specific macOS)
which 2>/dev/null || ret=$?
if [ ! $ret -eq 0 ] ; then echo "ERROR: Missing tool 'which'"; exit 1 ; fi
for tool in dirname find file grep cut sed chmod cat readlink install_name_tool ; do
if [ -z "$(which $tool)" ] ; then
echo "ERROR: Missing tool '${tool}'"
echo "Please install it and make sure it can be found from PATH"
exit 1;
fi
done
DIRNAME_0=$(dirname "$0")
cd "$DIRNAME_0" || exit 1
......@@ -29,16 +40,9 @@ cd "$DIRNAME_0" || exit 1
OUT_DIR=$(pwd)
#do not move below 3 lines. it must be before "unset LD_LIBRARY_PATH" code
sed -i "" "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh"
chmod +x $OUT_DIR/setup_python.sh
./setup_python.sh
# find install_name_tool
INSTALL_NAME_TOOL=$(which install_name_tool)
if [ -z "$INSTALL_NAME_TOOL" ]; then
echo "install_name_tool does not exists.."
echo "please install install_name_tool and make sure it can be found from PATH"
exit 1;
if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then
chmod +x $OUT_DIR/setup_python.sh
./setup_python.sh || setup_python_ret=$?
fi
# no interference with DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH
......
......@@ -19,11 +19,20 @@
# limitations under the License.
#
# get current working dir (this should be the install directory)
CWD=$(pwd)
# Setup python environment
if [ ! -f "$OTB_PYTHON_EXE" ] ; then
OTB_PYTHON_EXE=$(which python)
fi
if [ ! -f "$OTB_PYTHON_EXE" ] ; then
printf %s\\n "*****Error occurred during installation******"
printf %s\\n "Python executable not found"
exit 1
fi
python_major_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[0])")
python_minor_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[1])")
python_patch_version=$($OTB_PYTHON_EXE -c "import sys;print(sys.version_info[2])")
......@@ -35,6 +44,7 @@ python_check_failed() {
printf %s\\n "If you have python2.6 or Python2.7 installed in your system "
printf %s\\n "You should set OTB_PYTHON_EXE and re-run this installation script."
printf %s\\n "eg: OTB_PYTHON_EXE=/path/to/python2.7 ./OTB-X.Y-Linux64.run"
exit 1
}
if [ "$python_major_version" -gt 2 ]; then
python_check_failed
......@@ -70,11 +80,12 @@ if [ "$found_python_lib" -eq "1" ]; then
printf %s\\n "numpy not installed with '$OTB_PYTHON_EXE'"
printf %s\\n "Check failed with result:"
printf %s\\n "$numpy_import_result"
exit 1
else
printf %s\\n "OTB python bindings will be configured for $OTB_PYTHON_EXE ( version: $python_version )"
printf %s\\n "Found python library: $python_lib_file_path"
fi
#ln -sf "$python_lib_file_path" "OUT_DIR/lib/$python_INSTALLED_SONAME"
#ln -sf "$python_lib_file_path" "$CWD/lib/$python_INSTALLED_SONAME"
else
printf %s\\n "*****Error occurred during installation******"
printf %s\\n "Python interpreter detected is : $OTB_PYTHON_EXE ( version: $python_version )"
......@@ -82,5 +93,6 @@ else
printf %s\\n "We had searched following directories $python_lib_dirs"
printf %s\\n "If you don't have python-dev package installed, install it and make a symlink"
printf %s\\n "If you don't have python headers and so installed on a custom location, then make a symlink"
printf %s\\n "eg: ln -s /usr/lib/x86_64-linux-gnu/$python_INSTSONAME OUT_DIR/lib/$python_INSTSONAME"
printf %s\\n "eg: ln -s /usr/lib/x86_64-linux-gnu/$python_INSTSONAME $CWD/lib/$python_INSTSONAME"
exit 1
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment