Skip to content

Commit 74fd9ac

Browse files
feat: add armv7l and arm64 bionic based cross compiled builds
1 parent 35c710e commit 74fd9ac

File tree

8 files changed

+165
-1
lines changed

8 files changed

+165
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ This list of officially supported platforms is available in the Node.js [BUILDIN
1313
## Builds
1414

1515
* **linux-x64-musl**: Linux x64 binaries compiled against [musl libc](https://www.musl-libc.org/) version 1.1.20. Primarily useful for users of Alpine Linux 3.9 and later. Linux x64 with musl is considered "Experimental" by Node.js but the Node.js test infrastructure includes some Alpine test servers so support is generally good. These Node.js builds require the `libstdc++` package to be installed on Alpine Linux, which is not installed by default. You can add this by running `apk add libstdc++`.
16-
* **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable.
16+
* **linux-x64-glibc-217**: Linux x64, compiled with glibc 2.17 to support [older Linux distros](https://en.wikipedia.org/wiki/Glibc#Version_history), QNAP QTS 4.x and 5.x, and Synology DSM 7, and other environments where a newer glibc is unavailable.
1717
* **linux-x86**: Linux x86 (32-bit) binaries compiled against libc 2.17, similar to the way the official [linux-x64 binaries are produced](https://github.com/nodejs/node/blob/master/BUILDING.md#official-binary-platforms-and-toolchains). 32-bit Linux binaries were dropped for Node.js 10 and 32-bit support is now considered "Experimental".
1818
* **linux-armv6l**: Linux ARMv6 binaries, cross-compiled on Ubuntu 16.04 with a [custom GCC 6 toolchain](https://github.com/rvagg/rpi-newer-crosstools) (for Node.js versions earlier than 16) or Ubuntu 18.04 with a [custom GCC 8 toolchain](https://github.com/rvagg/rpi-newer-crosstools) (for Node.js 16 and later) in a similar manner to the official linux-armv7l binaries. Binaries are optimized for `armv6zk` which is suitable for Raspberry Pi devices (1, 1+ and Zero in particular). ARMv6 binaries were dropped from Node.js 12 and ARMv6 support is now considered "Experimental".
19+
* **linux-armv7l**: Linux ARMv7 binaries, cross-compiled on Ubuntu 18.04 with the default GCC-8.
20+
* **linux-arm64**: Linux ARM64 binaries, cross-compiled on Ubuntu 18.04 with the default GCC-8.
1921
* **riscv64**: Linux riscv64 (RISC-V), cross compiled on Ubuntu 20.04 with the toolchain which the Adoptium project uses (for now...). Built with --openssl-no-asm (Should be with --with-intl=none but that gets overriden)
2022
* **loong64**: Linux loong64 (LoongArch64), cross compiled on Ubuntu 20.04 with the toolchain.
2123

bin/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ recipes=" \
1414
musl \
1515
armv6l \
1616
armv6l-pre16 \
17+
armv7l \
18+
arm64 \
1719
x64-glibc-217 \
1820
x64-pointer-compression \
1921
x64-usdt \

recipes/arm64/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:18.04
2+
3+
ARG GID=1000
4+
ARG UID=1000
5+
6+
RUN addgroup --gid $GID node \
7+
&& adduser --gid $GID --uid $UID --disabled-password --gecos node node
8+
9+
RUN apt-get update \
10+
&& apt-get dist-upgrade -y \
11+
&& apt-get update \
12+
&& apt-get install -y \
13+
git \
14+
curl \
15+
gcc-8 \
16+
g++-8 \
17+
gcc-8-aarch64-linux-gnu \
18+
g++-8-aarch64-linux-gnu \
19+
binutils-aarch64-linux-gnu \
20+
make \
21+
python3 \
22+
python3-distutils \
23+
ccache \
24+
xz-utils
25+
26+
COPY --chown=node:node run.sh /home/node/run.sh
27+
28+
VOLUME /home/node/.ccache
29+
VOLUME /out
30+
VOLUME /home/node/node.tar.xz
31+
32+
USER node
33+
34+
ENTRYPOINT [ "/home/node/run.sh" ]

recipes/arm64/run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
release_urlbase="$1"
7+
disttype="$2"
8+
customtag="$3"
9+
datestring="$4"
10+
commit="$5"
11+
fullversion="$6"
12+
source_url="$7"
13+
config_flags=
14+
15+
cd /home/node
16+
17+
tar -xf node.tar.xz
18+
cd "node-${fullversion}"
19+
20+
export CC_host="ccache gcc-8"
21+
export CXX_host="ccache g++-8"
22+
export CC="ccache aarch64-linux-gnu-gcc-8"
23+
export CXX="ccache aarch64-linux-gnu-g++-8"
24+
25+
make -j$(getconf _NPROCESSORS_ONLN) binary V= \
26+
DESTCPU="arm64" \
27+
ARCH="arm64" \
28+
VARIATION="" \
29+
DISTTYPE="$disttype" \
30+
CUSTOMTAG="$customtag" \
31+
DATESTRING="$datestring" \
32+
COMMIT="$commit" \
33+
RELEASE_URLBASE="$release_urlbase" \
34+
CONFIG_FLAGS="$config_flags"
35+
36+
mv node-*.tar.?z /out/

recipes/arm64/should-build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -xe
2+
3+
__dirname=$1
4+
fullversion=$2
5+
6+
. ${__dirname}/_decode_version.sh
7+
8+
decode "$fullversion"
9+
10+
test "$major" -ge "18"

recipes/armv7l/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:18.04
2+
3+
ARG GID=1000
4+
ARG UID=1000
5+
6+
RUN addgroup --gid $GID node \
7+
&& adduser --gid $GID --uid $UID --disabled-password --gecos node node
8+
9+
RUN apt-get update \
10+
&& apt-get dist-upgrade -y \
11+
&& apt-get update \
12+
&& apt-get install -y \
13+
git \
14+
curl \
15+
gcc-8 \
16+
g++-8 \
17+
gcc-8-arm-linux-gnueabihf \
18+
g++-8-arm-linux-gnueabihf \
19+
binutils-arm-linux-gnueabihf \
20+
make \
21+
python3 \
22+
python3-distutils \
23+
ccache \
24+
xz-utils
25+
26+
COPY --chown=node:node run.sh /home/node/run.sh
27+
28+
VOLUME /home/node/.ccache
29+
VOLUME /out
30+
VOLUME /home/node/node.tar.xz
31+
32+
USER node
33+
34+
ENTRYPOINT [ "/home/node/run.sh" ]

recipes/armv7l/run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
release_urlbase="$1"
7+
disttype="$2"
8+
customtag="$3"
9+
datestring="$4"
10+
commit="$5"
11+
fullversion="$6"
12+
source_url="$7"
13+
config_flags=
14+
15+
cd /home/node
16+
17+
tar -xf node.tar.xz
18+
cd "node-${fullversion}"
19+
20+
export CC_host="ccache gcc-8 -m32"
21+
export CXX_host="ccache g++-8 -m32"
22+
export CC="ccache arm-linux-gnueabihf-gcc-8"
23+
export CXX="ccache arm-linux-gnueabihf-g++-8"
24+
25+
make -j$(getconf _NPROCESSORS_ONLN) binary V= \
26+
DESTCPU="arm" \
27+
ARCH="armv7l" \
28+
VARIATION="" \
29+
DISTTYPE="$disttype" \
30+
CUSTOMTAG="$customtag" \
31+
DATESTRING="$datestring" \
32+
COMMIT="$commit" \
33+
RELEASE_URLBASE="$release_urlbase" \
34+
CONFIG_FLAGS="$config_flags"
35+
36+
mv node-*.tar.?z /out/

recipes/armv7l/should-build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -xe
2+
3+
__dirname=$1
4+
fullversion=$2
5+
6+
. ${__dirname}/_decode_version.sh
7+
8+
decode "$fullversion"
9+
10+
test "$major" -ge "18"

0 commit comments

Comments
 (0)