Last active
October 25, 2019 07:58
-
-
Save Kaylebor/b289848e2c89d68638cbe5fd402bc376 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env sh | |
#===========================================================================================# | |
# This script is a workaround for compiling Erlang with crypto below version 20 via kerl # | |
# # | |
# The need for this script came about because newer versions of OpenSSL are not # | |
# properly detected by the compiler when choosing an Erlang version under 20; # | |
# most distros have an openssl 1.0 compatibility package in their package managers, # | |
# but I have found them unreliable at best, when it comes to compiling Erlang # | |
# # | |
# The script will download the OpenSSL source code for version 1.0.2 to $HOME/openssl, # | |
# and after compiling with the appropiate flags, it will install the resulting binary # | |
# into .openssl-1.0 # | |
# # | |
# After executing the script, the environment variable KERL_CONFIGURE_OPTIONS will be # | |
# set, and its value will be output to the console. Future executions of the script will # | |
# only set the environment variable and output the same message. If for some reason # | |
# you want to recompile OpenSSL, it is enough to delete the $HOME/.openssl-1.0 folder # | |
#===========================================================================================# | |
HOME_PATH_WITHOUT_SLASH=$(echo $HOME | cut -c2-) | |
SSL_SHORT_PATH="$HOME/.openssl-1.0" | |
SSL_FULL_PATH="$SSL_SHORT_PATH/__result/$HOME_PATH_WITHOUT_SLASH/.openssl-1.0" | |
export KERL_CONFIGURE_OPTIONS="--enable-debug --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-sctp --enable-smp-support --enable-threads --enable-kernel-poll --enable-wx --with-ssl=$SSL_FULL_PATH" | |
cd $HOME | |
if [ ! -d "$HOME/openssl" ]; then | |
git clone http://github.com/openssl/openssl.git --branch OpenSSL_1_0_2-stable | |
fi | |
if [ ! -d "$SSL_SHORT_PATH" ]; then | |
cd openssl | |
./config --prefix="$SSL_SHORT_PATH" shared zlib -fPIC | |
make depend | |
make | |
make install INSTALL_PREFIX="$SSL_SHORT_PATH/__result" | |
fi | |
clear | |
echo "Now you can compile Erlang normally with kerl or asdf" | |
echo "If you need to compile Erlang again, you can rerun this script, or just run the following command:" | |
echo "export KERL_CONFIGURE_OPTIONS=\"${KERL_CONFIGURE_OPTIONS}\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment