Skip to content

Commit

Permalink
build files for julia
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson541 committed Jan 22, 2023
1 parent d619eaf commit 466b710
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
108 changes: 108 additions & 0 deletions julia/build.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions julia/meta.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 466b710

Please sign in to comment.