Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 54a37faa authored by hhakim's avatar hhakim
Browse files

Set macOS pkg post-install scripts more verbose.

parent 8a151848
Branches
Tags
No related merge requests found
#!/bin/bash
echo "$0 -- FAµST Matlab wrapper post-install script START" | tee -a /tmp/log_faust_install
function inject_matlab_code_to_update_path
{
# each line must contains the word faust (for filtering of old install lines)
......@@ -61,7 +63,9 @@ then
echo "MATLAB_ROOT=${MATLAB_ROOT}" | tee -a /tmp/log_faust_install >&2
echo "MATLAB_BIN=${MATLAB_BIN}" | tee -a /tmp/log_faust_install >&2
else
echo "MATLAB_ROOT=$MATLAB_ROOT" | tee -a /tmp/log_faust_install
MATLAB_BIN="${MATLAB_ROOT}/bin/matlab"
echo "MATLAB_BIN=$MATLAB_BIN" | tee -a /tmp/log_faust_install
# set path in system startup script
STARTUP_DIR="${MATLAB_ROOT}/toolbox/local/"
STARTUP_FILE=${STARTUP_DIR}/startup.m
......@@ -69,9 +73,13 @@ else
[[ -r "$STARTUP_FILE" ]] && (grep -i -v faust "$STARTUP_FILE" > "${STARTUP_FILE}.tmp"; mv "${STARTUP_FILE}.tmp" "$STARTUP_FILE")
FAUST_MATLAB_WRAPPER_PATH="@CMAKE_INSTALL_MATLAB_PREFIX@"
#echo "addpath(genpath('"$FAUST_MATLAB_WRAPPER_PATH"'))" >> "$STARTUP_FILE"
echo "MATLABRC=$MATLABRC" | tee -a /tmp/log_faust_install
echo "STARTUP_FILE=$STARTUP_FILE" | tee -a /tmp/log_faust_install
inject_matlab_code_to_update_path $STARTUP_FILE
# add a line to force startup execution into matlabrc
# except if the line is already in the file
[[ -r "$MATLABRC" ]] && grep -q "$MATLABRC_RUN_STARTUP_CMD" "$MATLABRC" || (echo "$MATLABRC_RUN_STARTUP_CMD" >> $MATLABRC)
# inject_matlab_code_to_update_user_paths # disabled because it's too intrusive and maybe redundant
fi
echo "$0 -- FAµST Matlab wrapper post-install script END" | tee -a /tmp/log_faust_install
#!/bin/bash
echo "$0 -- FAµST doc launcher post-install script START" | tee -a /tmp/log_faust_install
[[ -r "@CMAKE_INSTALL_PREFIX@/doc/html/index.html" ]] && open @CMAKE_INSTALL_PREFIX@/doc/html/index.html
echo "$0 -- FAµST doc launcher post-install script END" | tee -a /tmp/log_faust_install
#!/bin/bash
echo "$0 -- FAµST python wrapper post-install script START" | tee -a /tmp/log_faust_install
uid=$(id -u)
[[ ! "$uid" = 0 ]] && echo "Error: need to be root." >&2 && exit 1 # not needed, we're supposed to be root at installation time
[[ ! "$uid" = 0 ]] && echo "Error: need to be root." >&2 | tee -a /tmp/log_faust_install >&2 && exit 1 # not needed, we're supposed to be root at installation time
[[ -n "$1" && -d "$1" ]] && FAUST_PY_WRAPPER_PATH="$1" || FAUST_PY_WRAPPER_PATH="@CMAKE_INSTALL_PYTHON_PREFIX@"
[[ -z "$FAUST_PY_WRAPPER_PATH" ]] && echo "USAGE: $0 <path>" && exit 2 # shouldn't happen with cmake
[[ ! -d "$FAUST_PY_WRAPPER_PATH" ]] && echo "ERROR: directory $FAUST_PY_WRAPPER_PATH doesn't exist" && exit 3 # shouldn't happen with cmake
[[ -z "$FAUST_PY_WRAPPER_PATH" ]] && echo "USAGE: $0 <path>" | tee -a /tmp/log_faust_install >&2 && exit 2 # shouldn't happen with cmake
[[ ! -d "$FAUST_PY_WRAPPER_PATH" ]] && echo "ERROR: directory $FAUST_PY_WRAPPER_PATH doesn't exist" | tee -a /tmp/log_faust_install >&2 && exit 3 # shouldn't happen with cmake
function link_py_files(){
PYTHON=$1
[[ -n "$DEBUG" ]] && echo PYTHON=$PYTHON
DEBUG=1
[[ -n "$DEBUG" ]] && echo PYTHON=$PYTHON | tee -a /tmp/log_faust_install
[[ -d "$PYTHON" ]] && return
PY_MAJOR_MINOR_VER=$($PYTHON --version 2>&1 | sed -e 's/.*[[:blank:]]\{1,\}\([[:digit:]]\.[[:digit:]]\)\.[[:digit:]]\{1,\}/\1/')
PY_SITE_PACKAGES_PATH=$($PYTHON -c 'import os,site,re;print([path for path in site.getsitepackages() if re.match(".*"+os.path.sep+"site-packages$", path) and os.path.exists(path) ][0])')
[[ ! -d "${PY_SITE_PACKAGES_PATH}" ]] && return
[[ -n "$DEBUG" ]] && echo PY_SITE_PACKAGES_PATH=${PY_SITE_PACKAGES_PATH}
[[ -n "$DEBUG" ]] && echo PY_SITE_PACKAGES_PATH=${PY_SITE_PACKAGES_PATH} | tee -a /tmp/log_faust_install
PYFILES=${FAUST_PY_WRAPPER_PATH}/pyfaust
[[ "$PY_MAJOR_MINOR_VER" = 3* ]] && PYFILES+=" ${FAUST_PY_WRAPPER_PATH}/_FaustCorePy.cpython-3*so" || \
PYFILES+=" ${FAUST_PY_WRAPPER_PATH}/_FaustCorePy.so"
for PYFILE in $PYFILES
do
[[ -n "$DEBUG" ]] && echo ln -sf "$PYFILE" "${PY_SITE_PACKAGES_PATH}/"
[[ -n "$DEBUG" ]] && echo ln -sf "$PYFILE" "${PY_SITE_PACKAGES_PATH}/" | tee -a /tmp/log_faust_install
[[ -r "$PYFILE" ]] && ln -sf "$PYFILE" "${PY_SITE_PACKAGES_PATH}/"
done && echo "Linked py wrapper version $PY_MAJOR_MINOR_VER into ${PY_SITE_PACKAGES_PATH}."
done && echo "Linked py wrapper version $PY_MAJOR_MINOR_VER into ${PY_SITE_PACKAGES_PATH}." | tee -a /tmp/log_faust_install
}
......@@ -32,9 +35,11 @@ for DIR in /usr/local /opt/local
do
for FILE in $(find $DIR -type l -name "python*") $(find $DIR -type f -name "python*")
do
echo "PYTHON found: $file" | tee -a /tmp/log_faust_install
[[ -x "$FILE" ]] && link_py_files "$FILE"
done
done
echo "$0 -- FAµST python wrapper post-install script END" | tee -a /tmp/log_faust_install
echo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment