Skip to content

feat: allow customization of build environment#2403

Merged
KhafraDev merged 1 commit intonodejs:mainfrom
khardix:wasm-environment
Dec 13, 2023
Merged

feat: allow customization of build environment#2403
KhafraDev merged 1 commit intonodejs:mainfrom
khardix:wasm-environment

Conversation

@khardix
Copy link
Copy Markdown
Contributor

@khardix khardix commented Nov 6, 2023

This allows for the WASM artifacts to be built elsewhere than only in the alpine-based node container.

Rationale

Pre-built WASM artifacts are often a no-go when creating packages for Linux distributions; they need to be rebuilt from source on trusted build system by the package maintainer. This PR allows me to easily tweak the build parameters and flags for the WASM build to do just that.

Changes

The build/wasm.js script now checks for presence and content of several related environment variables (WASM_CC, WASM_CFLAGS, WASM_LDFLAGS, and WASM_LDLIBS; the names mirror those traditionally used in C Makefiles). If present, content of these variables override some of the compilation flags that are directly dependent on the build environment (i.e. --target and --sysroot).

Status


Note: This is a minimal change that does what I need. I was also toying with the idea to convert the build process (without container management) to separate Makefile; this would enable the WASM build to not require nodejs on the build machine. I'm not sure this is worth it or if it's anything you would want to maintain; let me know what you think.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants