freebsd-ports/www/yarn-node18/Makefile
Po-Chuan Hsieh fa93fdc383
Framework: Rewrite nodejs.mk and reorganize www/{node,npm,yarn}
The current USES=nodejs has the following issues:
- www/node is not the default version while www/node16 is.
- It also means inconsistent naming of node ports.
- www/npm duplicates with www/npm-node16.
- www/yarn duplicates with www/yarn-node16.

The notable changes are introduced to fix the above issues:
- Rewrite Mk/Uses/nodejs.mk.
- Add new LTS version of nodejs (www/noe18).
- Add new current version of nodejs (www/node19).
- Change default nodejs version from 16 to 18 (latest LTS).
- Use consistent naming for all supported node versions.
- Convert www/node, www/npm and www/yarn to meta ports.

After this commit:
- All supported node versions are named as node{14,16,18,19}
- www/node is a meta port which depends on the default version (e.g. www/node18)
- www/npm is a meta port which depends on the default version (e.g. www/npm-node18)
- www/yarn is a meta port which depends on the default version (e.g. www/yarn-node18)
- Bump PORTREVISION of dependent ports for dependency change (from www/node16 to www/node18)

Discussed with:	jrm, otis, pizzamig
2023-01-30 22:20:38 +08:00

52 lines
1.3 KiB
Makefile

PORTNAME= yarn
DISTVERSIONPREFIX= v
PORTVERSION= 1.22.18
CATEGORIES= www
MASTER_SITES= https://yarnpkg.com/downloads/${PORTVERSION}/
PKGNAMESUFFIX= ${NODEJS_SUFFIX}
MAINTAINER= pizzamig@FreeBSD.org
COMMENT= Package manager for node, alternative to npm
WWW= https://classic.yarnpkg.com/
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES?= nodejs:18,run
USES+= cpe
CPE_VENDOR= ${PORTNAME}pkg
CONFLICTS_INSTALL= yarn-node[0-9][0-9]
OPTIONS_DEFINE= HADOOPCOMPAT
HADOOPCOMPAT_DESC= hadoop2 compatibility, the yarn script is excluded
OPTIONS_SUB= yes
HADOOPCOMPAT_CONFLICTS_INSTALL_OFF= hadoop2*
NO_ARCH= yes
NO_BUILD= yes
post-patch:
@${RM} ${WRKSRC}/bin/*.cmd
@${REINPLACE_CMD} -i '' \
-e 's|"installationMethod": "tar"|"installationMethod": "pkg"|g' \
${WRKSRC}/package.json
@${REINPLACE_CMD} -i '' -e 's%Linux)%Linux|FreeBSD)%g' \
${WRKSRC}/bin/yarn
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/lib/node_modules/yarn
(cd ${WRKSRC}/ && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/node_modules/yarn)
${RLN} ${STAGEDIR}${PREFIX}/lib/node_modules/yarn/bin/yarn.js \
${STAGEDIR}${PREFIX}/bin/yarn.js
${RLN} ${STAGEDIR}${PREFIX}/lib/node_modules/yarn/bin/yarnpkg \
${STAGEDIR}${PREFIX}/bin/yarnpkg
do-install-HADOOPCOMPAT-off:
${RLN} ${STAGEDIR}${PREFIX}/lib/node_modules/yarn/bin/yarn \
${STAGEDIR}${PREFIX}/bin/yarn
.include <bsd.port.mk>