Skip to content

Commit 6fe0cad

Browse files
committed
Enable building of RV64 distribution file
1 parent 1a2baee commit 6fe0cad

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

common/Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
# This dockerfile creates a reproducible build environment for mold.
22
#
33
# $ docker buildx create --use
4-
# $ docker buildx build --platform x86_64,aarch64,arm,ppc64le,s390x -t rui314/mold-builder:latest --push .
4+
# $ docker buildx build --platform x86_64,aarch64,arm,ppc64le,s390x -t rui314/mold-builder:latest --push - < common/Dockerfile
55

66
FROM ubuntu:18.04
7-
ENV TZ=Europe/London
87
RUN apt-get update && \
98
apt-get install -y --no-install-recommends software-properties-common && \
109
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
1110
apt-get update && \
12-
apt-get install -y --no-install-recommends build-essential wget libstdc++-11-dev zlib1g-dev gcc-10 g++-10 python3 libssl-dev && \
11+
DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y --no-install-recommends build-essential wget libstdc++-11-dev gcc-10 g++-10 python3 libssl-dev && \
1312
\
1413
mkdir /cmake && cd /cmake && \
1514
wget -O- -q https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2.tar.gz | tar --strip-components=1 -xzf - && \
1615
./bootstrap --parallel=$(nproc) && make -j$(nproc) && make -j$(nproc) install && \
17-
rm -rf /var/lib/apt/lists/* /cmake
16+
rm -rf /var/lib/apt/lists /cmake

common/Dockerfile.riscv64

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This dockerfile creates a reproducible build environment for mold.
2+
#
3+
# $ docker build --platform riscv64 -t rui314/mold-builder-riscv64:latest --push - < common/Dockerfile.riscv64
4+
5+
FROM riscv64/ubuntu:20.04
6+
RUN apt-get update && \
7+
DEBIAN_FRONTEND=noninteractive TZ=UTC apt-get install -y --no-install-recommends build-essential gcc-10 g++-10 cmake && \
8+
rm -rf /var/lib/apt/lists

dist.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,28 @@ case $# in
1616
arch="$1"
1717
;;
1818
*)
19-
echo "Usage: $0 [ x86_64 | aarch64 | arm | ppc64le | s390x ]"
19+
echo "Usage: $0 [ x86_64 | aarch64 | arm | riscv64 | ppc64le | s390x ]"
2020
exit 1
2121
esac
2222

23-
echo "$arch" | grep -Eq '^(x86_64|aarch64|arm|ppc64le|s390x)$' || \
23+
echo "$arch" | grep -Eq '^(x86_64|aarch64|arm|riscv64|ppc64le|s390x)$' || \
2424
{ echo "Error: no docker image for $arch"; exit 1; }
2525

2626
version=$(sed -n 's/^project(mold VERSION \(.*\))/\1/p' $(dirname $0)/CMakeLists.txt)
2727
dest=mold-$version-$arch-linux
2828
set -e -x
2929

30+
if [ $arch = riscv64 ]; then
31+
image=rui314/mold-builder-riscv64
32+
else
33+
image=rui314/mold-builder
34+
fi
35+
3036
docker run --platform linux/$arch -i --rm -v "$(pwd):/mold" \
31-
-e "OWNER=$(id -u):$(id -g)" rui314/mold-builder:latest \
32-
bash -c "mkdir /tmp/build &&
33-
cd /tmp/build &&
34-
cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DMOLD_MOSTLY_STATIC=On -DCMAKE_BUILD_TYPE=Release /mold &&
37+
-e "OWNER=$(id -u):$(id -g)" $image:latest \
38+
bash -c "mkdir /build &&
39+
cd /build &&
40+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DMOLD_MOSTLY_STATIC=On /mold &&
3541
cmake --build . -j\$(nproc) &&
3642
[ $arch = arm ] || ctest -j\$(nproc) &&
3743
cmake --install . --prefix $dest --strip &&

0 commit comments

Comments
 (0)