Solved Failure not found when building port

I am making a port of the Joplin server backend. I can build the server manually, but I am having trouble converting the steps into a Makefile for ports. When it is time to run yarn to build the application, I get the error that yarn cannot be found. I have modeled my Makefile from deskutils/Joplin-Desktop and the supplied dockerfile. But I do not see where I am going wrong.

I have read the Mk/Uses/npm.mk file, and it seems like there should be a ${WRKDIR}/.bin folder with yarn installed. However, that directory doesn't exist. I only see a ${WRKSRC}/yarn/4.16.0/yarn.js file when it is time to run yarn.

Makefile:
PORTNAME=    joplin
DISTVERSIONPREFIX=    server-v
DISTVERSION=    3.7.2
CATEGORIES=    textproc
PKGNAMESUFFIX=    -server


MAINTANIER=    ports@freebsd.com
COMMENT=    Server Backend for the Joplin Notetaking application
WWW=        https://joplinapp.org/

LICENSE=    MIT

FETCH_DEPENDS=  npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
BUILD_DEPENDS=  npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
LIB_DEPENDS=    libvips.so:graphics/vips

USE_GITHUB=    yes
GH_ACCOUNT= laurent22
GH_TUPLE=   rollup:rollup:v4.9.1:rollup/rollup

USES=        cargo gmake nodejs:24,build,run npm:yarn4,build,fetch python:build
USE_RC_SUBR=    ${PORTNAME}

NPM_VER=    4.16.0

USERS=        joplin
GROUPS=        joplin

CARGO_CARGOTOML_ROLLUP= ${WRKSRC}/rollup/rust/Cargo.toml
CARGO_CARGOLOCK_ROLLUP= ${WRKSRC}/rollup/rust/Cargo.lock
CARGO_CARGOTOML=    ${CARGO_CARGOTOML_ROLLUP}
CARGO_CARGOLOCK=    ${CARGO_CARGOLOCK_ROLLUP}
CARGO_CARGOLOCKS=   ${CARGO_CARGOLOCK_ROLLUP}

CARGO_BUILD=    no
CARGO_INSTALL=    no
CARGO_TEST=    no

TARGET_ORDER_OVERRIDE=  750:npm-install-node-modules

post-extract:
    ${MKDIR} ${WRKDIR}/${PORTNAME}/.yarn
    ${MKDIR} ${WRKDIR}/${PORTNAME}/packages/fork-sax
    ${CP} ${WRKSRC}/gulpfile.js ${WRKDIR}/${PORTNAME}/
    ${CP} ${WRKSRC}/lerna.json ${WRKDIR}/${PORTNAME}/
    ${CP} ${WRKSRC}/package.json ${WRKDIR}/${PORTNAME}/
    ${CP} ${WRKSRC}/tsconfig.json ${WRKDIR}/${PORTNAME}/
    ${CP} ${WRKSRC}/yarn.lock ${WRKDIR}/${PORTNAME}/
    ${CP} ${WRKSRC}/.env-sample ${WRKDIR}/${PORTNAME}/joplin.config.sample
    ${CP} ${WRKSRC}/.yarnrc.yml ${WRKDIR}/${PORTNAME}/
    ${CP} -r ${WRKSRC}/packages/fork-htmlparser2 ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/fork-sax/package.json ${WRKDIR}/${PORTNAME}/packages/fork-sax/
    ${CP} -r ${WRKSRC}/packages/fork-uslug ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/htmlpack ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/lib ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/renderer ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/turndown-plugin-gfm ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/turndown ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/server ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/tools ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/packages/utils ${WRKDIR}/${PORTNAME}/packages/
    ${CP} -r ${WRKSRC}/.yarn/releases ${WRKDIR}/${PORTNAME}/.yarn
    ${CP} -r ${WRKSRC}/.yarn/patches ${WRKDIR}/${PORTNAME}/.yarn
    ${CP} -r ${WRKSRC}/rollup ${WRKDIR}/${PORTNAME}
    ${CP} -r ${WRKSRC}/cargo-crates ${WRKDIR}/${PORTNAME}
    ${RM} -rf ${WRKSRC}
    ${MV} ${WRKDIR}/${PORTNAME} ${WRKSRC}

pre-build:
    # Build rollup and copy the resulting native node module
    cd ${WRKSRC}/rollup/rust && \
    ${SETENV} ${MAKE_ENV} ${CARGO_ENV} ${CARGO} build \
        --manifest-path ${CARGO_CARGOTOML_ROLLUP} \
        --release --verbose --verbose
    ${MKDIR} ${WRKSRC}/packages/turndown/node_modules/rollup/dist/rollup.freebsd-x64.node
    ${CP} ${CARGO_TARGET_DIR}/*/libbindings_napi.so \
        ${WRKSRC}/packages/turndown/node_modules/rollup/dist/rollup.freebsd-x64.node
do-build:
    (cd ${WRKSRC} && \
        ${SETENV} ${MAKE_ENV} ${NPM_CMDNAME} install --inline-builds)

Also, I don't develop Node applications, and this is my first attempt at making a port. Thanks for your feedback!
 
It doesn't need www/yarn installed? If that makes no difference, what happens if you make work/bin a symlink to /usr/local/bin where yarn is?
 
It doesn't need www/yarn installed? If that makes no difference, what happens if you make work/bin a symlink to /usr/local/bin where yarn is?
/usr/local/bin should already be in the path, so I shouldn't need to do that, right? I haven't seen any other port make a symlink to yarn so I didn't think to try that.
 
/usr/local/bin should already be in the path, so I shouldn't need to do that, right? I haven't seen any other port make a symlink to yarn so I didn't think to try that.
I'm not saying you need to use that but what happens if you just make any yarn within reach?

I tried to build deskutils/joplin-desktop. Works but it breaks at some mysql component that can't be fetched. Before that, the make output seems to build its own yarn version. The entire make throws strange characters in my xterm...

web-textprocessor messing up with the underlining. Need reset button...
 
I just changed the call for yarn to /usr/local/bin/yarn and it failed as not found. I am testing this via poudriere, so it may not be installed there.

Joplin-desktop builds a-ok for me… I just built it this morning. The strange characters might be from the yarn build process.
 
I just changed the call for yarn to /usr/local/bin/yarn and it failed as not found. I am testing this via poudriere, so it may not be installed there.
You may need to add yarn to BUILD_DEPENDS if it is not installed by other ports like npm24 already.

You can check like so from Poudriere jail shell:
pkg info -x yarn

Note that I don't have experience with npm/node ports, maybe you can discuss this with the maintainer of the Joplin desktop port, tagattie@.
 
You may need to add yarn to BUILD_DEPENDS if it is not installed by other ports like npm24 already.

You can check like so from Poudriere jail shell:
pkg info -x yarn

Note that I don't have experience with npm/node ports, maybe you can discuss this with the maintainer of the Joplin desktop port, tagattie@.
I thought USES = npm:yarn4,build,fetch would install it for me.

pkg returned "no package(s) matching yarn"
 
I found the problem. The npm.mk file is looking for the package.json files in files/packagejosons. Once I put a copy of them out yarn was dropped in the work director and yarn would run. I added the ${NPM_VER} line to avoid doing that. I probably could set ${PKGJSONSDIR} to ${WRKSRC} and it would work. I may try that but now I am on to my next problem.
 
Back
Top