Friday, March 31, 2023

[Maintainer Update] lang/erlang/erlang.port.mk

Index: erlang.port.mk
===================================================================
RCS file: /cvs/ports/lang/erlang/erlang.port.mk,v
retrieving revision 1.32
diff -u -p -r1.32 erlang.port.mk
--- erlang.port.mk 15 Mar 2023 09:21:20 -0000 1.32
+++ erlang.port.mk 31 Mar 2023 17:45:54 -0000
@@ -19,12 +19,8 @@ FLAVORS += erlang25
FLAVOR?= # empty

# When no flavor is explicitly set, assume MODERL_DEFAULT_VERSION
-.if ${FLAVOR:Merlang21}
-ERRORS += "Invalid FLAVOR set: ${FLAVOR}."
-.else
MODERL_VERSION ?= ${MODERL_DEFAULT_VERSION}
_MODERL_FLAVOR ?= # empty
-.endif

.if ${MODERL_VERSION} == 25
_MODERL_FLAVOR = erlang25
@@ -127,6 +123,33 @@ pre-build:
@perl -pi -e 'BEGIN{undef $$/;} s/{deps,.*?]}.//smg' ${WRKSRC}/rebar.config
. endif
.endif
+
+# Add possibility to include additional build or test dependencies from
+# https://hex.pm.
+MASTER_SITE_HEX = https://repo.hex.pm/tarballs/
+
+MODERL_MASTER_SITEN = 9
+MASTER_SITES${MODERL_MASTER_SITEN} ?= ${MASTER_SITE_HEX}
+MODERL_DIST_SUBDIR ?= hex_modules
+
+. for _m _v in ${MODERL_MODULES}
+MODERL_DISTFILES += ${_m}-${_v}.tar:${MODERL_MASTER_SITEN}
+. endfor
+
+. if ! empty(MODERL_MODULES)
+. for _m _v in ${MODERL_MODULES}
+MODERL_SETUP_WORKSPACE += mkdir -p ${WRKDIR}/${MODERL_DIST_SUBDIR}/${_m}; \
+ tar xf ${FULLDISTDIR}/${_m}-${_v}.tar -C ${WRKDIR}/${MODERL_DIST_SUBDIR}/${_m}; \
+ mkdir -p ${WRKSRC}/_checkouts/${_m}; \
+ mkdir -p ${WRKSRC}/_build/default/lib; \
+ tar xzf ${WRKDIR}/${MODERL_DIST_SUBDIR}/${_m}/contents.tar.gz -C ${WRKSRC}/_checkouts/${_m}; \
+ cp -r ${WRKSRC}/_checkouts/${_m} ${WRKSRC}/_build/default/lib/;
+. endfor
+MODERLANG_post-extract += ${MODERL_SETUP_WORKSPACE}
+. endif
+
+DISTFILES += ${MODERL_DISTFILES}
+. endif

# Regression test handling:
# If nothing is explicitly set, then MODERL_TEST=Yes and default
* Remove explicit handling of erlang/21 which has been moved to the attic
* Adds a MODERL_MODULES mechanism to fetch erlang/elixir libs from
hex.pm like we do for go and rust. First consumer could be lang/lfe
if accepted.

I'll look into adapting devel/rebar3 (from which most of the ideas were
taken) if this gets accepted.

Copying op@ - I included his most recent suggestions before the 7.3
lock.

No comments:

Post a Comment