From 1e0b6e29e1582d61188c325bc5003d8670f5074f Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Sun, 2 May 2021 19:27:43 -0400 Subject: [PATCH] add new recipe for armv6l and Node.js 16 and later Based on the existing arm6vl recipe, but using Ubuntu 18.04 and gcc/g++ 8 to match what we're using for the official armv7l builds. --- README.md | 2 +- recipes/armv6l/Dockerfile | 34 ++++++++++++++++++++++++++++++++ recipes/armv6l/run.sh | 36 ++++++++++++++++++++++++++++++++++ recipes/armv6l/should-build.sh | 10 ++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 recipes/armv6l/Dockerfile create mode 100755 recipes/armv6l/run.sh create mode 100755 recipes/armv6l/should-build.sh diff --git a/README.md b/README.md index b4981bf..be96a72 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This list of officially supported platforms is available in the Node.js [BUILDIN * **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++`. * **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". - * **linux-armv6l**: Linux ARMv6 binaries, cross-compiled on Ubuntu 16.04 with a [custom GCC 6 toolchain] 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". + * **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". "Experimental" status for Node.js is defined as: > Experimental: May not compile or test suite may not pass. The core team does not create releases for these platforms. Test failures on experimental platforms do not block releases. Contributions to improve support for these platforms are welcome. diff --git a/recipes/armv6l/Dockerfile b/recipes/armv6l/Dockerfile new file mode 100644 index 0000000..a5d0baf --- /dev/null +++ b/recipes/armv6l/Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:18.04 + +RUN addgroup --gid 1000 node \ + && adduser --gid 1000 --uid 1000 --disabled-password --gecos node node + +RUN apt-get update \ + && apt-get dist-upgrade -y \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get update \ + && apt-get install -y \ + git \ + curl \ + g++-8 \ + gcc-8 \ + gcc-8-multilib \ + g++-8-multilib \ + make \ + python3 \ + ccache \ + xz-utils + +RUN git clone --depth=1 https://github.com/rvagg/rpi-newer-crosstools \ + /opt/rpi-newer-crosstools/ + +COPY --chown=node:node run.sh /home/node/run.sh + +VOLUME /home/node/.ccache +VOLUME /out +VOLUME /home/node/node.tar.xz + +USER node + +ENTRYPOINT [ "/home/node/run.sh" ] diff --git a/recipes/armv6l/run.sh b/recipes/armv6l/run.sh new file mode 100755 index 0000000..75e67d5 --- /dev/null +++ b/recipes/armv6l/run.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -e +set -x + +release_urlbase="$1" +disttype="$2" +customtag="$3" +datestring="$4" +commit="$5" +fullversion="$6" +source_url="$7" +config_flags= + +cd /home/node + +tar -xf node.tar.xz +cd "node-${fullversion}" + +export CC_host="ccache gcc-8 -m32" +export CXX_host="ccache g++-8 -m32" +export CC="ccache /opt/rpi-newer-crosstools/x64-gcc-8.3.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-gcc -march=armv6zk" +export CXX="ccache /opt/rpi-newer-crosstools/x64-gcc-8.3.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-g++ -march=armv6zk" + +make -j$(getconf _NPROCESSORS_ONLN) binary V= \ + DESTCPU="arm" \ + ARCH="armv6l" \ + VARIATION="" \ + DISTTYPE="$disttype" \ + CUSTOMTAG="$customtag" \ + DATESTRING="$datestring" \ + COMMIT="$commit" \ + RELEASE_URLBASE="$release_urlbase" \ + CONFIG_FLAGS="$config_flags" + +mv node-*.tar.?z /out/ diff --git a/recipes/armv6l/should-build.sh b/recipes/armv6l/should-build.sh new file mode 100755 index 0000000..d900866 --- /dev/null +++ b/recipes/armv6l/should-build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -xe + +__dirname=$1 +fullversion=$2 + +. ${__dirname}/_decode_version.sh + +decode "$fullversion" + +test "$major" -ge "16"