Skip to content

Instantly share code, notes, and snippets.

@potatosalad
Created April 19, 2022 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potatosalad/f2d5d930627fb6d9e2ac37aba5cefb78 to your computer and use it in GitHub Desktop.
Save potatosalad/f2d5d930627fb6d9e2ac37aba5cefb78 to your computer and use it in GitHub Desktop.

Scripts for building Erlang/OTP

I have Erlang/OTP cloned into ~/local/otp and I have my PATH setup with ~/local/otp-install/bin at the front, so I can quickly test out full installs locally.

You can change the INTERESTING_TARGETS variable to point to whatever other flavors you're interested in building.

Usage

You may need to set ERL_TOP to pwd:

cd ~/local/otp
export ERL_TOP="$(pwd)"

First, build it using the "slow" script:

cd ~/local/otp
# this will run configure, boot, and release
./build-otp-slow.sh

After making changes to ERTS, stdlib, etc, you can quickly rebuild with the "fast" script (if you change configure or any of the atom.tab related codegen files, you will need to use the "slow" script again):

cd ~/local/otp
# this will only run the individual emulator builds
./build-otp-fast.sh

Finally: you can install it and use rebar3 from the installation path.

cd ~/local/otp
# this will install into ~/local/otp-install
./build-otp-install.sh
#!/usr/bin/env bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "${SCRIPT_DIR}"
export ERL_TOP="${SCRIPT_DIR}"
set -x
set -eo pipefail
make V=1 -j
INTERESTING_TARGETS=(debug)
for TYPE in ${INTERESTING_TARGETS[@]}
do
make V=1 -C "${ERL_TOP}/erts/emulator" -j "$TYPE"
done
exit 0
#!/usr/bin/env bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
INSTALL_DIR="${SCRIPT_DIR}/../otp-install"
set -x
set -eo pipefail
rm -rf "${INSTALL_DIR}"
EXTRA_PREFIX="${INSTALL_DIR}" V=1 make install
install -vm 0755 -t ${INSTALL_DIR}/usr/local/lib/erlang/erts-*/bin ${SCRIPT_DIR}/bin/x86_64-pc-linux-gnu/beam* ${SCRIPT_DIR}/bin/x86_64-pc-linux-gnu/erl_child_setup*
cd "${INSTALL_DIR}/usr/local/bin"
wget "https://s3.amazonaws.com/rebar3/rebar3"
chmod +x rebar3
exit 0
#!/usr/bin/env bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd "${SCRIPT_DIR}"
export ERL_TOP="${SCRIPT_DIR}"
set -x
set -eo pipefail
# ./otp_build update_configure --no-commit
# ./otp_build configure \
# --enable-lock-counter \
# --with-dynamic-trace=systemtap \
# --with-microstate-accounting=extra
./otp_build configure \
--with-dynamic-trace=systemtap \
--with-microstate-accounting=extra
./otp_build boot -a
./otp_build release -a
# use this if you have modified any of the preloaded modules (like erlang.erl or erts_internal.erl)
# ./otp_build update_preloaded --no-commit
INTERESTING_TARGETS=(debug)
for TYPE in ${INTERESTING_TARGETS[@]}
do
make V=1 -C "${ERL_TOP}/erts/emulator" -j "$TYPE"
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment