aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses
diff options
context:
space:
mode:
authorolgeni <olgeni@FreeBSD.org>2015-07-03 21:59:45 +0800
committerolgeni <olgeni@FreeBSD.org>2015-07-03 21:59:45 +0800
commit44890354e2e572dd9ffc8f7a41c7119c2b3bed57 (patch)
treedfb76b0071a760024c9beafea8e79bfca55d0cd1 /Mk/Uses
parent39b42d21122ca4b2336414a5494a3dfe595e5609 (diff)
downloadfreebsd-ports-gnome-44890354e2e572dd9ffc8f7a41c7119c2b3bed57.tar.gz
freebsd-ports-gnome-44890354e2e572dd9ffc8f7a41c7119c2b3bed57.tar.zst
freebsd-ports-gnome-44890354e2e572dd9ffc8f7a41c7119c2b3bed57.zip
Add a new USES elixir.mk (from lang/elixir/bsd.elixir.mk) and
adjust all Elixir ports.
Diffstat (limited to 'Mk/Uses')
-rw-r--r--Mk/Uses/elixir.mk112
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)