-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Will use existing kerl from
$PATH
(like installed by Homebrew) or…
… fetch specific version when setting `ASDF_KERL_VERSION`. * Will use git to clone `kerl` quitly and checkout versioned tags instead of downloading from Github CDN. * Enable shell docs out of the box by default and allow opt out using KERL_BUILD_DOCS="no" - technically any value will opt out, kerl just checks if it's set, and not its value. Since we're opting in by default, we will check != "yes" for opt out. * Will come with out of the box settings for `KERL_CONFIGURE_OPTIONS` with additional settings for macOS that matches `Homebrew` * --disable-debug * --disable-silent-rules * --enable-dynamic-ssl-lib * --enable-hipe * --enable-sctp * --enable-shared-zlib * --enable-smp-support * --enable-threads * --enable-wx * --without-javac * macOS only: * --with-ssl=$(brew --prefix openssl) * --enable-darwin-64bit * --enable-kernel-poll * --with-dynamic-trace=dtrace * macOS only: Unless custom `KERL_CONFIGURE_OPTIONS`, asdf-erlang will default to using Homebrew for following dependencies: - autoconf - libtool - openssl - wxmac This will allow `asdf-erlang` & `asdf-elixir` to be used out of the box and be much easier for majority of macOS users. Avoiding using esotoric configuration and environment variables to keep track for various plugins should be a focus. Allowing someone to just put a plugin in, and pick a verison without sifting through massive documentation and configuration is beneficial.
- Loading branch information
Showing
5 changed files
with
141 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
KERL_VERSION="${ASDF_KERL_VERSION:-2.1.0}" | ||
|
||
|
||
echoerr() { | ||
>&2 echo -e "\033[0;31m$1\033[0m" | ||
} | ||
|
||
ensure_kerl_setup() { | ||
export KERL_BASE_DIR="$(kerl_dir)" | ||
export KERL_CONFIG="$(kerl_dir)/kerlrc" | ||
#export KERL_BUILD_BACKEND="git" | ||
ensure_kerl_installed | ||
} | ||
|
||
ensure_kerl_installed() { | ||
# If kerl exists | ||
if [ -x "$(kerl_path)" ]; then | ||
# But was passed an expected version | ||
if [ -n "${ASDF_KERL_VERSION:-}" ]; then | ||
current_kerl_version="$("$(kerl_path)" version)" | ||
# Check if expected version matches current version | ||
if [ "$current_kerl_version" != "$KERL_VERSION" ]; then | ||
# If not, reinstall with ASDF_KERL_VERSION | ||
download_kerl | ||
fi | ||
fi | ||
else | ||
# kerl does not exist, so install using default value in KERL_VERSION | ||
download_kerl | ||
fi | ||
} | ||
|
||
|
||
|
||
download_kerl() { | ||
# Remove directory in case it still exists from last download | ||
rm -rf "$(kerl_source_dir)" | ||
rm -rf "$(kerl_dir)" | ||
|
||
# Print to stderr so asdf doesn't assume this string is a list of versions | ||
echoerr "Downloading kerl $KERL_INSTALL_VERSION" | ||
|
||
# Clone down and checkout the correct kerl version | ||
git clone https://github.com/kerl/kerl.git "$(kerl_source_dir)" --quiet | ||
(cd "$(kerl_source_dir)"; git checkout $KERL_INSTALL_VERSION --quiet;) | ||
|
||
mkdir -p "$(kerl_dir)/bin" | ||
mv "$(kerl_source_dir)/kerl" "$(kerl_path)" | ||
chmod +x "$(kerl_path)" | ||
|
||
rm -rf "$(kerl_source_dir)" | ||
} | ||
|
||
asdf_erlang_plugin_path() { | ||
echo "$(dirname "$(dirname "$0")")" | ||
} | ||
|
||
kerl_dir() { | ||
echo "$(asdf_erlang_plugin_path)/kerl" | ||
} | ||
|
||
kerl_source_dir() { | ||
echo "$(asdf_erlang_plugin_path)/kerl-install-source" | ||
} | ||
|
||
|
||
kerl_path() { | ||
#Check if kerl exists without an expected version | ||
if [ -x "$(command -v kerl)" ] && [ -z "${ASDF_KERL_VERSION:-}" ]; then | ||
echo "$(command -v kerl)" | ||
else | ||
echo "$(kerl_dir)/bin/kerl" | ||
fi | ||
} |