Skip to content

Instantly share code, notes, and snippets.

@jamilbk
Last active October 28, 2022 18:07
Show Gist options
  • Save jamilbk/1dec1ce3582a7ff2a04c98f07ad3c84a to your computer and use it in GitHub Desktop.
Save jamilbk/1dec1ce3582a7ff2a04c98f07ad3c84a to your computer and use it in GitHub Desktop.
Provisioning script to compile elixir on OpenBSD 6.6
#!/usr/bin/env bash
set -xe
orig_dir=`pwd`
OTP_VER="21.3.8.14"
ELIXIR_VER="1.10.2"
export AUTOCONF_VERSION=2.69
# Set encoding
export LC_CTYPE=en_US.UTF-8
echo "export LC_CTYPE=en_US.UTF-8" >> /etc/profile
# Install required software; force non-interactive mode
pkg_add -I autoconf-${AUTOCONF_VERSION}p2 gmake
# Download and unpack OTP
prefix=OTP-$OTP_VER
wget https://github.com/erlang/otp/archive/$prefix.tar.gz
tar -zxf $prefix.tar.gz
cd otp-$prefix
# Install OTP
./otp_build autoconf
./configure
gmake
sudo gmake install
# Download and unpack Elixir
cd $orig_dir
prefix=v$ELIXIR_VER
wget https://github.com/elixir-lang/elixir/archive/$prefix.tar.gz
tar -zxf $prefix.tar.gz
cd elixir-$ELIXIR_VER
# Install Elixir
gmake clean test
# Add Elixir binaries to PATH
cwd=`pwd`
echo "export PATH=$cwd/bin:$PATH" >> /etc/profile
# Is it working?
bin/iex -h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment