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 authored and yetist committed Jun 3, 2024
1 parent 54d2067 commit 171d4cd
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ jobs:
- name: dist-mipsel-linux
os: ubuntu-20.04-xl
env: {}
- name: dist-ohos
os: ubuntu-20.04-8core-32gb
env: {}
- name: dist-powerpc-linux
os: ubuntu-20.04-xl
env: {}
Expand Down
57 changes: 57 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,57 @@
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 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 @@ -369,6 +369,9 @@ jobs:
- name: dist-mipsel-linux
<<: *job-linux-xl

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

- name: dist-powerpc-linux
<<: *job-linux-xl

Expand Down
3 changes: 3 additions & 0 deletions src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ target | std | notes
`aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia`
`aarch64-unknown-fuchsia` | ✓ | 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 @@ -142,6 +143,7 @@ target | std | notes
`armv7-unknown-linux-gnueabi` | ✓ |ARMv7 Linux (kernel 4.15, glibc 2.27)
`armv7-unknown-linux-musleabi` | ✓ |ARMv7 Linux with MUSL
`armv7-unknown-linux-musleabihf` | ✓ | ARMv7 Linux with MUSL, hardfloat
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARMv7-A OpenHarmony
`armv7a-none-eabi` | * | Bare ARMv7-A
`armv7r-none-eabi` | * | Bare ARMv7-R
`armv7r-none-eabihf` | * | Bare ARMv7-R, hardfloat
Expand Down Expand Up @@ -187,6 +189,7 @@ target | std | notes
[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
`x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/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
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 @@
# `*-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 @@ -58,6 +58,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 @@ -78,6 +79,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 @@ -153,6 +155,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 171d4cd

Please sign in to comment.