Skip to content

Commit 2fbb1dd

Browse files
committed
Add support for building riscv64
Signed-off-by: Stewart X Addison <[email protected]>
1 parent 93d9d15 commit 2fbb1dd

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

recipes/riscv64/Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM ubuntu:20.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 install -y software-properties-common \
12+
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
13+
&& apt-get update \
14+
&& apt-get install -y \
15+
git \
16+
g++-9 \
17+
curl \
18+
make \
19+
python3 \
20+
python3-distutils \
21+
ccache \
22+
xz-utils
23+
24+
RUN curl https://ci.adoptopenjdk.net/userContent/riscv/riscv_toolchain_linux64.tar.xz | tar xJf - -C /opt
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/riscv64/run.sh

+36
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-9"
21+
export CXX_host="ccache g++-9"
22+
export CC="ccache /opt/riscv_toolchain_linux/bin/riscv64-unknown-linux-gnu-gcc"
23+
export CXX="ccache /opt/riscv_toolchain_linux/bin/riscv64-unknown-linux-gnu-g++"
24+
25+
make -j$(getconf _NPROCESSORS_ONLN) binary V= \
26+
DESTCPU="riscv64" \
27+
ARCH="riscv64" \
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/riscv64/should-build.sh

+10
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 "17"

0 commit comments

Comments
 (0)