Changeset View
Changeset View
Standalone View
Standalone View
head/Mk/Uses/erlang.mk
| Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
| .if ${erlang_ARGS:Mrebar} | .if ${erlang_ARGS:Mrebar} | ||||
| ERLANG_COMPILE= ${REBAR_CMD} | ERLANG_COMPILE= ${REBAR_CMD} | ||||
| .endif | .endif | ||||
| .if ${erlang_ARGS:Mrebar3} | .if ${erlang_ARGS:Mrebar3} | ||||
| ERLANG_COMPILE= ${REBAR3_CMD} | ERLANG_COMPILE= ${REBAR3_CMD} | ||||
| .endif | .endif | ||||
| .if !target(post-patch) | _USES_patch+= 650:post-patch-erlang | ||||
| post-patch: post-patch-erlang | |||||
| .endif | |||||
| .if !target(do-build) | |||||
| do-build: do-build-erlang | |||||
| .endif | |||||
| .if !target(do-install) | |||||
| do-install: do-install-erlang | |||||
| .endif | |||||
| post-patch-erlang: | post-patch-erlang: | ||||
| @${FIND} ${WRKSRC} -name .gitignore -delete | @${FIND} ${WRKSRC} -name .gitignore -delete | ||||
| # Attempt to remove all traces of {vsn, ....}; replace with actual PORTVERSION | # Attempt to remove all traces of {vsn, ....}; replace with actual PORTVERSION | ||||
| @if [ -f ${WRKSRC}/src/${ERL_APP_NAME}.app.src ]; then \ | @if [ -f ${WRKSRC}/src/${ERL_APP_NAME}.app.src ]; then \ | ||||
| ${REINPLACE_CMD} -i '' -e 's/{ *vsn,.*}/{vsn, "${PORTVERSION}"}/' \ | ${REINPLACE_CMD} -i '' -e 's/{ *vsn,.*}/{vsn, "${PORTVERSION}"}/' \ | ||||
| ${WRKSRC}/src/${ERL_APP_NAME}.app.src; \ | ${WRKSRC}/src/${ERL_APP_NAME}.app.src; \ | ||||
| fi | fi | ||||
| @if [ -f ${WRKSRC}/ebin/${ERL_APP_NAME}.app ]; then \ | @if [ -f ${WRKSRC}/ebin/${ERL_APP_NAME}.app ]; then \ | ||||
| ${REINPLACE_CMD} -i '' -e 's/{ *vsn,.*}/{vsn, "${PORTVERSION}"}/' \ | ${REINPLACE_CMD} -i '' -e 's/{ *vsn,.*}/{vsn, "${PORTVERSION}"}/' \ | ||||
| ${WRKSRC}/ebin/${ERL_APP_NAME}.app; \ | ${WRKSRC}/ebin/${ERL_APP_NAME}.app; \ | ||||
| fi | fi | ||||
| @${GREP} -l "%%LOCALBASE%%" $$(${FIND} ${WRKSRC}) \ | @${GREP} -l "%%LOCALBASE%%" $$(${FIND} ${WRKSRC}) \ | ||||
| | ${XARGS} ${REINPLACE_CMD} -i '' -e "s@%%LOCALBASE%%@${LOCALBASE}@" | | ${XARGS} ${REINPLACE_CMD} -i '' -e "s@%%LOCALBASE%%@${LOCALBASE}@" | ||||
| @${GREP} -l "%%PORTVERSION%%" $$(${FIND} ${WRKSRC}) \ | @${GREP} -l "%%PORTVERSION%%" $$(${FIND} ${WRKSRC}) \ | ||||
| | ${XARGS} ${REINPLACE_CMD} -i '' -e "s@%%PORTVERSION%%@${PORTVERSION}@" | | ${XARGS} ${REINPLACE_CMD} -i '' -e "s@%%PORTVERSION%%@${PORTVERSION}@" | ||||
| # Always try to build with the system version of rebar and rebar3 | # Always try to build with the system version of rebar and rebar3 | ||||
| @if [ -f ${WRKSRC}/rebar.config ]; then \ | @if [ -f ${WRKSRC}/rebar.config ]; then \ | ||||
| ${REINPLACE_CMD} -i '' -e "s@\./rebar3@${REBAR3_CMD}@; s@\./rebar@${REBAR_CMD}@" \ | ${REINPLACE_CMD} -i '' -e "s@\./rebar3@${REBAR3_CMD}@; s@\./rebar@${REBAR_CMD}@" \ | ||||
| ${WRKSRC}/rebar.config; \ | ${WRKSRC}/rebar.config; \ | ||||
| fi | fi | ||||
| @${RM} -f ${WRKSRC}/src/*.orig ${WRKSRC}/include/*.orig | @${RM} -f ${WRKSRC}/src/*.orig ${WRKSRC}/include/*.orig | ||||
| do-build-erlang: | .if !target(do-build) | ||||
| do-build: | |||||
| # This will cause calls to local rebar and rebar3 to fail; makes it easier to spot them | # This will cause calls to local rebar and rebar3 to fail; makes it easier to spot them | ||||
| @${RM} -f ${WRKSRC}/rebar ${WRKSRC}/rebar3 | @${RM} -f ${WRKSRC}/rebar ${WRKSRC}/rebar3 | ||||
| .for target in ${REBAR_TARGETS} | .for target in ${REBAR_TARGETS} | ||||
| # Remove rebar.lock every time - it can be created again after each run of rebar3 | # Remove rebar.lock every time - it can be created again after each run of rebar3 | ||||
| @${RM} ${WRKSRC}/rebar.lock | @${RM} ${WRKSRC}/rebar.lock | ||||
| @cd ${WRKSRC} && REBAR_PROFILE=${REBAR_PROFILE} ${ERLANG_COMPILE} ${target} | @cd ${WRKSRC} && REBAR_PROFILE=${REBAR_PROFILE} ${ERLANG_COMPILE} ${target} | ||||
| .endfor | .endfor | ||||
| .endif # !target(do-build) | |||||
| do-install-erlang: | .if !target(do-install) | ||||
| do-install: | |||||
| @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT} | @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT} | ||||
| @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/src | @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/src | ||||
| cd ${WRKSRC}/src && ${COPYTREE_SHARE} \* ${STAGEDIR}${ERL_APP_ROOT}/src | cd ${WRKSRC}/src && ${COPYTREE_SHARE} \* ${STAGEDIR}${ERL_APP_ROOT}/src | ||||
| @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/ebin | @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/ebin | ||||
| .if ${erlang_ARGS:Mrebar3} | .if ${erlang_ARGS:Mrebar3} | ||||
| ${INSTALL_DATA} ${WRKSRC}/_build/${ERL_BUILD_NAME}/lib/${ERL_APP_NAME}/ebin/* \ | ${INSTALL_DATA} ${WRKSRC}/_build/${ERL_BUILD_NAME}/lib/${ERL_APP_NAME}/ebin/* \ | ||||
| ${STAGEDIR}${ERL_APP_ROOT}/ebin | ${STAGEDIR}${ERL_APP_ROOT}/ebin | ||||
| .else | .else | ||||
| Show All 16 Lines | else \ | ||||
| ${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}; \ | ${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}; \ | ||||
| fi | fi | ||||
| .endfor | .endfor | ||||
| .endif # .if ${ERL_DOCS} != "" | .endif # .if ${ERL_DOCS} != "" | ||||
| .if ${REBAR_TARGETS:Mescriptize} | .if ${REBAR_TARGETS:Mescriptize} | ||||
| @${MKDIR} ${STAGEDIR}${PREFIX}/bin | @${MKDIR} ${STAGEDIR}${PREFIX}/bin | ||||
| ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin | ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin | ||||
| .endif | .endif | ||||
| .endif # !target(do-install) | |||||
| .endif #!defined(_INCLUDE_USES_ERLANG_MK) | .endif #!defined(_INCLUDE_USES_ERLANG_MK) | ||||