Skip to content

Commit

Permalink
Promote OpenHarmony targets to tier 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Feb 11, 2024
1 parent 11f32b7 commit 4b4974d
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ jobs:
- name: dist-loongarch64-linux
os: ubuntu-20.04-8core-32gb
env: {}
- name: dist-ohos
os: ubuntu-20.04-8core-32gb
env: {}
- name: dist-powerpc-linux
os: ubuntu-20.04-8core-32gb
env: {}
Expand Down
58 changes: 58 additions & 0 deletions src/ci/docker/host-x86_64/dist-ohos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM ubuntu:23.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
ninja-build \
file \
curl \
ca-certificates \
python3 \
git \
cmake \
sudo \
gdb \
libssl-dev \
pkg-config \
xz-utils \
unzip \
&& rm -rf /var/lib/apt/lists/*

COPY ohos-sdk-windows_linux-public.tar.gz /tmp
COPY scripts/ohos-sdk.sh /scripts/
RUN sh /scripts/ohos-sdk.sh

COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/

# env
ENV TARGETS=aarch64-unknown-linux-ohos
ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos
ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos

ENV \
CC_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang.sh \
AR_aarch64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang++.sh
ENV \
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh
ENV \
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh

ENV RUST_CONFIGURE_ARGS \
--enable-profiler \
--disable-docs

ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
9 changes: 9 additions & 0 deletions src/ci/docker/scripts/ohos-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -ex

URL=https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz

curl $URL | tar xz -C /tmp ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
mkdir /opt/ohos-sdk
cd /opt/ohos-sdk
unzip -qq /tmp/ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
-target aarch64-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang \
-target aarch64-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
"$@"
10 changes: 10 additions & 0 deletions src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang++.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
-target arm-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
-march=armv7-a \
-mfloat-abi=softfp \
-mtune=generic-armv7-a \
-mthumb \
"$@"
10 changes: 10 additions & 0 deletions src/ci/docker/scripts/ohos/armv7-unknown-linux-ohos-clang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang \
-target arm-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
-march=armv7-a \
-mfloat-abi=softfp \
-mtune=generic-armv7-a \
-mthumb \
"$@"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
-target x86_64-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
"$@"
6 changes: 6 additions & 0 deletions src/ci/docker/scripts/ohos/x86_64-unknown-linux-ohos-clang.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
exec /opt/ohos-sdk/native/llvm/bin/clang \
-target x86_64-linux-ohos \
--sysroot=/opt/ohos-sdk/native/sysroot \
-D__MUSL__ \
"$@"
3 changes: 3 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ jobs:
- name: dist-loongarch64-linux
<<: *job-linux-8c

- name: dist-ohos
<<: *job-linux-8c

- name: dist-powerpc-linux
<<: *job-linux-8c

Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ target | std | notes
`aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia`
[`aarch64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | ARM64 Fuchsia
[`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARM64 OpenHarmony
`aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat
`aarch64-unknown-none` | * | Bare ARM64, hardfloat
[`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | * | ARM64 UEFI
Expand All @@ -157,6 +158,7 @@ target | std | notes
`armv7-unknown-linux-gnueabi` | ✓ | ARMv7-A Linux (kernel 4.15, glibc 2.27)
`armv7-unknown-linux-musleabi` | ✓ | ARMv7-A Linux with MUSL
`armv7-unknown-linux-musleabihf` | ✓ | ARMv7-A Linux with MUSL, hardfloat
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARMv7-A OpenHarmony
[`armv7a-none-eabi`](platform-support/arm-none-eabi.md) | * | Bare ARMv7-A
[`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R
[`armv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Bare ARMv7-R, hardfloat
Expand Down Expand Up @@ -199,6 +201,7 @@ target | std | notes
[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
`x86_64-pc-solaris` | ✓ | 64-bit Solaris 11, illumos
`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | x86_64 OpenHarmony
[`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | Freestanding/bare-metal x86_64, softfloat
`x86_64-unknown-redox` | ✓ | Redox OS
[`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | * | 64-bit UEFI
Expand Down Expand Up @@ -244,7 +247,6 @@ target | std | host | notes
[`aarch64-kmc-solid_asp3`](platform-support/kmc-solid.md) | ✓ | | ARM64 SOLID with TOPPERS/ASP3
[`aarch64-nintendo-switch-freestanding`](platform-support/aarch64-nintendo-switch-freestanding.md) | * | | ARM64 Nintendo Switch, Horizon
[`aarch64-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | ✓ |
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARM64 OpenHarmony |
[`aarch64-unknown-teeos`](platform-support/aarch64-unknown-teeos.md) | ? | | ARM64 TEEOS |
[`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS |
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
Expand All @@ -269,7 +271,6 @@ target | std | host | notes
[`armv6-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | ARMv6 NetBSD w/hard-float
[`armv6k-nintendo-3ds`](platform-support/armv6k-nintendo-3ds.md) | ? | | ARMv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain)
[`armv7-sony-vita-newlibeabihf`](platform-support/armv7-sony-vita-newlibeabihf.md) | ✓ | | ARMv7-A Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain)
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARMv7-A OpenHarmony |
[`armv7-unknown-linux-uclibceabi`](platform-support/armv7-unknown-linux-uclibceabi.md) | ✓ | ✓ | ARMv7-A Linux with uClibc, softfloat
[`armv7-unknown-linux-uclibceabihf`](platform-support/armv7-unknown-linux-uclibceabihf.md) | ✓ | ? | ARMv7-A Linux with uClibc, hardfloat
`armv7-unknown-freebsd` | ✓ | ✓ | ARMv7-A FreeBSD
Expand Down Expand Up @@ -372,7 +373,6 @@ target | std | host | notes
`x86_64-unknown-haiku` | ✓ | ✓ | 64-bit Haiku
[`x86_64-unknown-hermit`](platform-support/hermit.md) | ✓ | | x86_64 Hermit
`x86_64-unknown-l4re-uclibc` | ? | |
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | x86_64 OpenHarmony |
[`x86_64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 64-bit OpenBSD
`x86_64-uwp-windows-gnu` | ✓ | |
`x86_64-uwp-windows-msvc` | ✓ | |
Expand Down
3 changes: 2 additions & 1 deletion src/doc/rustc/src/platform-support/openharmony.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# `*-unknown-linux-ohos`

**Tier: 3**
**Tier: 2**

Targets for the [OpenHarmony](https://gitee.com/openharmony/docs/) operating
system.

## Target maintainers

- Amanieu d'Antras ([@Amanieu](https://github.com/Amanieu))
- Lu Binglun ([@lubinglun](https://github.com/lubinglun))

## Setup

Expand Down
3 changes: 3 additions & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static TARGETS: &[&str] = &[
"aarch64-unknown-hermit",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-ohos",
"aarch64-unknown-none",
"aarch64-unknown-none-softfloat",
"aarch64-unknown-redox",
Expand All @@ -79,6 +80,7 @@ static TARGETS: &[&str] = &[
"thumbv7neon-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabi",
"armv7-unknown-linux-musleabihf",
"armv7-unknown-linux-ohos",
"armebv7r-none-eabi",
"armebv7r-none-eabihf",
"armv7r-none-eabi",
Expand Down Expand Up @@ -160,6 +162,7 @@ static TARGETS: &[&str] = &[
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-gnux32",
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-ohos",
"x86_64-unknown-netbsd",
"x86_64-unknown-none",
"x86_64-unknown-redox",
Expand Down

0 comments on commit 4b4974d

Please sign in to comment.