diff --git a/README.md b/README.md index 76c809055..b52dd2d15 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,14 @@ still be able to [build from source](docs/build-from-source.md). - Linux + Linux macOS Windows x64 arm64 + arm x64 arm64 x64 @@ -57,6 +58,7 @@ still be able to [build from source](docs/build-from-source.md). ✓ ✓ ✓ + ✓ 22 @@ -65,6 +67,7 @@ still be able to [build from source](docs/build-from-source.md). ✓ ✓ ✓ + ✓ diff --git a/docs/build-from-source.md b/docs/build-from-source.md index 55b050de8..b1a4481db 100644 --- a/docs/build-from-source.md +++ b/docs/build-from-source.md @@ -50,10 +50,11 @@ The supported cross-compilation directions are: - MacOS arm64 ➡️ MacOS x64 - MacOS x64 ➡️ ️MacOS arm64 - Linux x64 ➡️ Linux arm64 +- Linux x64 ➡️ Linux arm (32-bit, e.g. Raspberry Pi 3B+) To run e.g. that that cross-compilation: -1. Set `TARGET_ARCH` to "arm64" +1. Set `TARGET_ARCH` to "arm64" (or "arm" for 32-bit ARM) 2. Re-run `npm run build` ### Debug Builds diff --git a/package.json b/package.json index 0f2b7f3ad..ff001e2af 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "optionalDependencies": { "@roamhq/wrtc-darwin-arm64": "0.10.0", "@roamhq/wrtc-darwin-x64": "0.10.0", + "@roamhq/wrtc-linux-arm": "0.10.0", "@roamhq/wrtc-linux-arm64": "0.10.0", "@roamhq/wrtc-linux-x64": "0.10.0", "@roamhq/wrtc-win32-x64": "0.10.0", diff --git a/prebuilds/linux-arm/README.md b/prebuilds/linux-arm/README.md new file mode 100644 index 000000000..8968deb96 --- /dev/null +++ b/prebuilds/linux-arm/README.md @@ -0,0 +1,4 @@ +# wrtc + +This is the Linux 32-bit ARM binary build for @roamhq/wrtc. +See https://github.com/WonderInventions/node-webrtc for details. diff --git a/prebuilds/linux-arm/index.js b/prebuilds/linux-arm/index.js new file mode 100644 index 000000000..5d7fe8d9c --- /dev/null +++ b/prebuilds/linux-arm/index.js @@ -0,0 +1,2 @@ +"use strict"; +module.exports = require("./wrtc.node"); diff --git a/prebuilds/linux-arm/package.json b/prebuilds/linux-arm/package.json new file mode 100644 index 000000000..eae009bb2 --- /dev/null +++ b/prebuilds/linux-arm/package.json @@ -0,0 +1,16 @@ +{ + "name": "@roamhq/wrtc-linux-arm", + "version": "0.10.0", + "description": "The Linux 32-bit ARM binary for @roamhq/wrtc.", + "repository": { + "type": "git", + "url": "git+https://github.com/WonderInventions/node-webrtc.git" + }, + "license": "BSD-2-Clause", + "os": [ + "linux" + ], + "cpu": [ + "arm" + ] +} diff --git a/shell.nix b/shell.nix index 5f55f6762..55b2e4f1a 100644 --- a/shell.nix +++ b/shell.nix @@ -23,8 +23,11 @@ let nativeBuildInputs = (with pkgs; [ cmake + curl + git ninja nodejs_22 + perl pkg-config zlib # For stripping binaries for release @@ -41,6 +44,7 @@ let ]) ++ (lib.optionals (!is-darwin) [ (llvm pkgs.pkgsCross.aarch64-multiplatform.buildPackages).clang + (llvm pkgs.pkgsCross.armv7l-hf-multiplatform.buildPackages).clang ]); # Build variables based on documentation from https://github.com/timniederhausen/gn-build/blob/01c96fd9981b111a3a028356284968acd77fa435/README.md shellHook = diff --git a/toolchains/linux-arm.toolchain b/toolchains/linux-arm.toolchain new file mode 100644 index 000000000..9cf46acbe --- /dev/null +++ b/toolchains/linux-arm.toolchain @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(CMAKE_C_COMPILER armv7l-unknown-linux-gnueabihf-clang) +set(CMAKE_CXX_COMPILER armv7l-unknown-linux-gnueabihf-clang++)