# Contributor: Michael Mason # Contributor: Gabriele Santomaggio # Contributor: Marlus Saraiva # Maintainer: Daniel Isaksen # NOTE: Please do NOT upgrade to X.0 releases of Erlang, as they tend # to have breaking changes which require the rest of the ecosystem to # catch up with. If in doubt, do a test rebuild of community/elixir. pkgname=erlang pkgver=26.0.2 pkgrel=1 pkgdesc="General-purpose programming language and runtime environment" url="https://www.erlang.org/" license="Apache-2.0" arch="all" makedepends=" autoconf glu-dev ncurses-dev openssl-dev perl perl-dev unixodbc-dev wxwidgets-dev zlib-dev " subpackages="$pkgname-dev $pkgname-debugger:_mv_erlang_lib $pkgname-dialyzer:_mv_erlang_lib $pkgname-et:_mv_erlang_lib $pkgname-megaco:_mv_erlang_lib $pkgname-observer:_mv_erlang_lib $pkgname-odbc:_mv_erlang_lib $pkgname-reltool:_mv_erlang_lib $pkgname-wx:_mv_erlang_lib " source="https://github.com/erlang/otp/releases/download/OTP-$pkgver/otp_src_$pkgver.tar.gz crypto-unload.patch " builddir="$srcdir/otp_src_$pkgver" # Disable Java support (jinterface) on architectures that lack OpenJDK case "$CTARGET_ARCH" in x86|armhf|armv7|x86_64|aarch64|ppc64le|s390x) makedepends="$makedepends openjdk8" export PATH="/usr/lib/jvm/java-1.8-openjdk/bin:$PATH" ;; *) ;; esac # secfixes: # 25.0.3-r0: # - CVE-2022-37026 # 23.2.5-r0: # - CVE-2020-35733 build() { # it's a whole language runtime export CFLAGS="$CFLAGS -O2 -D_BSD_SOURCE" export CXXFLAGS="$CXXFLAGS -O2" ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --host="$CHOST" \ --build="$CBUILD" \ --enable-threads \ --enable-shared-zlib \ --enable-ssl=dynamic-ssl-lib make } check() { ERL_TOP="$builddir" make release_tests } package() { make DESTDIR="$pkgdir" install } _mv_erlang_lib() { local lib=$(echo ${subpkgname#"$pkgname-"} | tr '-' '_') depends="$pkgname=$pkgver-r$pkgrel" case "$lib" in debugger) depends="$pkgname-wx=$pkgver-r$pkgrel";; dialyzer) depends="$pkgname-wx=$pkgver-r$pkgrel";; et) depends="$pkgname-wx=$pkgver-r$pkgrel";; megaco) depends="$pkgname-debugger=$pkgver-r$pkgrel $pkgname-et=$pkgver-r$pkgrel";; observer) depends="$pkgname-et=$pkgver-r$pkgrel $pkgname-wx=$pkgver-r$pkgrel";; reltool) depends="$pkgname-wx=$pkgver-r$pkgrel";; wx) depends="$pkgname=$pkgver-r$pkgrel xauth terminus-font";; esac mkdir -p "$subpkgdir"/usr/lib/erlang/lib rm -f "$pkgdir"/usr/lib/erlang/lib/$lib-*/src/*.erl mv "$pkgdir"/usr/lib/erlang/lib/$lib-* "$subpkgdir"/usr/lib/erlang/lib/ } dev() { set -x local i='' depends="$pkgname=$pkgver-r$pkgrel $depends_dev" pkgdesc="$pkgdesc (development files)" cd "$pkgdir" local libdirs=usr/ [ -d lib/ ] && libdirs="lib/ $libdirs" for i in usr/include usr/lib/pkgconfig usr/share/aclocal\ usr/share/gettext usr/bin/*-config \ usr/share/vala/vapi usr/share/gir-[0-9]* \ usr/share/qt*/mkspecs \ usr/lib/qt*/mkspecs \ usr/lib/cmake \ $(find . -name include -type d) \ $(find $libdirs -name '*.[acho]' \ -o -name '*.prl' 2>/dev/null); do if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then d="$subpkgdir/${i%/*}" # dirname $i mkdir -p "$d" mv "$pkgdir/$i" "$d" rmdir "$pkgdir/${i%/*}" 2>/dev/null || true fi done # move *.so links needed when linking the apps to -dev packages for i in lib/*.so usr/lib/*.so; do if [ -L "$i" ]; then mkdir -p "$subpkgdir"/"${i%/*}" mv "$i" "$subpkgdir/$i" fi done } # helper script to manually check the dependencies of subpackages verifydeps() { local _p for _p in $subpackages; do case $_p in *:*) _p=${_p%:*};; *) continue;; esac local _subdir="$pkgdir/../$_p" local _pkginfo="$pkgdir/../.control.$_p"/.PKGINFO msg "$_p" grep '^depend =' $_pkginfo || true find "$_subdir" -name '*.app' | while read -r _f; do echo " $_f" sed -n '/{runtime_dependencies/,/}/p' $_f done done } sha512sums=" 4affbd661cf444c3eadbc23e2cd4a494c953d97c0bb7ef1525f28d7a6b4a9abc1f2200f3e842f72d9a5e1dd18b1147a4433ae8038a75b86c4f7fa843d6035d22 otp_src_26.0.2.tar.gz e65ee5527e711225d8c595965b60d6d22dfb6b803d61daa108f465597366c517e858f182226a7eac6d5b0cd66fddff6df1446baeb781e50997dc1957127b2495 crypto-unload.patch "