1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
7 inherit elisp-common java-pkg-opt-2 systemd wxwidgets
9 # NOTE: If you need symlinks for binaries please tell maintainers or
10 # open up a bug to let it be created.
12 UPSTREAM_V="$(ver_cut 1-2)"
14 DESCRIPTION="Erlang programming language, runtime environment and libraries (OTP)"
15 HOMEPAGE="https://www.erlang.org/"
16 SRC_URI="https://github.com/erlang/otp/archive/OTP-${PV}.tar.gz -> ${P}.tar.gz
17 http://erlang.org/download/otp_doc_man_${UPSTREAM_V}.tar.gz -> ${PN}_doc_man_${UPSTREAM_V}.tar.gz
18 doc? ( http://erlang.org/download/otp_doc_html_${UPSTREAM_V}.tar.gz -> ${PN}_doc_html_${UPSTREAM_V}.tar.gz )"
21 # We use this subslot because Compiled HiPE Code can be loaded on the exact
22 # same build of ERTS that was used when compiling the code. See
23 # http://erlang.org/doc/system_principles/misc.html for more information.
25 KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris"
26 IUSE="doc emacs +hipe java +kpoll libressl odbc sctp ssl systemd tk wxwidgets"
33 emacs? ( >=app-editors/emacs-23.1:* )
34 java? ( >=virtual/jdk-1.8:* )
35 odbc? ( dev-db/unixODBC )
36 sctp? ( net-misc/lksctp-tools )
38 !libressl? ( >=dev-libs/openssl-0.9.7d:0= )
39 libressl? ( dev-libs/libressl:0= )
41 systemd? ( sys-apps/systemd )
43 wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] )
49 S="${WORKDIR}/otp-OTP-${PV}"
52 "${FILESDIR}/18.2.1-wx3.0.patch"
53 "${FILESDIR}/${PN}-22.0-dont-ignore-LDFLAGS.patch"
56 SITEFILE=50"${PN}"-gentoo.el
61 ./otp_build autoconf || die
65 use wxwidgets && setup-wxwidgets
68 --disable-builtin-zlib
70 $(use_enable kpoll kernel-poll)
71 $(use_with java javac)
73 $(use_with ssl ssl "${EPREFIX}"/usr)
74 $(use_enable ssl dynamic-ssl-lib)
76 $(usex wxwidgets "--with-wx-config=${WX_CONFIG}" "--with-wxdir=/dev/null")
85 pushd lib/tools/emacs &>/dev/null || die
87 popd &>/dev/null || die
94 sed -n -e "/^${var_name} = \(.*\)$/s::\1:p" "${S}/${path}/vsn.mk" || die "extract_version() failed"
98 local erl_libdir_rel="$(get_libdir)/erlang"
99 local erl_libdir="/usr/${erl_libdir_rel}"
100 local erl_interface_ver="$(extract_version lib/erl_interface EI_VSN)"
101 local erl_erts_ver="$(extract_version erts VSN)"
102 local my_manpath="/usr/share/${PN}/man"
104 [[ -z "${erl_erts_ver}" ]] && die "Couldn't determine erts version"
105 [[ -z "${erl_interface_ver}" ]] && die "Couldn't determine interface version"
107 emake INSTALL_PREFIX="${D}" install
110 local DOCS=( "AUTHORS" "HOWTO"/* "README.md" "CONTRIBUTING.md" "${WORKDIR}"/doc/. "${WORKDIR}"/lib/. "${WORKDIR}"/erts-* )
111 docompress -x /usr/share/doc/${PF}
113 local DOCS=("README.md")
118 dosym "../${erl_libdir_rel}/bin/erl" /usr/bin/erl
119 dosym "../${erl_libdir_rel}/bin/erlc" /usr/bin/erlc
120 dosym "../${erl_libdir_rel}/bin/escript" /usr/bin/escript
121 dosym "../${erl_libdir_rel}/lib/erl_interface-${erl_interface_ver}/bin/erl_call" /usr/bin/erl_call
122 dosym "../${erl_libdir_rel}/erts-${erl_erts_ver}/bin/beam.smp" /usr/bin/beam.smp
124 ## Clean up the no longer needed files
125 rm "${ED}/${erl_libdir}/Install" || die
127 insinto "${my_manpath}"
128 doins -r "${WORKDIR}"/man/*
129 # extend MANPATH, so the normal man command can find it
131 newenvd - "90erlang" <<-_EOF_
132 MANPATH="${my_manpath}"
136 elisp-install erlang lib/tools/emacs/*.{el,elc}
137 sed -e "s:/usr/share:${EPREFIX}/usr/share:g" \
138 "${FILESDIR}/${SITEFILE}" > "${T}/${SITEFILE}" || die
139 elisp-site-file-install "${T}/${SITEFILE}"
142 newinitd "${FILESDIR}"/epmd.init-r2 epmd
143 newconfd "${FILESDIR}"/epmd.confd-r2 epmd
144 use systemd && systemd_newunit "${FILESDIR}"/epmd.service-r1 epmd.service
148 use emacs && elisp-site-regen
152 use emacs && elisp-site-regen