On 3/7/23 11:26, Omar Polo wrote:
Yeah, it should help.  I suspect most upstream will just use `rebar3'.
Will test this later when i'll get the time to look at the erlang
update, but it's ok op@ if someone wants to go ahead with it in the
meantime (provided it doesn't break other ports.)

Would you be willing to give the attached diff to erlang.port.mk a shot? That would enable us to bundle Erlang dependencies much like we do for Go, Rust etc. if needed for i.e. testing.

It doesn't cause any fallout for net/rabbitmq, lang/elixir, devel/rebar3 (from which it was largely ripped anyway).

I'm attaching a version of the lang/lfe that builds and tests fine with it ...
Index: erlang.port.mk
===================================================================
RCS file: /cvs/ports/lang/erlang/erlang.port.mk,v
retrieving revision 1.31
diff -u -p -r1.31 erlang.port.mk
--- erlang.port.mk	16 Jan 2023 18:27:29 -0000	1.31
+++ erlang.port.mk	7 Mar 2023 20:08:46 -0000
@@ -42,7 +42,7 @@ MODERL_BUILD_DEPENDS +=	devel/rebar3
 REBAR_BIN ?=		${LOCALBASE}/bin/rebar3-${MODERL_VERSION}
 # Make sure rebar gets called as 'rebar3', otherwise escript tries to call the
 # binary name (e.g. rebar3-25) as the script entrypoint.
-_MODERL_LINKS +=	rebar3-${MODERL_VERSION} rebar
+_MODERL_LINKS +=	rebar3-${MODERL_VERSION} rebar3
 .endif
 
 # Append the flavor to all the Erlang dependencies
@@ -115,20 +115,44 @@ pre-configure:
 .endif
 .endif
 
-.if ${CONFIGURE_STYLE:L} == "rebar" || ${CONFIGURE_STYLE:L} == "rebar3"
+.if ${CONFIGURE_STYLE:L} == "rebar3"
 # Some modules bundle their own rebar escript, force them to use the system
 # rebar instead.
-# While here, remove the deps{} block from rebar.config, we cannot download
-# dependencies on the fly (blocked by systrace) and it obfuscates dependency
-# management from the ports Makefile.
 .  if ! target(pre-build)
 pre-build:
-	@cp -f ${REBAR_BIN} ${WRKSRC}/rebar
-	@perl -pi -e 'BEGIN{undef $$/;} s/{deps,.*?]}.//smg' ${WRKSRC}/rebar.config
+	@cp -f ${REBAR_BIN} ${WRKSRC}/rebar3
 .  endif
 .endif
 
-# Regression test handing:
+# Add possibility to include additional build or test dependencies from 
+# https://hex.pm. Shamelessly ripped off from go.port.mk and devel/rebar3.
+MASTER_SITE_ATHENS =	https://repo.hex.pm/tarballs/
+
+MODERL_MASTER_SITEN =	9
+MASTER_SITES${MODERL_MASTER_SITEN} ?= ${MASTER_SITE_ATHENS}
+
+.  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}/${_m}; \
+		tar xf ${FULLDISTDIR}/${_m}-${_v}.tar -C ${WRKDIR}/${_m}; \
+		mkdir -p ${WRKSRC}/_checkouts/${_m}; \
+		mkdir -p ${WRKSRC}/_build/default/lib; \
+		tar xzf ${WRKDIR}/${_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
+
+
+.  if defined(MODERL_DISTFILES)
+DISTFILES += ${MODERL_DISTFILES}
+.  endif
+
+# Regression test handling:
 # If nothing is explicitly set, then MODERL_TEST=Yes and default
 # target 'test' is used. Otherwise, if MODERL_TEST=eunit, then
 # TEST_TARGET=eunit

Attachment: lfe-with-hexmodules.tar.gz
Description: application/gzip

Reply via email to