H
hukadan
Guest
Hello,
I have been trying to make a port for NodeBB, a forum software using Node.js. Once the project has been fetched, you also need to install dependencies (a lot of them) using the
As a workaround, I did a really dirty hack by creating a directory in distfiles and then ran
Have you got any idea about how this could be handled in a better way ? Of course I tried to look to other Node.js based ports but the few I saw had the same issue (https://svnweb.freebsd.org/ports/head/misc/teslams/Makefile?view=markup) or no dependencies.
Here is the Makefile (that's my first port attempt so all comments/advises are welcome) :
Thank you.
I have been trying to make a port for NodeBB, a forum software using Node.js. Once the project has been fetched, you also need to install dependencies (a lot of them) using the
npm install
command. But when building with poudriere(8), you have access to the network only during (pre/post-)fetch phase. And so, npm install
command will fail.As a workaround, I did a really dirty hack by creating a directory in distfiles and then ran
npm install
during a post-fetch phase while the network is still avaible. At the end, the port build and install just fine. But this solution looks really ugly to me.Have you got any idea about how this could be handled in a better way ? Of course I tried to look to other Node.js based ports but the few I saw had the same issue (https://svnweb.freebsd.org/ports/head/misc/teslams/Makefile?view=markup) or no dependencies.
Here is the Makefile (that's my first port attempt so all comments/advises are welcome) :
Code:
# Created by: Hukadan <hukadan@xxxxx>
# $FreeBSD$
PORTNAME= nodebb
PORTVERSION= 1.0.3
DISTVERSIONPREFIX= v
CATEGORIES= www
MAINTAINER= hukadan@xxxxxxxx
COMMENT= Node.js based bulletin board / discussion forum system
LICENSE= GPLv3
FETCH_DEPENDS= npm>=3.0.0:www/npm \
git:devel/git
RUN_DEPENDS= npm>=3.0.0:www/npm
USERS= _pma
NODEBB_USERNAME= ${USERS}
WRKSRC= ${WRKDIR}/NodeBB-${PORTVERSION}
NPMDIR= ${DISTDIR}/npm-trick
NO_ARCH= yes
NO_BUILD= yes
PLIST_SUB= NODEBB_USERNAME=${NODEBB_USERNAME}
USE_GITHUB= yes
GH_ACCOUNT= nodebb
USE_RC_SUBR= nodebb
USES= shebangfix
SHEBANG_FILES= nodebb
SHEBANG_LANG= node
node_OLD_CMD= "/usr/bin/env node"
node_CMD= ${LOCALBASE}/bin/node
post-fetch:
@${MKDIR} ${NPMDIR}
@cd ${NPMDIR} && ${TAR} -xf ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
@cd ${NPMDIR}/NodeBB-${PORTVERSION} && ${SETENV} npm install
do-install:
@${MKDIR} ${STAGEDIR}${WWWDIR}
@cd ${NPMDIR}/NodeBB-${PORTVERSION} && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}
post-install:
@${CHMOD} +x ${STAGEDIR}${WWWDIR}/${PORTNAME}
@${RM} -Rf ${NPMDIR}
.include <bsd.port.mk>
Thank you.