#!/bin/sh
/bin/ln -sF /Library/Frameworks/CsoundLib64.framework/Resources/Java/lib_jcsound6.jnilib /Library/Java/Extensions/lib_jcsound6.jnilib
/bin/ln -sF /Library/Frameworks/CsoundLib64.framework/Resources/Java/csnd6.jar /Library/Java/Extensions/csnd6.jar
/bin/ln -sF /Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib /usr/local/lib/libcsnd.6.0.dylib
/bin/ln -sF /Library/Frameworks/CsoundLib64.framework/Versions/6.0/libcsnd6.6.0.dylib /usr/local/lib/libcsnd6.6.0.dylib

PY_SRC_DIR="/Library/Frameworks/CsoundLib64.framework/Resources/Python/Current"

PYTHON_DIR="/Library/Python/2.7/site-packages"
if [ -d "$PYTHON_DIR" ]; then
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON_DIR
else
  mkdir -p $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON_DIR
fi

PYTHON3_DIR="/Library/Python/3.6/site-packages"
if [ -d "$PYTHON3_DIR" ]; then
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON3_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON3_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON3_DIR
else
  mkdir -p $PYTHON3_DIR
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON3_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON3_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON3_DIR
fi


PYTHON_DIR="/Library/Python/2.6/site-packages"
if [ -d "$PYTHON_DIR" ]; then
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON_DIR
fi

PYTHON_DIR="/Library/Python/2.5/site-packages"
if [ -d "$PYTHON_DIR" ]; then
  /bin/ln -sF $PY_SRC_DIR/_csnd6.so $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/csnd6.py $PYTHON_DIR
  /bin/ln -sF $PY_SRC_DIR/ctcsound.py $PYTHON_DIR
fi
