Hi,

I would like to get some opinions from the OE experts regarding the recommended structure of npm recipes. I have test different solutions but need some advice.

npm could be used to build a web browser application or a Node.js application: 1) A build of a *web browser application* with npm generates code for a web browser. This code is architecture independent and doesn’t need Node.js at runtime. The build may need compiled native binary dependencies during build time. Thereby the native binary dependencies are built before the build of source code itself. The source code of the binaries is part of the dependencies. 2) A build of a *Node.js application* with npm generates code for Node.js. This code is often architecture independent and need Node.js at runtime. The build and/or the runtime may need compiled native binary dependencies during build time and/or target binary dependencies during runtime. Thereby the native binary dependencies are built before the build of the source code itself and the target binary dependencies are built afterwards. A Node.js application without target binary dependencies is target independent.

A build of a npm application consists of four build steps and every step is optional:
1) Build the native dependencies (npm rebuild --arch=${BUILD_ARCH})
2) Build the source code (npm run-script build)
3) Run tests (npm run-script test)
4) Build the target dependencies (npm rebuild --arch=${TARGET_ARCH})

I see four possible solutions:
1) Build the native binaries and source code via a target or allarch recipe inside extra tasks. 2) Build the native binaries and source code via a native recipe and transfer its output via native sysroot or image directory to a target or allarch recipe as input. 3) Build all native dependencies via a native recipe and use its node_modules directory inside a target or allarch recipe. 4) Only build the native binary dependencies via a single native recipe or individual native recipes and use the node_modules from these native packages inside a target or allarch recipe.

I don't like the solution 1) because it repeats every step for every target arch. The solution 2) is strange because the target recipe doesn’t depends on the source code itself. The solution 3) is bad because it leads to native recipes that only copy dependencies into the sysroot. In both solutions every dependency change leads to rebuild of two recipes. I prefer the solution 4) but it leads to more code inside the recipe tool because it has to identify binary dependencies and have to remove this dependencies and its sub dependencies. On the other side this npm packages could need target specific patches and a specific recipe could simplify this process.

Regards
  Stefan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#158477): 
https://lists.openembedded.org/g/openembedded-core/message/158477
Mute This Topic: https://lists.openembedded.org/mt/87141771/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to