diff options
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | kerl | 132 |
2 files changed, 133 insertions, 10 deletions
@@ -284,7 +284,7 @@ Acceptable value: any github fork of OTP, e.g. `https://github.com/basho/otp` ### KERL_INSTALL_MANPAGES ### KERL_INSTALL_HTMLDOCS -If `$KERL_BUILD_DOCS` is set, kerl will create docs from the built erlang version regardless of origin (`tarball` backend from erlang.org or via `kerl build git`, or bia `git` backend). +If `$KERL_BUILD_DOCS` is set, kerl will create docs from the built erlang version regardless of origin (`tarball` backend from erlang.org or via `kerl build git`, or via `git` backend). If `$KERL_BUILD_DOCS` is unset, kerl will only install docs when NOT installing a build created via `kerl build git...`, and according to `KERL_INSTALL_HTMLDOCS` and `KERL_INSTALL_MANPAGES`. @@ -404,7 +404,8 @@ Creates a named build either from an official Erlang/OTP release or from a git r You can specify the configure options to use when building Erlang/OTP with the `KERL_CONFIGURE_OPTIONS` variable, either in your $HOME/.kerlrc file or -prepending it to the command line. +prepending it to the command line. Full list of all options can be in +[Erlang documentation](http://erlang.org/doc/installation_guide/INSTALL.html#Advanced-configuration-and-build-of-ErlangOTP_Configuring). $ KERL_CONFIGURE_OPTIONS=--enable-hipe kerl build 19.2 19.2-hipe @@ -630,6 +631,12 @@ will honor that instead, and will not do any automatic configuration. Changelog --------- +2 October 2017 - 1.6.0 + + - Support clang 9 and High Sierra command-line tools (CLT) on older Erlang + builds. (#234) + - Fix a pointer error on clang 9 (#235) + 25 May 2017 - 1.5.1 - Bug Fix: Remove spurious spaces (#209) @@ -24,7 +24,7 @@ unset ERL_TOP -KERL_VERSION="1.5.1" +KERL_VERSION="1.6.0" #Grep fix for mac pcre errors GREP_OPTIONS='' @@ -179,6 +179,7 @@ usage() echo " update Update the list of available releases from your source provider" echo " list List releases, builds and installations" echo " delete Delete builds and installations" + echo " path Print the path of a given installation" echo " active Print the path of the active installation" echo " plt Print Dialyzer PLT path for the active installation" echo " status Print available builds and installations" @@ -499,9 +500,15 @@ maybe_patch_all() maybe_patch_darwin() { + # Reminder: $1 = OTP release version if [ "$1" -le 14 ]; then CFLAGS="-DERTS_DO_INCL_GLB_INLINE_FUNC_DEF" apply_darwin_compiler_patch >> "$LOGFILE" + elif [ "$1" -eq 16 ]; then + # TODO: Maybe check if clang version == 9 + apply_r16_wx_ptr_patch >> "$LOGFILE" + elif [ "$1" -ge 17 -a "$1" -le 19 ]; then + apply_wx_ptr_patch >> "$LOGFILE" fi } @@ -537,6 +544,42 @@ do_normal_build() list_add builds "$1,$2" } +_flags() +{ + + # We need to munge the LD and DED flags for clang 9 shipped with + # High Sierra (macOS 10.13) + case "$KERL_SYSTEM" in + Darwin) + osver=$(uname -r) + case "$osver" in + 17*) + # Make sure we don't overwrite values that someone who + # knows better than us set. + if [ -z "$DED_LD" ]; then + DED_LD="clang" + fi + if [ -z "$CC" ]; then + CC="clang" + fi + if [ -z "$DED_LDFLAGS" ]; then + host=$(./erts/autoconf/config.guess) + DED_LDFLAGS="-m64 -bundle -bundle_loader ${ERL_TOP}/bin/$host/beam.smp" + fi + CFLAGS="$CFLAGS" DED_LD="$DED_LD" CC="$CC" DED_LDFLAGS="$DED_LDFLAGS" $@ + ;; + *) + CFLAGS="$CFLAGS" $@ + ;; + esac + ;; + *) + CFLAGS="$CFLAGS" $@ + ;; + esac + +} + _do_build() { case "$KERL_SYSTEM" in @@ -553,7 +596,7 @@ _do_build() fi case "$OSVERSION" in - 16*|15*) + 17*|16*|15*) echo -n $KERL_CONFIGURE_OPTIONS | grep "ssl" 1>/dev/null 2>&1 # Reminder to self: 0 from grep means the string was detected if [ $? -ne 0 ]; then @@ -621,15 +664,15 @@ _do_build() fi if [ -n "$KERL_USE_AUTOCONF" ]; then ./otp_build autoconf $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 && \ - CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 + _flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 else - CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 + _flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 fi echo -n $KERL_CONFIGURE_OPTIONS | grep "--enable-native-libs" 1>/dev/null 2>&1 if [ $? -ne 0 ]; then make clean >> "$LOGFILE" 2>&1 - CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 + _flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 fi if [ $? -ne 0 ]; then show_logfile "Configure failed." "$LOGFILE" @@ -664,7 +707,7 @@ _do_build() done fi - CFLAGS="$CFLAGS" ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 + _flags ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 if [ $? -ne 0 ]; then show_logfile "Build failed." "$LOGFILE" list_remove builds "$1 $2" @@ -943,8 +986,23 @@ ACTIVATE_CSH build_plt "$absdir" fi + PID=$$ + PARENT_PID=$(ps -p $PID -o ppid | grep -E "[0-9]+" -o) + PARENT_CMD=$(ps -p $PARENT_PID -o ucomm | tail -n 1) + case "$PARENT_CMD" in + fish) + SHELL_SUFFIX=".fish" + ;; + csh) + SHELL_SUFFIX=".csh" + ;; + *) + SHELL_SUFFIX="" + ;; + esac + echo "You can activate this installation running the following command:" - echo ". $absdir/activate" + echo ". ${absdir}/activate${SHELL_SUFFIX}" echo "Later on, you can leave the installation typing:" echo "kerl_deactivate" } @@ -1489,6 +1547,63 @@ apply_r15_beam_makeops_patch() _END_PATCH } +#https://github.com/erlang/otp/commit/a64c4d806fa54848c35632114585ad82b98712e8.diff +apply_wx_ptr_patch() +{ + patch -p1 <<'_END_PATCH' +diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp +index 0d2da5d4a79..8118136d30e 100644 +--- a/lib/wx/c_src/wxe_impl.cpp ++++ b/lib/wx/c_src/wxe_impl.cpp +@@ -666,7 +666,7 @@ void * WxeApp::getPtr(char * bp, wxeMemEnv *memenv) { + throw wxe_badarg(index); + } + void * temp = memenv->ref2ptr[index]; +- if((index < memenv->next) && ((index == 0) || (temp > NULL))) ++ if((index < memenv->next) && ((index == 0) || (temp != (void *)NULL))) + return temp; + else { + throw wxe_badarg(index); +@@ -678,7 +678,7 @@ void WxeApp::registerPid(char * bp, ErlDrvTermData pid, wxeMemEnv * memenv) { + if(!memenv) + throw wxe_badarg(index); + void * temp = memenv->ref2ptr[index]; +- if((index < memenv->next) && ((index == 0) || (temp > NULL))) { ++ if((index < memenv->next) && ((index == 0) || (temp != (void *) NULL))) { + ptrMap::iterator it; + it = ptr2ref.find(temp); + if(it != ptr2ref.end()) { +_END_PATCH +} + +apply_r16_wx_ptr_patch() +{ + patch -p1 <<'_END_PATCH' +diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp +index cc9bcc995..1b1912630 100644 +--- a/lib/wx/c_src/wxe_impl.cpp ++++ b/lib/wx/c_src/wxe_impl.cpp +@@ -757,7 +757,7 @@ void * WxeApp::getPtr(char * bp, wxeMemEnv *memenv) { + throw wxe_badarg(index); + } + void * temp = memenv->ref2ptr[index]; +- if((index < memenv->next) && ((index == 0) || (temp > NULL))) ++ if((index < memenv->next) && ((index == 0) || (temp != (void *)NULL))) + return temp; + else { + throw wxe_badarg(index); +@@ -769,7 +769,7 @@ void WxeApp::registerPid(char * bp, ErlDrvTermData pid, wxeMemEnv * memenv) { + if(!memenv) + throw wxe_badarg(index); + void * temp = memenv->ref2ptr[index]; +- if((index < memenv->next) && ((index == 0) || (temp > NULL))) { ++ if((index < memenv->next) && ((index == 0) || (temp != (void *)NULL))) { + ptrMap::iterator it; + it = ptr2ref.find(temp); + if(it != ptr2ref.end()) { +_END_PATCH +} + case "$1" in version) echo "$KERL_VERSION" @@ -1653,7 +1768,8 @@ case "$1" in fi ;; plt) - if ! do_plt get_active_path; then + ACTIVE_PATH=`get_active_path` + if ! do_plt "$ACTIVE_PATH"; then exit 1; fi ;; |