#!/bin/bash

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
    mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
    cp "${RECIPE_DIR}/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
done

mkdir -p $PREFIX/share/intel_optimization_for_horovod/lib
mkdir -p $PREFIX/share/intel_optimization_for_horovod/env
cp $RECIPE_DIR/libccl.so* $PREFIX/share/intel_optimization_for_horovod/lib/
cp $RECIPE_DIR/libccl.a $PREFIX/share/intel_optimization_for_horovod/lib/
cp -r $RECIPE_DIR/ccl $PREFIX/share/intel_optimization_for_horovod/lib/
cp $RECIPE_DIR/libmpi*.so* $PREFIX/share/intel_optimization_for_horovod/lib/
cp $RECIPE_DIR/*vars.sh $PREFIX/share/intel_optimization_for_horovod/env/

whl_file="$bin_folder_path/intel_optimization_for_horovod-0.28.1.4-cp39-cp39-linux_x86_64.whl"
pip install --no-deps $whl_file
