svn commit: r392109 - head/Mk/Uses

Jimmy Olgeni olgeni at FreeBSD.org
Tue Jul 14 23:05:32 UTC 2015


Author: olgeni
Date: Tue Jul 14 23:05:31 2015
New Revision: 392109
URL: https://svnweb.freebsd.org/changeset/ports/392109

Log:
  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.

Modified:
  head/Mk/Uses/elixir.mk

Modified: head/Mk/Uses/elixir.mk
==============================================================================
--- head/Mk/Uses/elixir.mk	Tue Jul 14 23:03:07 2015	(r392108)
+++ head/Mk/Uses/elixir.mk	Tue Jul 14 23:05:31 2015	(r392109)
@@ -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 arg
 .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}
 
 .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}


More information about the svn-ports-all mailing list