From 466b710f0dded0f83bd596bf498374461a3668d3 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Sat, 21 Jan 2023 20:09:38 -0800 Subject: [PATCH] build files for julia --- julia/build.sh | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ julia/meta.yaml | 16 +++++++ 2 files changed, 124 insertions(+) create mode 100644 julia/build.sh create mode 100644 julia/meta.yaml diff --git a/julia/build.sh b/julia/build.sh new file mode 100644 index 0000000..9d24efd --- /dev/null +++ b/julia/build.sh @@ -0,0 +1,108 @@ +#!/bin/sh + +#make julia directory +mkdir -p ${PREFIX}/share/julia/site +mkdir -p ${PREFIX}/bin +#set JULIA_DEPOT_PATH in conda env +export JULIA_DEPOT_PATH="${PREFIX}/share/julia/site" +ACTIVATE_ENV="${PREFIX}/etc/conda/activate.d/env_vars.sh" +DEACTIVATE_ENV="${PREFIX}/etc/conda/deactivate.d/env_vars.sh" + +if [ -f "$ACTIVATE_ENV" ]; then + echo "export JULIA_DEPOT_PATH=\"${PREFIX}/share/julia/site\"" >> $ACTIVATE_ENV + echo "export JULIA_OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $ACTIVATE_ENV + echo "export LD_LIBRARY_PATH=\"${PREFIX}/lib\"" >> $ACTIVATE_ENV +else + mkdir -p ${PREFIX}/etc/conda/activate.d + touch ${PREFIX}/etc/conda/activate.d/env_vars.sh + echo '#!/bin/sh' >> $ACTIVATE_ENV + echo "export JULIA_DEPOT_PATH=\"${PREFIX}/share/julia/site\"" >> $ACTIVATE_ENV + echo "export JULIA_OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $ACTIVATE_ENV + echo "export LD_LIBRARY_PATH=\"${PREFIX}/lib\"" >> $ACTIVATE_ENV +fi +if [ -f "$DEACTIVATE_ENV" ]; then + echo "unset JULIA_DEPOT_PATH" >> $DEACTIVATE_ENV + echo "export LD_LIBRARY_PATH=$JULIA_OLD_LD_LIBRARY_PATH" >> $DEACTIVATE_ENV + echo "unset JULIA_OLD_LD_LIBRARY_PATH" >> $DEACTIVATE_ENV +else + mkdir -p ${PREFIX}/etc/conda/deactivate.d + touch ${PREFIX}/etc/conda/deactivate.d/env_vars.sh + echo '#!/bin/sh' >> $DEACTIVATE_ENV + echo "unset JULIA_DEPOT_PATH" >> $DEACTIVATE_ENV + echo "export LD_LIBRARY_PATH=$JULIA_OLD_LD_LIBRARY_PATH" >> $DEACTIVATE_ENV + echo "unset JULIA_OLD_LD_LIBRARY_PATH" >> $DEACTIVATE_ENV +fi + +#Modified from the Julia developers' julia-install.sh script +set -e +VERSION="1.6.7" + +case "$VERSION" in + nightly) + BASEURL="https://julialangnightlies-s3.julialang.org/bin" + JULIANAME="julia-latest" + ;; + [0-9]*.[0-9]*.[0-9]*) + BASEURL="https://julialang-s3.julialang.org/bin" + SHORTVERSION="$(echo "$VERSION" | grep -Eo '^[0-9]+\.[0-9]+')" + JULIANAME="$SHORTVERSION/julia-$VERSION" + ;; + [0-9]*.[0-9]) + BASEURL="https://julialang-s3.julialang.org/bin" + SHORTVERSION="$(echo "$VERSION" | grep -Eo '^[0-9]+\.[0-9]+')" + JULIANAME="$SHORTVERSION/julia-$VERSION-latest" + ;; + *) + echo "Unrecognized VERSION=$VERSION, exiting" + exit 1 + ;; +esac + +case $(uname) in + Linux) + case $(uname -m) in + x86_64) + ARCH="x64" + case "$JULIANAME" in + julia-latest) + SUFFIX="linux64" + ;; + *) + SUFFIX="linux-x86_64" + ;; + esac + ;; + i386 | i486 | i586 | i686) + ARCH="x86" + case "$JULIANAME" in + julia-latest) + SUFFIX="linux32" + ;; + *) + SUFFIX="linux-i686" + ;; + esac + ;; + *) + echo "Do not have Julia binaries for this architecture, exiting" + exit 1 + ;; + esac + echo "$BASEURL/linux/$ARCH/$JULIANAME-$SUFFIX.tar.gz" + cd ${PREFIX}/share/julia/site + curl -L "$BASEURL/linux/$ARCH/$JULIANAME-$SUFFIX.tar.gz" | tar -xzs + ln -s $PWD/julia-*/bin/julia ${PREFIX}/bin/julia + cd ${PREFIX} + ;; + Darwin) + curl -Lo julia.dmg "$BASEURL/mac/x64/$JULIANAME-mac64.dmg" + hdiutil mount -mountpoint /Volumes/Julia julia.dmg + cp -Ra /Volumes/Julia/*.app/Contents/Resources/julia ${PREFIX}/share/julia/site + ln -s ${PREFIX}/share/julia/site/julia/bin/julia ${PREFIX}/bin/julia + # TODO: clean up after self? + ;; + *) + echo "Do not have Julia binaries for this platform, exiting" + exit 1 + ;; +esac diff --git a/julia/meta.yaml b/julia/meta.yaml new file mode 100644 index 0000000..75b5d71 --- /dev/null +++ b/julia/meta.yaml @@ -0,0 +1,16 @@ +# This file created by conda-build 3.19.2 +# meta.yaml template originally from: +# /Users/runner/runners/2.166.4/work/1/s/recipe, last modified Mon Apr 27 16:06:50 2020 +# ------------------------------------------------ + +package: + name: julia + version: 1.6.7 +build: + number: '1' + string: rmg_1 +about: + summary: julia from julialang +extra: + recipe-maintainers: + - mjohnson541