diff options
author | Jimmy Olgeni <olgeni@FreeBSD.org> | 2015-07-03 13:59:45 +0000 |
---|---|---|
committer | Jimmy Olgeni <olgeni@FreeBSD.org> | 2015-07-03 13:59:45 +0000 |
commit | 708b7d3bf92dfceedff71e4dcd581a3f182ea4eb (patch) | |
tree | dfb76b0071a760024c9beafea8e79bfca55d0cd1 /Mk | |
parent | e2de40bbc7014dd32d2941415559dcba791766f7 (diff) | |
download | ports-708b7d3bf92dfceedff71e4dcd581a3f182ea4eb.tar.gz ports-708b7d3bf92dfceedff71e4dcd581a3f182ea4eb.zip |
Notes
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Uses/elixir.mk | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/Mk/Uses/elixir.mk b/Mk/Uses/elixir.mk new file mode 100644 index 000000000000..fed8ea3cf8be --- /dev/null +++ b/Mk/Uses/elixir.mk @@ -0,0 +1,112 @@ +# $FreeBSD$ +# +# Handle Elixir related ports +# +# Feature: elixir +# Usage: USES=elixir +# Valid ARGS: does not require args +# +# Additional variables: +# +# ELIXIR_APP_NAME - Elixir app name as installed in Elixir's lib directory +# 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_BUILD_DEPS - List of BUILD_DEPENDS in category/portname format +# (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) +# MIX_ENV_NAME - Name of the Mix build environment, usually "prod" +# MIX_BUILD_NAME - Name of the build output in _build/, usually ${MIX_ENV_NAME} +# MIX_EXTRA_APPS - List of sub-applications to be built, if any +# MIX_EXTRA_DIRS - List of extra directories to be installed in ELIXIR_APP_ROOT +# MIX_EXTRA_FILES - List of extra files to be installed in ELIXIR_APP_ROOT +# +# MAINTAINER: olgeni@FreeBSD.org + +.if !defined(_INCLUDE_USES_ELIXIR_MK) +_INCLUDE_USES_ELIXIR_MK=yes + +.if !empty(elixir_ARGS) +IGNORE= USES=elixir does not require args +.endif + +ELIXIR_APP_NAME?= ${PORTNAME} +ELIXIR_APP_ROOT?= ${PREFIX}/lib/elixir/lib/${ELIXIR_APP_NAME} +ELIXIR_HIDDEN?= ${PORTNAME} +ELIXIR_LOCALE?= en_US.UTF-8 +MIX_CMD?= ${LOCALBASE}/bin/mix +MIX_COMPILE?= LANG=${ELIXIR_LOCALE} MIX_ENV=${MIX_ENV_NAME} ELIXIR_HIDDEN=${ELIXIR_HIDDEN} ${MIX_CMD} compile +MIX_BUILD_DEPS?= +MIX_RUN_DEPS?= +MIX_DOC_DIRS?= +MIX_DOC_FILES?= README.md +MIX_ENV_NAME?= prod +MIX_BUILD_NAME?= prod +MIX_EXTRA_APPS?= +MIX_EXTRA_DIRS?= +MIX_EXTRA_FILES?= + +BUILD_DEPENDS+= elixir:${PORTSDIR}/lang/elixir +RUN_DEPENDS+= elixir:${PORTSDIR}/lang/elixir + +.for depend in ${MIX_BUILD_DEPS} +BUILD_DEPENDS+= ${depend:T}>=0:${PORTSDIR}/${depend} +.endfor + +.for depend in ${MIX_RUN_DEPS} +RUN_DEPENDS+= ${depend:T}>=0:${PORTSDIR}/${depend} +.endfor + +.if !target(do-build) +do-build: do-build-elixir +.endif + +.if !target(do-install) +do-install: do-install-elixir +.endif + +do-build-elixir: + @${RM} -f ${WRKSRC}/mix.lock + @cd ${WRKSRC} && ${MIX_COMPILE} +.for app in ${MIX_EXTRA_APPS} + @${RM} -f ${WRKSRC}/${app}/mix.lock + @cd ${WRKSRC}/${app} && ${MIX_COMPILE} +.endfor + +do-install-elixir: + @${MKDIR} ${STAGEDIR}${ELIXIR_APP_ROOT} + @${MKDIR} ${STAGEDIR}${ELIXIR_APP_ROOT}/lib + cd ${WRKSRC}/lib && ${COPYTREE_SHARE} \* ${STAGEDIR}${ELIXIR_APP_ROOT}/lib + @${MKDIR} ${STAGEDIR}${ELIXIR_APP_ROOT}/ebin + ${INSTALL_DATA} ${WRKSRC}/_build/${MIX_BUILD_NAME}/lib/${ELIXIR_APP_NAME}/ebin/* \ + ${STAGEDIR}${ELIXIR_APP_ROOT}/ebin + if [ -d ${WRKSRC}/priv ]; then \ + ${MKDIR} ${STAGEDIR}${ELIXIR_APP_ROOT}/priv; \ + cd ${WRKSRC}/priv && ${COPYTREE_SHARE} \* ${STAGEDIR}${ELIXIR_APP_ROOT}/priv; \ + fi +.if ${MIX_DOC_FILES} != "" || ${MIX_DOC_DIRS} != "" + @${MKDIR} ${STAGEDIR}${DOCSDIR} +.endif +.for file in ${MIX_DOC_FILES} + ${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR} +.endfor +.for dir in ${MIX_DOC_DIRS} + cd ${WRKSRC} && ${COPYTREE_SHARE} ${dir} ${STAGEDIR}${DOCSDIR} +.endfor +.for file in ${MIX_EXTRA_FILES} + ${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${ELIXIR_APP_ROOT} +.endfor +.for dir in ${MIX_EXTRA_DIRS} + @${MKDIR} ${STAGEDIR}${ELIXIR_APP_ROOT}/${dir} + cd ${WRKSRC}/${dir} && ${COPYTREE_SHARE} . ${STAGEDIR}${ELIXIR_APP_ROOT}/${dir} +.endfor +.for app in ${MIX_EXTRA_APPS} + ${INSTALL_DATA} ${WRKSRC}/${app}/_build/${MIX_BUILD_NAME}/lib/*/ebin/* \ + ${STAGEDIR}${ELIXIR_APP_ROOT}/ebin +.endfor + +.endif #!defined(_INCLUDE_USES_ELIXIR_MK) |