logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

erlang-26.0.1.ebuild (5098B)


  1. # Copyright 1999-2023 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. WX_GTK_VER="3.0-gtk3"
  5. inherit elisp-common flag-o-matic java-pkg-opt-2 systemd toolchain-funcs wxwidgets
  6. # NOTE: If you need symlinks for binaries please tell maintainers or
  7. # open up a bug to let it be created.
  8. UPSTREAM_V="$(ver_cut 1-2)"
  9. DESCRIPTION="Erlang programming language, runtime environment and libraries (OTP)"
  10. HOMEPAGE="https://www.erlang.org/"
  11. SRC_URI="https://github.com/erlang/otp/archive/OTP-${PV}.tar.gz -> ${P}.tar.gz
  12. https://github.com/erlang/otp/releases/download/OTP-${UPSTREAM_V}/otp_doc_man_${UPSTREAM_V}.tar.gz -> ${PN}_doc_man_${UPSTREAM_V}.tar.gz
  13. doc? ( https://github.com/erlang/otp/releases/download/OTP-${UPSTREAM_V}/otp_doc_html_${UPSTREAM_V}.tar.gz -> ${PN}_doc_html_${UPSTREAM_V}.tar.gz )"
  14. LICENSE="Apache-2.0"
  15. # We use this subslot because Compiled HiPE Code can be loaded on the exact
  16. # same build of ERTS that was used when compiling the code. See
  17. # http://erlang.org/doc/system_principles/misc.html for more information.
  18. SLOT="0/${PV}"
  19. KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
  20. IUSE="doc emacs java +kpoll odbc sctp ssl systemd tk wxwidgets"
  21. RDEPEND="
  22. acct-group/epmd
  23. acct-user/epmd
  24. sys-libs/ncurses:0
  25. sys-libs/zlib
  26. emacs? ( >=app-editors/emacs-23.1:* )
  27. java? ( >=virtual/jdk-1.8:* )
  28. odbc? ( dev-db/unixODBC )
  29. sctp? ( net-misc/lksctp-tools )
  30. ssl? ( >=dev-libs/openssl-0.9.7d:0= )
  31. systemd? ( sys-apps/systemd )
  32. wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X,opengl] )
  33. "
  34. DEPEND="${RDEPEND}
  35. dev-lang/perl
  36. "
  37. S="${WORKDIR}/otp-OTP-${PV}"
  38. PATCHES=(
  39. "${FILESDIR}"/${PN}-22.0-dont-ignore-LDFLAGS.patch
  40. "${FILESDIR}"/${PN}-24.0.2-serial-configure.patch
  41. "${FILESDIR}"/${PN}-25.1.2-c99.patch # Bug #882887
  42. )
  43. SITEFILE=50"${PN}"-gentoo.el
  44. src_prepare() {
  45. default
  46. tc-export AR CPP CXX LD
  47. # bug #797886: erlang's VM does unsafe casts for ints
  48. # to pointers and back. This breaks on gcc-11 -flto.
  49. append-flags -fno-strict-aliasing
  50. }
  51. src_configure() {
  52. use wxwidgets && setup-wxwidgets
  53. local myconf=(
  54. --disable-builtin-zlib
  55. # don't search for static zlib
  56. --with-ssl-zlib=no
  57. $(use_enable kpoll kernel-poll)
  58. $(use_with java javac)
  59. $(use_enable sctp)
  60. $(use_with ssl ssl)
  61. $(use_enable ssl dynamic-ssl-lib)
  62. $(use_enable systemd)
  63. $(usex wxwidgets "--with-wx-config=${WX_CONFIG}" "--with-wxdir=/dev/null")
  64. )
  65. econf "${myconf[@]}"
  66. }
  67. src_compile() {
  68. emake
  69. if use doc ; then
  70. emake docs DOC_TARGETS=chunks
  71. fi
  72. if use emacs ; then
  73. pushd lib/tools/emacs &>/dev/null || die
  74. elisp-compile *.el
  75. popd &>/dev/null || die
  76. fi
  77. }
  78. extract_version() {
  79. local path="$1"
  80. local var_name="$2"
  81. sed -n -e "/^${var_name} = \(.*\)$/s::\1:p" "${S}/${path}/vsn.mk" || die "extract_version() failed"
  82. }
  83. src_install() {
  84. local erl_libdir_rel="$(get_libdir)/erlang"
  85. local erl_libdir="/usr/${erl_libdir_rel}"
  86. local erl_interface_ver="$(extract_version lib/erl_interface EI_VSN)"
  87. local erl_erts_ver="$(extract_version erts VSN)"
  88. local my_manpath="/usr/share/${PN}/man"
  89. [[ -z "${erl_erts_ver}" ]] && die "Couldn't determine erts version"
  90. [[ -z "${erl_interface_ver}" ]] && die "Couldn't determine interface version"
  91. emake INSTALL_PREFIX="${D}" install
  92. if use doc ; then
  93. emake INSTALL_PREFIX="${D}" install-docs DOC_TARGETS=chunks
  94. # Note: we explicitly install docs into:
  95. # /usr/share/doc/${PF}/{doc,lib,erts-*}
  96. # To maintain that layout we gather everything in 'html-docs'.
  97. # See bug #684376.
  98. mkdir html-docs || die
  99. mv "${WORKDIR}"/doc "${WORKDIR}"/lib "${WORKDIR}"/erts-* html-docs/ || die
  100. local DOCS=( "AUTHORS" "HOWTO"/* "README.md" "CONTRIBUTING.md" html-docs/. )
  101. docompress -x /usr/share/doc/${PF}
  102. else
  103. local DOCS=("README.md")
  104. fi
  105. einstalldocs
  106. dosym "../${erl_libdir_rel}/bin/erl" /usr/bin/erl
  107. dosym "../${erl_libdir_rel}/bin/erlc" /usr/bin/erlc
  108. dosym "../${erl_libdir_rel}/bin/escript" /usr/bin/escript
  109. dosym "../${erl_libdir_rel}/lib/erl_interface-${erl_interface_ver}/bin/erl_call" /usr/bin/erl_call
  110. dosym "../${erl_libdir_rel}/erts-${erl_erts_ver}/bin/beam.smp" /usr/bin/beam.smp
  111. ## Clean up the no longer needed files
  112. rm "${ED}/${erl_libdir}/Install" || die
  113. insinto "${my_manpath}"
  114. doins -r "${WORKDIR}"/man/*
  115. # extend MANPATH, so the normal man command can find it
  116. # see bug 189639
  117. newenvd - "90erlang" <<-_EOF_
  118. MANPATH="${my_manpath}"
  119. _EOF_
  120. if use emacs ; then
  121. elisp-install erlang lib/tools/emacs/*.{el,elc}
  122. sed -e "s:/usr/share:${EPREFIX}/usr/share:g" \
  123. "${FILESDIR}/${SITEFILE}" > "${T}/${SITEFILE}" || die
  124. elisp-site-file-install "${T}/${SITEFILE}"
  125. fi
  126. newinitd "${FILESDIR}"/epmd.init-r3 epmd
  127. use systemd && systemd_newunit "${FILESDIR}"/epmd.service-r1 epmd.service
  128. }
  129. src_test() {
  130. # Only run a subset of tests to test that everything was built
  131. # successfully, otherwise we will be here for a long time.
  132. emake kernel_test ARGS="-suite os_SUITE"
  133. }
  134. pkg_postinst() {
  135. use emacs && elisp-site-regen
  136. }
  137. pkg_postrm() {
  138. use emacs && elisp-site-regen
  139. }