Skip to content

Commit

Permalink
Add cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
devraymondsh committed Apr 9, 2024
1 parent e4916a0 commit b187b33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/linux-daily-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ jobs:
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: arm64
cross_compiling: true
steps:
- if: ${{ matrix.cross_compiling }}
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest

- name: Update system
run: sudo apt-get update && sudo apt-get --yes upgrade

- name: Install Nodejs 21 repo
run: sudo apt-get install --yes ca-certificates curl gnupg && curl -sL https://deb.nodesource.com/setup_21.x | sudo bash - && sudo apt-get update

- name: Install building tools
run: sudo apt-get install --yes git python3 python3-pip gcc g++ make ninja-build nodejs sudo
run: sudo apt-get install --yes git python3 python3-pip gcc g++ make libz-dev linux-libc-dev ninja-build nodejs sudo

- name: Clone the repo
run: git clone https://github.com/devraymondsh/libnode-distributable
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ if (!syncFs.existsSync("node")) {
);
}

let extraArgs = [];
if (process.platform == "win32") {
await spawnAsync("vcbuild.bat", [arch, "dll"], "node");
} else {
if (arch === "arm64") extraArgs.push("--with-arm-float-abi=hard");

await spawnAsync(
"./configure",
["--ninja", "--shared", "--dest-cpu", arch, "--dest-os", os],
["--shared", ...extraArgs, "--dest-cpu", arch, "--dest-os", os],
"node"
);
await spawnAsync("make", [`-j${threadCount}`], "node");
Expand Down

0 comments on commit b187b33

Please sign in to comment.