logo

overlay

My (experimental) gentoo overlay
commit: e80e0dcdd8777e12c0a55b4ee878179bb02bff92
parent: 2345ec4d4ca100506f7c312f25c80f1187c84cee
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 20 Sep 2019 15:10:38 +0200

dev-lang/erlang: Bump to 22.1

Diffstat:

Adev-lang/erlang/Manifest3+++
Adev-lang/erlang/erlang-22.1.ebuild148+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-lang/erlang/files/18.2.1-wx3.0.patch113+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-lang/erlang/files/50erlang-gentoo.el5+++++
Adev-lang/erlang/files/epmd.confd2++
Adev-lang/erlang/files/epmd.init26++++++++++++++++++++++++++
Adev-lang/erlang/files/epmd.init-r124++++++++++++++++++++++++
Adev-lang/erlang/files/epmd.service9+++++++++
Adev-lang/erlang/files/erlang-20.3.2-dont-ignore-LDFLAGS.patch42++++++++++++++++++++++++++++++++++++++++++
Adev-lang/erlang/files/erlang-21.3-lto.patch140+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-lang/erlang/files/erlang-21.3-pgo-loop.patch13+++++++++++++
Adev-lang/erlang/files/erlang-22.0-dont-ignore-LDFLAGS.patch27+++++++++++++++++++++++++++
Adev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-lang/erlang/files/erlang-custom-autoconf.patch14++++++++++++++
Adev-lang/erlang/metadata.xml18++++++++++++++++++
15 files changed, 674 insertions(+), 0 deletions(-)

diff --git a/dev-lang/erlang/Manifest b/dev-lang/erlang/Manifest @@ -0,0 +1,3 @@ +DIST erlang-22.1.tar.gz 54950536 BLAKE2B 434936642e6cad7774fa99b856c6aa48043d94817a85594421e0f8cd7a90086a63d66f146d664318d337d2b3bc83bbdb40aaf9b0a0315b548857ed5c8a793e7a SHA512 23e50985e2e9de06cac7bc7d31167f1ce0b5a51ff50ca6cfd97882e2f4021bffa2fd069d4ff0371223a439f00cfbb645951d7ca5dcef831d1880a4f5a32e6dfb +DIST erlang_doc_html_22.1.tar.gz 33824830 BLAKE2B 2d50802fff81eba8bcf5f630da49d68d7cb2098175012e12f13941e69949a109c9f601c3cfaa2700b669415cd0c6c15961d8e4dd94b9b228cee17b661fe5400a SHA512 cc24927a4ff98b04d8f93fbc46bb36ffb34570521e4f31154b778dc17cf1cff60869239c26c327d7a9360c06528f9b380a302b39fa47285e50dfd4656b508202 +DIST erlang_doc_man_22.1.tar.gz 1355169 BLAKE2B eca02e36709587d59099dd87263b3ffcea55002cbcbf0a9980fface3cc30cb4ce0210fbdf80c8957da7a09a3b866ca81be22fd577f7f948562ef4e4ca516cbf5 SHA512 4f590f82293c97529c827c042bce673e6777c577e52e0e1876a8d6c1a0dc774c09637e85e3562f9a8af44372219d57174c002cc12a9646ae015c7bb1da34c750 diff --git a/dev-lang/erlang/erlang-22.1.ebuild b/dev-lang/erlang/erlang-22.1.ebuild @@ -0,0 +1,148 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +WX_GTK_VER="3.0" + +inherit eapi7-ver elisp-common java-pkg-opt-2 systemd wxwidgets + +# NOTE: If you need symlinks for binaries please tell maintainers or +# open up a bug to let it be created. + +UPSTREAM_V="$(ver_cut 1-2)" + +DESCRIPTION="Erlang programming language, runtime environment and libraries (OTP)" +HOMEPAGE="https://www.erlang.org/" +SRC_URI="https://github.com/erlang/otp/archive/OTP-${PV}.tar.gz -> ${P}.tar.gz + http://erlang.org/download/otp_doc_man_${UPSTREAM_V}.tar.gz -> ${PN}_doc_man_${UPSTREAM_V}.tar.gz + doc? ( http://erlang.org/download/otp_doc_html_${UPSTREAM_V}.tar.gz -> ${PN}_doc_html_${UPSTREAM_V}.tar.gz )" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris" +IUSE="doc emacs +hipe java +kpoll libressl odbc sctp ssl systemd tk wxwidgets" + +RDEPEND=" + sys-libs/ncurses:0 + sys-libs/zlib + emacs? ( virtual/emacs ) + java? ( >=virtual/jdk-1.8:* ) + odbc? ( dev-db/unixODBC ) + sctp? ( net-misc/lksctp-tools ) + ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.7d:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + systemd? ( sys-apps/systemd ) + tk? ( dev-lang/tk:0 ) + wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] ) +" +DEPEND="${RDEPEND} + dev-lang/perl +" + +S="${WORKDIR}/otp-OTP-${PV}" + +PATCHES=( + "${FILESDIR}/18.2.1-wx3.0.patch" + "${FILESDIR}/${PN}-22.0-dont-ignore-LDFLAGS.patch" + "${FILESDIR}/${PN}-add-epmd-pid-file-creation-for-openrc.patch" +) + +SITEFILE=50"${PN}"-gentoo.el + +src_prepare() { + default + + ./otp_build autoconf +} + +src_configure() { + use wxwidgets && setup-wxwidgets + + local myconf=( + --disable-builtin-zlib + $(use_enable hipe) + $(use_enable kpoll kernel-poll) + $(use_with java javac) + $(use_enable sctp) + $(use_with ssl ssl "${EPREFIX}"/usr) + $(use_enable ssl dynamic-ssl-lib) + $(usex wxwidgets "--with-wx-config=${WX_CONFIG}" "--with-wxdir=/dev/null") + ) + econf "${myconf[@]}" +} + +src_compile() { + emake + + if use emacs ; then + pushd lib/tools/emacs &>/dev/null || die + elisp-compile *.el + popd &>/dev/null || die + fi +} + +extract_version() { + local path="$1" + local var_name="$2" + sed -n -e "/^${var_name} = \(.*\)$/s::\1:p" "${S}/${path}/vsn.mk" || die "extract_version() failed" +} + +src_install() { + local erl_libdir_rel="$(get_libdir)/erlang" + local erl_libdir="/usr/${erl_libdir_rel}" + local erl_interface_ver="$(extract_version lib/erl_interface EI_VSN)" + local erl_erts_ver="$(extract_version erts VSN)" + local my_manpath="/usr/share/${PN}/man" + + [[ -z "${erl_erts_ver}" ]] && die "Couldn't determine erts version" + [[ -z "${erl_interface_ver}" ]] && die "Couldn't determine interface version" + + emake INSTALL_PREFIX="${D}" install + + if use doc ; then + local DOCS=( "AUTHORS" "HOWTO"/* "README.md" "CONTRIBUTING.md" "${WORKDIR}"/doc/. "${WORKDIR}"/lib/. "${WORKDIR}"/erts-* ) + docompress -x /usr/share/doc/${PF} + else + local DOCS=("README.md") + fi + + einstalldocs + + dosym "../${erl_libdir_rel}/bin/erl" /usr/bin/erl + dosym "../${erl_libdir_rel}/bin/erlc" /usr/bin/erlc + dosym "../${erl_libdir_rel}/bin/escript" /usr/bin/escript + dosym "../${erl_libdir_rel}/lib/erl_interface-${erl_interface_ver}/bin/erl_call" /usr/bin/erl_call + dosym "../${erl_libdir_rel}/erts-${erl_erts_ver}/bin/beam.smp" /usr/bin/beam.smp + + ## Clean up the no longer needed files + rm "${ED}/${erl_libdir}/Install" || die + + insinto "${my_manpath}" + doins -r "${WORKDIR}"/man/* + # extend MANPATH, so the normal man command can find it + # see bug 189639 + newenvd - "90erlang" <<-_EOF_ + MANPATH="${my_manpath}" + _EOF_ + + if use emacs ; then + elisp-install erlang lib/tools/emacs/*.{el,elc} + sed -e "s:/usr/share:${EPREFIX}/usr/share:g" \ + "${FILESDIR}/${SITEFILE}" > "${T}/${SITEFILE}" || die + elisp-site-file-install "${T}/${SITEFILE}" + fi + + newinitd "${FILESDIR}"/epmd.init-r1 epmd + newconfd "${FILESDIR}"/epmd.confd epmd + use systemd && systemd_dounit "${FILESDIR}"/epmd.service +} + +pkg_postinst() { + use emacs && elisp-site-regen +} + +pkg_postrm() { + use emacs && elisp-site-regen +} diff --git a/dev-lang/erlang/files/18.2.1-wx3.0.patch b/dev-lang/erlang/files/18.2.1-wx3.0.patch @@ -0,0 +1,113 @@ +Description: Fix constants for wxwidgets3.0 + The values of wx constants can change between stable release series (and + some have between 2.8 and 3.0), but erlang seems to hardcode these values. +Author: Olly Betts <olly@survex.com> +Bug-Debian: https://bugs.debian.org/766790 +Forwarded: no +Last-Update: 2014-11-25 + +--- a/lib/wx/include/wx.hrl ++++ b/lib/wx/include/wx.hrl +@@ -767,7 +767,7 @@ + % From "checkbox.h" + -define(wxCHK_ALLOW_3RD_STATE_FOR_USER, 8192). + -define(wxCHK_3STATE, 4096). +--define(wxCHK_2STATE, 0). ++-define(wxCHK_2STATE, 16384). + % From "checkbox.h": wxCheckBoxState + -define(wxCHK_UNCHECKED, 0). + -define(wxCHK_CHECKED, 1). +@@ -1014,10 +1014,10 @@ + -define(wxSIZE_AUTO_WIDTH, 1). + -define(wxSETUP, 131072). + -define(wxMORE, 65536). +--define(wxHELP, 32768). +--define(wxRESET, 16384). +--define(wxBACKWARD, 8192). +--define(wxFORWARD, 4096). ++-define(wxHELP, 4096). ++-define(wxRESET, 32768). ++-define(wxBACKWARD, 16384). ++-define(wxFORWARD, 8192). + -define(wxICON_MASK, (16#00000100 bor 16#00000200 bor 16#00000400 bor 16#00000800)). + -define(wxICON_ASTERISK, ?wxICON_INFORMATION). + -define(wxICON_STOP, ?wxICON_HAND). +@@ -1049,8 +1049,8 @@ + -define(wxTC_TOP, 0). + -define(wxTC_FIXEDWIDTH, 32). + -define(wxTC_RIGHTJUSTIFY, 16). +--define(wxSP_WRAP, 8192). +--define(wxSP_ARROW_KEYS, 4096). ++-define(wxSP_WRAP, 32768). ++-define(wxSP_ARROW_KEYS, 16384). + -define(wxSP_VERTICAL, ?wxVERTICAL). + -define(wxSP_HORIZONTAL, ?wxHORIZONTAL). + -define(wxSB_VERTICAL, ?wxVERTICAL). +@@ -1071,8 +1071,8 @@ + -define(wxCB_SIMPLE, 4). + -define(wxLB_INT_HEIGHT, 2048). + -define(wxLB_HSCROLL, ?wxHSCROLL). +--define(wxLB_ALWAYS_SB, 1024). +--define(wxLB_NEEDED_SB, 512). ++-define(wxLB_ALWAYS_SB, 512). ++-define(wxLB_NEEDED_SB, 0). + -define(wxLB_OWNERDRAW, 256). + -define(wxLB_EXTENDED, 128). + -define(wxLB_MULTIPLE, 64). +@@ -1548,7 +1548,7 @@ + -define(wxUPDATE_UI_FROMIDLE, 2). + % From "dialog.h" + -define(wxDEFAULT_DIALOG_STYLE, (?wxCAPTION bor ?wxSYSTEM_MENU bor ?wxCLOSE_BOX)). +--define(wxDIALOG_NO_PARENT, 1). ++-define(wxDIALOG_NO_PARENT, 32). + % From "dirctrlg.h" + -define(wxDIRCTRL_DIR_ONLY, 16). + -define(wxDIRCTRL_SELECT_FIRST, 32). +@@ -3728,7 +3728,7 @@ + -define(wxSTC_KEY_LEFT, 302). + -define(wxSTC_KEY_UP, 301). + -define(wxSTC_KEY_DOWN, 300). +--define(wxSTC_MODEVENTMASKALL, 8191). ++-define(wxSTC_MODEVENTMASKALL, 1048575). + -define(wxSTC_MULTILINEUNDOREDO, 4096). + -define(wxSTC_MOD_BEFOREDELETE, 2048). + -define(wxSTC_MOD_BEFOREINSERT, 1024). +@@ -3810,7 +3810,7 @@ + -define(wxSTC_INDIC_TT, 2). + -define(wxSTC_INDIC_SQUIGGLE, 1). + -define(wxSTC_INDIC_PLAIN, 0). +--define(wxSTC_INDIC_MAX, 7). ++-define(wxSTC_INDIC_MAX, 31). + -define(wxSTC_CASE_LOWER, 2). + -define(wxSTC_CASE_UPPER, 1). + -define(wxSTC_CASE_MIXED, 0). +@@ -3835,7 +3835,7 @@ + -define(wxSTC_CHARSET_BALTIC, 186). + -define(wxSTC_CHARSET_DEFAULT, 1). + -define(wxSTC_CHARSET_ANSI, 0). +--define(wxSTC_STYLE_MAX, 127). ++-define(wxSTC_STYLE_MAX, 255). + -define(wxSTC_STYLE_LASTPREDEFINED, 39). + -define(wxSTC_STYLE_CALLTIP, 38). + -define(wxSTC_STYLE_INDENTGUIDE, 37). +@@ -3934,9 +3934,9 @@ + -define(wxTE_PROCESS_TAB, 64). + -define(wxTE_MULTILINE, 32). + -define(wxTE_READONLY, 16). +--define(wxTE_AUTO_SCROLL, 8). ++-define(wxTE_AUTO_SCROLL, 0). + -define(wxTE_NO_VSCROLL, 2). +--define(wxHAS_TEXT_WINDOW_STREAM, 0). ++-define(wxHAS_TEXT_WINDOW_STREAM, 1). + % From "textctrl.h": wxTextAttrAlignment + -define(wxTEXT_ALIGNMENT_DEFAULT, 0). + -define(wxTEXT_ALIGNMENT_LEFT, 1). +@@ -3986,7 +3986,7 @@ + -define(wxDEFAULT_FRAME_STYLE, (?wxSYSTEM_MENU bor ?wxRESIZE_BORDER bor ?wxMINIMIZE_BOX bor ?wxMAXIMIZE_BOX bor ?wxCLOSE_BOX bor ?wxCAPTION bor ?wxCLIP_CHILDREN)). + -define(wxRESIZE_BORDER, 64). + -define(wxTINY_CAPTION_VERT, 128). +--define(wxTINY_CAPTION_HORIZ, 256). ++-define(wxTINY_CAPTION_HORIZ, 128). + -define(wxMAXIMIZE_BOX, 512). + -define(wxMINIMIZE_BOX, 1024). + -define(wxSYSTEM_MENU, 2048). diff --git a/dev-lang/erlang/files/50erlang-gentoo.el b/dev-lang/erlang/files/50erlang-gentoo.el @@ -0,0 +1,5 @@ +;;; erlang site-lisp configuration + +(add-to-list 'load-path "@SITELISP@") +(require 'erlang-start) +(setq erlang-root-dir "/usr/share") diff --git a/dev-lang/erlang/files/epmd.confd b/dev-lang/erlang/files/epmd.confd @@ -0,0 +1,2 @@ +#arguments for run erlang +command_args="--daemon -relaxed_command_check -address 127.0.0.1" diff --git a/dev-lang/erlang/files/epmd.init b/dev-lang/erlang/files/epmd.init @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 2010-2019 Gentoo Authors +# Distributed under the terms of the Apache License, Version 2.0 + +ZT_ADDRESS="" +pidfile="/var/run/epmd.pid" +command_args="-daemon -relaxed_command_check -address 127.0.0.1" + +depend() { + need net.lo + before sshd +} + +start() { + ebegin "Starting Erlang Port Mapper Daemon" + start-stop-daemon --start --quiet \ + --pidfile $pidfile \ + --exec /usr/bin/epmd -- $command_args + eend $? +} + +stop() { + ebegin "Stopping Erlang Port Mapper Daemon" + /usr/bin/epmd -kill >/dev/null + eend $? +} diff --git a/dev-lang/erlang/files/epmd.init-r1 b/dev-lang/erlang/files/epmd.init-r1 @@ -0,0 +1,24 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the Erlang Public License 1.1 + +pidfile="/var/run/epmd.pid" + +depend() { + need net.lo + before sshd +} + +start() { + ebegin "Starting Erlang Port Mapper Daemon" + start-stop-daemon --start --quiet \ + --pidfile "${pidfile}" \ + --exec /usr/bin/epmd -- $command_args + eend $? +} + +stop() { + ebegin "Stopping Erlang Port Mapper Daemon" + /usr/bin/epmd -kill >/dev/null + eend $? +} diff --git a/dev-lang/erlang/files/epmd.service b/dev-lang/erlang/files/epmd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Erlang Portmapper Daemon +Wants=network.target + +[Service] +ExecStart=/usr/bin/epmd + +[Install] +WantedBy=multi-user.target diff --git a/dev-lang/erlang/files/erlang-20.3.2-dont-ignore-LDFLAGS.patch b/dev-lang/erlang/files/erlang-20.3.2-dont-ignore-LDFLAGS.patch @@ -0,0 +1,42 @@ +From 69043168302ec7c0bcfaa8b1fb56bfae500bd139 Mon Sep 17 00:00:00 2001 +From: Nick Sarnie <commendsarnex@gmail.com> +Date: Sun, 8 Apr 2018 16:11:55 -0400 +Subject: [PATCH] Don't ignore LDFLAGS + +Bug: https://bugs.gentoo.org/263129 + +Signed-off-by: Nick Sarnie <commendsarnex@gmail.com> +--- + lib/megaco/src/flex/Makefile.in | 2 +- + lib/odbc/c_src/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in +index c37ad4d702..400024ca0c 100644 +--- a/lib/megaco/src/flex/Makefile.in ++++ b/lib/megaco/src/flex/Makefile.in +@@ -66,7 +66,7 @@ endif + CC = $(DED_CC) + CFLAGS_MT = $(CFLAGS) $(DED_THR_DEFS) + LD = $(DED_LD) +-LDFLAGS = $(DED_LDFLAGS) ++LDFLAGS += $(DED_LDFLAGS) + LEX = @LEX@ + LEXLIB = @LEXLIB@ + PERL = @PERL@ +diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in +index 784e73c47e..51c023f710 100644 +--- a/lib/odbc/c_src/Makefile.in ++++ b/lib/odbc/c_src/Makefile.in +@@ -82,7 +82,7 @@ CC = @CC@ + CFLAGS = $(TYPEFLAGS) @CFLAGS@ @THR_DEFS@ @DEFS@ + EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET) + LD = @LD@ +-LDFLAGS = $(ODBC_LIB) $(EI_LDFLAGS) ++LDFLAGS += $(ODBC_LIB) $(EI_LDFLAGS) + LIBS = @LIBS@ @THR_LIBS@ $(EI_LIB) + INCLUDES = -I. $(ODBC_INCLUDE) $(EI_INCLUDE) + TARGET_FLAGS = @TARGET_FLAGS@ +-- +2.17.0 + diff --git a/dev-lang/erlang/files/erlang-21.3-lto.patch b/dev-lang/erlang/files/erlang-21.3-lto.patch @@ -0,0 +1,140 @@ +https://github.com/erlang/otp/pull/2194 +https://bugs.gentoo.org/681778 + +From ed751968d8dc4c0b58210247e94409a8a52cc501 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich <slyfox@gentoo.org> +Date: Thu, 28 Mar 2019 08:38:56 +0000 +Subject: [PATCH] stdlib: fix re:replace on LTO builds + +Fabio Coatti reported elixir build failure in https://bugs.gentoo.org/681778. +The minimal reproducer looks like that (from otp git tree): + + $ ./configure CFLAGS='-O2 -flto' LDFLAGS='-O2 -flto=8' + $ make + $ ERL_TOP=$PWD \ + PATH=$ERL_TOP/bin:$PATH \ + \ + bin/erl \ + \ + -noshell -eval 're:replace("a","b","c",[{return,list}]).' \ + -s erlang halt + + {"init terminating in do_boot",{badarg,[{re,replace,["a","b","c",[{return,list}]], + [{file,"re.erl"},{line,362}]}, + {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]}, + {init,start_it,1,[]}, + {init,start_em,1,[]}, + {init,do_boot,3,[]}]}} + init terminating in do_boot ({badarg,[{re,replace,[[_],[_],[_],[_]],[{_},{_}]}, + {erl_eval,do_apply,6,[{_},{_}]},{init,start_it,1,[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}) + Crash dump is being written to: erl_crash.dump...done + +The failure happens in libpcre2 where stack overflow is mis-identified +at function entry of + + erts_pcre_compile2() + compile_regex() + if (PUBL(stack_guard) != NULL && PUBL(stack_guard)()) + { + *errorcodeptr= ERR85; + return FALSE; + } + +The stack "overflow" detection happens in + + thr_wrapper() + ethr_set_stacklimit__() + +because the stack usage code relies on the fact that ethr_set_stacklimit__() +and similar functions don't get inlined into callers for stack growth +measurement. + +Before the change inlining avoidance was achieved by putting functions +into standalone translation units. LTO makes this technique inefficient. + +The change marks functions explicitly as __attribute__((__noinline__)) on gcc. + +Reported-by: Fabio Coatti +Bug: https://bugs.gentoo.org/681778 +Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> +--- + erts/emulator/beam/global.h | 9 +++++---- + erts/emulator/beam/sys.h | 10 ++++++++++ + erts/include/internal/ethr_internal.h | 2 +- + erts/include/internal/ethread_inline.h | 3 +++ + 4 files changed, 19 insertions(+), 5 deletions(-) + +diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h +index f9bbe4167f9..4c8d3d3dbe6 100644 +--- a/erts/emulator/beam/global.h ++++ b/erts/emulator/beam/global.h +@@ -1216,10 +1216,11 @@ Uint64 erts_timestamp_millis(void); + + Export* erts_find_function(Eterm, Eterm, unsigned int, ErtsCodeIndex); + +-void *erts_calc_stacklimit(char *prev_c, UWord stacksize); +-int erts_check_below_limit(char *ptr, char *limit); +-int erts_check_above_limit(char *ptr, char *limit); +-void *erts_ptr_id(void *ptr); ++/* ERTS_NOINLINE prevents link-time optimization across modules */ ++void *erts_calc_stacklimit(char *prev_c, UWord stacksize) ERTS_NOINLINE; ++int erts_check_below_limit(char *ptr, char *limit) ERTS_NOINLINE; ++int erts_check_above_limit(char *ptr, char *limit) ERTS_NOINLINE; ++void *erts_ptr_id(void *ptr) ERTS_NOINLINE; + + Eterm store_external_or_ref_in_proc_(Process *, Eterm); + Eterm store_external_or_ref_(Uint **, ErlOffHeap*, Eterm); +diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h +index a6312293cc8..24b6738e082 100644 +--- a/erts/emulator/beam/sys.h ++++ b/erts/emulator/beam/sys.h +@@ -63,6 +63,16 @@ + # endif + #endif + ++#ifndef ERTS_NOINLINE ++# if ERTS_AT_LEAST_GCC_VSN__(3,1,1) ++# define ERTS_NOINLINE __attribute__((__noinline__)) ++# elif defined(__WIN32__) ++# define ERTS_NOINLINE __declspec(noinline) ++# else ++# define ERTS_NOINLINE ++# endif ++#endif ++ + #if defined(DEBUG) || defined(ERTS_ENABLE_LOCK_CHECK) + # undef ERTS_CAN_INLINE + # define ERTS_CAN_INLINE 0 +diff --git a/erts/include/internal/ethr_internal.h b/erts/include/internal/ethr_internal.h +index ac27ff2ed09..17ec84c52b6 100644 +--- a/erts/include/internal/ethr_internal.h ++++ b/erts/include/internal/ethr_internal.h +@@ -90,7 +90,7 @@ int ethr_init_common__(ethr_init_data *id); + int ethr_late_init_common__(ethr_late_init_data *lid); + void ethr_run_exit_handlers__(void); + void ethr_ts_event_destructor__(void *vtsep); +-void ethr_set_stacklimit__(char *prev_c, size_t stacksize); ++void ethr_set_stacklimit__(char *prev_c, size_t stacksize) ETHR_NOINLINE; + + #if defined(ETHR_X86_RUNTIME_CONF__) + void ethr_x86_cpuid__(int *eax, int *ebx, int *ecx, int *edx); +diff --git a/erts/include/internal/ethread_inline.h b/erts/include/internal/ethread_inline.h +index 8e6bcfc4a8c..f25ba4ae721 100644 +--- a/erts/include/internal/ethread_inline.h ++++ b/erts/include/internal/ethread_inline.h +@@ -62,12 +62,15 @@ + # define ETHR_INLINE __inline__ + # if ETHR_AT_LEAST_GCC_VSN__(3, 1, 1) + # define ETHR_FORCE_INLINE __inline__ __attribute__((__always_inline__)) ++# define ETHR_NOINLINE __attribute__((__noinline__)) + # else + # define ETHR_FORCE_INLINE __inline__ ++# define ETHR_NOINLINE + # endif + #elif defined(__WIN32__) + # define ETHR_INLINE __forceinline + # define ETHR_FORCE_INLINE __forceinline ++# define ETHR_NOINLINE __declspec(noinline) + #endif + + #endif /* #ifndef ETHREAD_INLINE_H__ */ diff --git a/dev-lang/erlang/files/erlang-21.3-pgo-loop.patch b/dev-lang/erlang/files/erlang-21.3-pgo-loop.patch @@ -0,0 +1,13 @@ +https://bugs.gentoo.org/686786 + +--- a/erts/configure.in ++++ b/erts/configure.in +@@ -682,7 +682,7 @@ elif test "X$PROFILE_INSTR_GENERATE" = "Xtrue" -a "X$PROFILE_INSTR_USE" = "Xtrue + PROFILE_COMPILER=clang + AC_MSG_RESULT([yes, using -fprofile-instr-generate]) + else +- if $enable_pgo = yes; then ++ if test $enable_pgo = yes; then + AC_MSG_ERROR(cannot use PGO with this compiler) + else + AC_MSG_RESULT([no]) diff --git a/dev-lang/erlang/files/erlang-22.0-dont-ignore-LDFLAGS.patch b/dev-lang/erlang/files/erlang-22.0-dont-ignore-LDFLAGS.patch @@ -0,0 +1,27 @@ +This is a forward port of erlang-20.3.2-dont-ignore-LDFLAGS.patch +Anthony G. Basile <blueness@gentoo.org> + +diff -Naur otp-OTP-22.0.orig/lib/megaco/src/flex/Makefile.in otp-OTP-22.0/lib/megaco/src/flex/Makefile.in +--- otp-OTP-22.0.orig/lib/megaco/src/flex/Makefile.in 2019-05-10 12:42:49.000000000 +0000 ++++ otp-OTP-22.0/lib/megaco/src/flex/Makefile.in 2019-06-04 15:53:37.899372564 +0000 +@@ -47,7 +47,7 @@ + CC = @DED_CC@ + CFLAGS_MT = $(CFLAGS) @DED_THR_DEFS@ + LD = @DED_LD@ +-LDFLAGS = @DED_LDFLAGS@ ++LDFLAGS += @DED_LDFLAGS@ + LEX = @LEX@ + LEXLIB = @LEXLIB@ + PERL = @PERL@ +diff -Naur otp-OTP-22.0.orig/lib/odbc/c_src/Makefile.in otp-OTP-22.0/lib/odbc/c_src/Makefile.in +--- otp-OTP-22.0.orig/lib/odbc/c_src/Makefile.in 2019-05-10 12:42:49.000000000 +0000 ++++ otp-OTP-22.0/lib/odbc/c_src/Makefile.in 2019-06-04 15:53:37.900372572 +0000 +@@ -82,7 +82,7 @@ + CFLAGS = $(TYPEFLAGS) @CFLAGS@ @THR_DEFS@ @DEFS@ + EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET) + LD = @LD@ +-LDFLAGS = $(ODBC_LIB) $(EI_LDFLAGS) ++LDFLAGS += $(ODBC_LIB) $(EI_LDFLAGS) + LIBS = @LIBS@ @THR_LIBS@ $(EI_LIB) + INCLUDES = -I. $(ODBC_INCLUDE) $(EI_INCLUDE) + TARGET_FLAGS = @TARGET_FLAGS@ diff --git a/dev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch b/dev-lang/erlang/files/erlang-add-epmd-pid-file-creation-for-openrc.patch @@ -0,0 +1,90 @@ +From 04ace92c33a699f75445dc99c30d521311aba826 Mon Sep 17 00:00:00 2001 +From: Steve Arnold <nerdboy@gentoo.org> +Date: Mon, 6 Aug 2018 16:38:30 -0700 +Subject: [PATCH] Add daemon-mode pid file creation when not configured for + systemd + +Signed-off-by: Steve Arnold <nerdboy@gentoo.org> +--- + erts/epmd/src/epmd.c | 39 ++++++++++++++++++++++++++++++++++++++- + erts/epmd/src/epmd.h | 3 +++ + 2 files changed, 41 insertions(+), 1 deletion(-) + +diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c +index 44e997e609..c74888a1ee 100644 +--- a/erts/epmd/src/epmd.c ++++ b/erts/epmd/src/epmd.c +@@ -40,6 +40,37 @@ static int check_relaxed(void); + #ifdef __WIN32__ + static int has_console(void); + #endif ++#ifndef HAVE_SYSTEMD_DAEMON ++static int create_pidfile(void); ++static const char *pidfile = EPMD_PIDFILE; ++#endif ++ ++#ifndef HAVE_SYSTEMD_DAEMON ++static int create_pidfile(void) ++{ ++ int fd; ++ ++ unlink(pidfile); ++ ++ /* open the pidfile */ ++ fd = open(pidfile, O_WRONLY|O_CREAT|O_EXCL, 0644); ++ if (fd >= 0) { ++ FILE *f; ++ ++ /* write our pid to it */ ++ f = fdopen(fd, "w"); ++ if (f != NULL) { ++ fprintf(f, "%d\n", getpid()); ++ fclose(f); ++ /* leave the fd open */ ++ return 0; ++ } ++ close(fd); ++ } ++ ++ return -1; ++} ++#endif /* (no) HAVE_SYSTEMD_DAEMON */ + + #ifdef DONT_USE_MAIN + +@@ -340,6 +371,13 @@ static void run_daemon(EpmdVars *g) + + umask(0); + ++#ifndef HAVE_SYSTEMD_DAEMON ++ if (create_pidfile() < 0) { ++ dbg_perror(g,"could not create pidfile %s", pidfile); ++ epmd_cleanup_exit(g,1); ++ } ++#endif /* HAVE_SYSTEMD_DAEMON */ ++ + for (fd = 0; fd < g->max_conn ; fd++) /* close all files ... */ + close(fd); + /* Syslog on linux will try to write to whatever if we dont +@@ -614,4 +652,3 @@ static int check_relaxed(void) + char* port_str = getenv("ERL_EPMD_RELAXED_COMMAND_CHECK"); + return (port_str != NULL) ? 1 : 0; + } +- +diff --git a/erts/epmd/src/epmd.h b/erts/epmd/src/epmd.h +index cffcd4ae7a..e53322acf5 100644 +--- a/erts/epmd/src/epmd.h ++++ b/erts/epmd/src/epmd.h +@@ -20,6 +20,9 @@ + + /* The port number is defined in a makefile */ + ++/* The name and path to the pid file */ ++#define EPMD_PIDFILE "/var/run/epmd.pid" ++ + /* Definitions of message codes */ + + /* Registration and queries */ +-- +2.17.0 + diff --git a/dev-lang/erlang/files/erlang-custom-autoconf.patch b/dev-lang/erlang/files/erlang-custom-autoconf.patch @@ -0,0 +1,14 @@ +diff -ur otp-OTP-21.0.5.orig/otp_build otp-OTP-21.0.5/otp_build +--- otp-OTP-21.0.5.orig/otp_build 2018-08-10 19:02:51.000000000 +0200 ++++ otp-OTP-21.0.5/otp_build 2018-08-15 23:44:59.417191209 +0200 +@@ -1343,7 +1343,9 @@ + do_lazy_configure "$@"; + do_boot;; + autoconf) +- do_autoconf;; ++ create_lib_configure_in ++ distribute_config_helpers ++ ;; + configure) + shift; + do_configure "$@";; diff --git a/dev-lang/erlang/metadata.xml b/dev-lang/erlang/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <!--maintainer-needed--> + <use> + <flag name="compat-ethread">Enable compatibility with pre-pentium 4 CPUs in the ethread library.</flag> + <flag name="dirty-schedulers">Enable dirty schedulers</flag> + <flag name="hipe">HIgh Performance Erlang extension</flag> + <flag name="kpoll">Enable kernel polling support</flag> + <flag name="pgo">Build erts with profile-guided optimizations</flag> + </use> + <longdescription> + Erlang is a programming language designed at the Ericsson + Computer Science Laboratory. Open-source Erlang is being + released to help encourage the spread of Erlang outside + Ericsson. + </longdescription> +</pkgmetadata>