diff --git a/recipe/build.sh b/recipe/build.sh index 280f469e..564fe054 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -6,6 +6,16 @@ export LIBRARY_PATH=${PREFIX}/lib export CMAKE_PREFIX_PATH=${PREFIX} export PATH="${PREFIX}/bin:${PATH}" +#set JULIA_DEPOT_PATH in conda env +export JULIA_DEPOT_PATH="${PREFIX}/share/julia/site:$JULIA_DEPOT_PATH" + +# 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}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh" +done # Hack to suppress building docs cat > doc/Makefile << EOF html : @@ -55,6 +65,3 @@ make -j 4 prefix=${PREFIX} MARCH=core2 sysconfigdir=${PREFIX}/etc \ TAGGED_RELEASE_BANNER="conda-forge-julia release" \ CC=$CC CXX=$CXX FC=$FC \ install - -# Configure juliarc to use conda environment -cat "${RECIPE_DIR}/juliarc.jl" >> "${PREFIX}/etc/julia/juliarc.jl" diff --git a/recipe/scripts/activate.sh b/recipe/scripts/activate.sh new file mode 100644 index 00000000..08e894ea --- /dev/null +++ b/recipe/scripts/activate.sh @@ -0,0 +1,4 @@ +export JULIA_DEPOT_PATH_BACKUP=${JULIA_DEPOT_PATH:-} +export JULIA_PROJECT_BACKUP=${JULIA_PROJECT:-} +export JULIA_DEPOT_PATH="$CONDA_PREFIX/share/julia/site:$JULIA_DEPOT_PATH" +export JULIA_PROJECT="$CONDA_PREFIX/share/julia/site/environments/$CONDA_DEFAULT_ENV" \ No newline at end of file diff --git a/recipe/scripts/deactivate.sh b/recipe/scripts/deactivate.sh new file mode 100644 index 00000000..6067c2bb --- /dev/null +++ b/recipe/scripts/deactivate.sh @@ -0,0 +1,11 @@ +export JULIA_DEPOT_PATH=$JULIA_DEPOT_PATH_BACKUP +export JULIA_PROJECT=$JULIA_PROJECT_BACKUP +unset JULIA_DEPOT_PATH_BACKUP +unset JULIA_PROJECT_BACKUP + +if [ -z $JULIA_DEPOT_PATH ]; then + unset JULIA_DEPOT_PATH +fi +if [ -z $JULIA_PROJECT ]; then + unset JULIA_PROJECT +fi