diff options
author | olgeni <olgeni@FreeBSD.org> | 2015-07-15 07:05:31 +0800 |
---|---|---|
committer | olgeni <olgeni@FreeBSD.org> | 2015-07-15 07:05:31 +0800 |
commit | 8037fc5ab20f1beb3efd1b85fd82db4e087efde9 (patch) | |
tree | a07d91ab92d03495bcf1c5b44ec8a8aff5481e07 /Mk/Uses | |
parent | 733d63c0409bfbc8aab2d5584b91bae6b28dc02e (diff) | |
download | freebsd-ports-gnome-8037fc5ab20f1beb3efd1b85fd82db4e087efde9.tar.gz freebsd-ports-gnome-8037fc5ab20f1beb3efd1b85fd82db4e087efde9.tar.zst freebsd-ports-gnome-8037fc5ab20f1beb3efd1b85fd82db4e087efde9.zip |
In elixir.mk, add MIX_REWRITE and ELIXIR_LIB_ROOT.
ELIXIR_LIB_ROOT is the default Elixir library path in LOCALBASE.
If MIX_REWRITE is defined, all optional dependencies will be stripped
out (test, doc, etc.), while all required libs will be converted to
actual code paths in ELIXIR_LIB_ROOT.
For example, it will turn the following dependency definitions:
defp deps do
[
{ :inflex, "~> 1.0" },
{ :estree, "~> 2.0" },
{ :shouldi, only: :test },
{ :earmark, "~> 0.1", only: :dev },
{ :ex_doc, "~> 0.7", only: :dev }
]
end
into these:
defp deps do
[
{ :inflex, path: "/usr/local/lib/elixir/lib/inflex", compile: false },
{ :estree, path: "/usr/local/lib/elixir/lib/estree", compile: false },
]
end
Setting MIX_REWRITE allows escriptize to bundle all dependencies in the
script, else it will not be able to pull them from the usual code path.
It already works for all Elixir ports and should make patches to mix.exs
unnecessary, but for now the default is off.
Sneak in a whitespace fix while I'm here.
Diffstat (limited to 'Mk/Uses')
-rw-r--r-- | Mk/Uses/elixir.mk | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Mk/Uses/elixir.mk b/Mk/Uses/elixir.mk index 53b352a2684f..b3dc974e04ee 100644 --- a/Mk/Uses/elixir.mk +++ b/Mk/Uses/elixir.mk @@ -9,13 +9,15 @@ # Additional variables: # # ELIXIR_APP_NAME - Elixir app name as installed in Elixir's lib directory +# ELIXIR_LIB_ROOT - Elixir default library path # ELIXIR_APP_ROOT - Root directory for this Elixir app # ELIXIR_HIDDEN - Applications to be hidden from the code path; usually ${PORTNAME} # ELIXIR_LOCALE - An UTF-8 locale to be used by Elixir during builds (any UTF-8 locale is good) # MIX_CMD - The "mix" command # MIX_COMPILE - The "mix" command used to compile an Elixir app +# MIX_REWRITE - Automatically replace Mix dependencies with code paths # MIX_BUILD_DEPS - List of BUILD_DEPENDS in category/portname format -# (commonly referenced to as "deps" in Erlang and Elixir) +# (commonly referenced to as "deps" in Erlang and Elixir) # MIX_RUN_DEPS - List of RUN_DEPENDS in category/portname format # MIX_DOC_DIRS - Extra doc directories to be installed in DOCSDIR # MIX_DOC_FILES - Extra doc files to be installed in DOCSDIR (usually README.md) @@ -37,11 +39,13 @@ IGNORE= USES=elixir does not require args .endif ELIXIR_APP_NAME?= ${PORTNAME} +ELIXIR_LIB_ROOT?= ${LOCALBASE}/lib/elixir/lib ELIXIR_APP_ROOT?= ${PREFIX}/lib/elixir/lib/${ELIXIR_APP_NAME} ELIXIR_HIDDEN?= "^${ELIXIR_APP_NAME}$$" ELIXIR_LOCALE?= en_US.UTF-8 MIX_CMD?= ${LOCALBASE}/bin/mix MIX_COMPILE?= ${SETENV} ${MIX_ENV} LANG=${ELIXIR_LOCALE} MIX_ENV=${MIX_ENV_NAME} ELIXIR_HIDDEN=${ELIXIR_HIDDEN} ${MIX_CMD} ${MIX_TARGET} +MIX_REWRITE?= MIX_BUILD_DEPS?= MIX_RUN_DEPS?= MIX_DOC_DIRS?= @@ -67,6 +71,9 @@ RUN_DEPENDS+= ${depend:T}>=0:${PORTSDIR}/${depend} .if !target(do-build) do-build: +.if ${MIX_REWRITE} != "" + @${REINPLACE_CMD} -i '' -E -e "s@{.*only: :.*},?@@; s@{ *:([a-zA-Z0-9]+), *(github:|\"~).*}@{ :\1, path: \"${ELIXIR_LIB_ROOT}/\\1\", compile: false }@" ${WRKSRC}/mix.exs +.endif @${RM} -f ${WRKSRC}/mix.lock @cd ${WRKSRC} && ${MIX_COMPILE} .for app in ${MIX_EXTRA_APPS} |