--- erlang.port.mk.orig Mon Mar 13 19:12:36 2023
+++ erlang.port.mk Mon Mar 13 19:21:38 2023
@@ -124,6 +124,35 @@
. endif
.endif
+# Add possibility to include additional build or test dependencies from
+# https://hex.pm. Ripped 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}
+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
+
+
+. 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
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 13 Mar 2023 18:47:36 -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,16 @@ 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:
+# 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
Hi Omar,
> I'd commit this
[...]
> and this separatedly from the rest. These two bits are just cleaning.
> No port has CONFIGURE_STYLE=rebar and noone seems to use `rebar'.
Right, devel/rebar has been removed along with database/riak, so that
part can be gc'd. I'm attaching that as a separate patch.
>> # Some modules bundle their own rebar escript, force them to use the system
>> # rebar instead.
>
> How much of this is still true? Only lang/elixir and the proposed
> lang/lfe have CONFIGURE_STYLE=rebar3 and none provides this rebar3
> script. Could be gc'd?
It probably can, but I haven't tried *porting* that many erlang modules
yet. It certainly isn't a problem when locally pulling in modules from
hex.pm.
With erlang 26 on the horizon, I was planning to do some additional
spring cleaning here soon. Definitely not for 7.3, though.
> but what's the impact of the change? If an update grows more
> dependencies rebar will still try to fetch them at build time? Isn't
> it better to keep the deps block remvoal (which I guess triggers an
> error during the build)?
My thinking was that when that happens, I'd rather see a failure with
the URL of the missing dependency rather than just the erlang equivalent
of a "missing include".
> I'd drop the "Shamelessly" part ;)
[...]
> One last nitpick: I'd stuff the MODERL_DISTFILES in a subdir, much
> like we have go_modules/ for go. See MODGO_DIST_SUBDIR in go.port.mk
Done and done :-)
The two patches should apply in the order
1. -cleanup-rebar3.diff
2. -hexmodules.diff
Thanks!
Volker
No comments:
Post a Comment