Skip to content

Commit b1b497e

Browse files
Amanieuyetist
authored andcommitted
Promote OpenHarmony targets to tier 2
MCP: rust-lang/compiler-team#719
1 parent 81719c7 commit b1b497e

File tree

13 files changed

+148
-1
lines changed

13 files changed

+148
-1
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,21 @@ jobs:
212212
- name: dist-loongarch64-linux
213213
os: ubuntu-20.04-8core-32gb
214214
env: {}
215+
- name: dist-mips-linux
216+
os: ubuntu-20.04-xl
217+
env: {}
218+
- name: dist-mips64-linux
219+
os: ubuntu-20.04-xl
220+
env: {}
221+
- name: dist-mips64el-linux
222+
os: ubuntu-20.04-xl
223+
env: {}
224+
- name: dist-mipsel-linux
225+
os: ubuntu-20.04-xl
226+
env: {}
227+
- name: dist-ohos
228+
os: ubuntu-20.04-8core-32gb
229+
env: {}
215230
- name: dist-powerpc-linux
216231
os: ubuntu-20.04-8core-32gb
217232
env: {}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM ubuntu:23.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
ninja-build \
8+
file \
9+
curl \
10+
ca-certificates \
11+
python3 \
12+
git \
13+
cmake \
14+
sudo \
15+
gdb \
16+
libssl-dev \
17+
pkg-config \
18+
xz-utils \
19+
unzip \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
COPY scripts/ohos-sdk.sh /scripts/
23+
RUN sh /scripts/ohos-sdk.sh
24+
25+
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang.sh /usr/local/bin/
26+
COPY scripts/ohos/aarch64-unknown-linux-ohos-clang++.sh /usr/local/bin/
27+
COPY scripts/ohos/armv7-unknown-linux-ohos-clang.sh /usr/local/bin/
28+
COPY scripts/ohos/armv7-unknown-linux-ohos-clang++.sh /usr/local/bin/
29+
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang.sh /usr/local/bin/
30+
COPY scripts/ohos/x86_64-unknown-linux-ohos-clang++.sh /usr/local/bin/
31+
32+
# env
33+
ENV TARGETS=aarch64-unknown-linux-ohos
34+
ENV TARGETS=$TARGETS,armv7-unknown-linux-ohos
35+
ENV TARGETS=$TARGETS,x86_64-unknown-linux-ohos
36+
37+
ENV \
38+
CC_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang.sh \
39+
AR_aarch64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
40+
CXX_aarch64_unknown_linux_ohos=/usr/local/bin/aarch64-unknown-linux-ohos-clang++.sh
41+
ENV \
42+
CC_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang.sh \
43+
AR_armv7_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
44+
CXX_armv7_unknown_linux_ohos=/usr/local/bin/armv7-unknown-linux-ohos-clang++.sh
45+
ENV \
46+
CC_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang.sh \
47+
AR_x86_64_unknown_linux_ohos=/opt/ohos-sdk/native/llvm/bin/llvm-ar \
48+
CXX_x86_64_unknown_linux_ohos=/usr/local/bin/x86_64-unknown-linux-ohos-clang++.sh
49+
50+
ENV RUST_CONFIGURE_ARGS \
51+
--enable-profiler \
52+
--disable-docs
53+
54+
ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
55+
56+
COPY scripts/sccache.sh /scripts/
57+
RUN sh /scripts/sccache.sh

src/ci/docker/scripts/ohos-sdk.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
URL=https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz
5+
6+
curl $URL | tar xz -C /tmp ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
7+
mkdir /opt/ohos-sdk
8+
cd /opt/ohos-sdk
9+
unzip -qq /tmp/ohos-sdk/linux/native-linux-x64-4.0.10.13-Release.zip
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
3+
-target aarch64-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
"$@"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang \
3+
-target aarch64-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
"$@"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
3+
-target arm-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
-march=armv7-a \
7+
-mfloat-abi=softfp \
8+
-mtune=generic-armv7-a \
9+
-mthumb \
10+
"$@"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang \
3+
-target arm-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
-march=armv7-a \
7+
-mfloat-abi=softfp \
8+
-mtune=generic-armv7-a \
9+
-mthumb \
10+
"$@"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang++ \
3+
-target x86_64-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
"$@"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
exec /opt/ohos-sdk/native/llvm/bin/clang \
3+
-target x86_64-linux-ohos \
4+
--sysroot=/opt/ohos-sdk/native/sysroot \
5+
-D__MUSL__ \
6+
"$@"

src/ci/github-actions/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,21 @@ jobs:
375375
- name: dist-loongarch64-linux
376376
<<: *job-linux-8c
377377

378+
- name: dist-mips-linux
379+
<<: *job-linux-xl
380+
381+
- name: dist-mips64-linux
382+
<<: *job-linux-xl
383+
384+
- name: dist-mips64el-linux
385+
<<: *job-linux-xl
386+
387+
- name: dist-mipsel-linux
388+
<<: *job-linux-xl
389+
390+
- name: dist-ohos
391+
<<: *job-linux-8c
392+
378393
- name: dist-powerpc-linux
379394
<<: *job-linux-8c
380395

src/doc/rustc/src/platform-support.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ target | std | notes
130130
`aarch64-fuchsia` | ✓ | Alias for `aarch64-unknown-fuchsia`
131131
`aarch64-unknown-fuchsia` | ✓ | ARM64 Fuchsia
132132
[`aarch64-linux-android`](platform-support/android.md) | ✓ | ARM64 Android
133+
[`aarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARM64 OpenHarmony
133134
`aarch64-unknown-none-softfloat` | * | Bare ARM64, softfloat
134135
`aarch64-unknown-none` | * | Bare ARM64, hardfloat
135136
[`aarch64-unknown-uefi`](platform-support/unknown-uefi.md) | * | ARM64 UEFI
@@ -144,6 +145,7 @@ target | std | notes
144145
`armv7-unknown-linux-gnueabi` | ✓ | ARMv7-A Linux (kernel 4.15, glibc 2.27)
145146
`armv7-unknown-linux-musleabi` | ✓ | ARMv7-A Linux with MUSL
146147
`armv7-unknown-linux-musleabihf` | ✓ | ARMv7-A Linux with MUSL, hardfloat
148+
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | ARMv7-A OpenHarmony
147149
`armv7a-none-eabi` | * | Bare ARMv7-A
148150
`armv7r-none-eabi` | * | Bare ARMv7-R
149151
`armv7r-none-eabihf` | * | Bare ARMv7-R, hardfloat
@@ -189,6 +191,7 @@ target | std | notes
189191
[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
190192
`x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/11, illumos
191193
`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
194+
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | x86_64 OpenHarmony
192195
[`x86_64-unknown-none`](platform-support/x86_64-unknown-none.md) | * | Freestanding/bare-metal x86_64, softfloat
193196
`x86_64-unknown-redox` | ✓ | Redox OS
194197
[`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | * | 64-bit UEFI

src/doc/rustc/src/platform-support/openharmony.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# `*-unknown-linux-ohos`
22

3-
**Tier: 3**
3+
**Tier: 2**
44

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

88
## Target maintainers
99

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

1213
## Setup
1314

src/tools/build-manifest/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static TARGETS: &[&str] = &[
5858
"aarch64-unknown-hermit",
5959
"aarch64-unknown-linux-gnu",
6060
"aarch64-unknown-linux-musl",
61+
"aarch64-unknown-linux-ohos",
6162
"aarch64-unknown-none",
6263
"aarch64-unknown-none-softfloat",
6364
"aarch64-unknown-redox",
@@ -78,6 +79,7 @@ static TARGETS: &[&str] = &[
7879
"thumbv7neon-unknown-linux-gnueabihf",
7980
"armv7-unknown-linux-musleabi",
8081
"armv7-unknown-linux-musleabihf",
82+
"armv7-unknown-linux-ohos",
8183
"armebv7r-none-eabi",
8284
"armebv7r-none-eabihf",
8385
"armv7r-none-eabi",
@@ -153,6 +155,7 @@ static TARGETS: &[&str] = &[
153155
"x86_64-unknown-linux-gnu",
154156
"x86_64-unknown-linux-gnux32",
155157
"x86_64-unknown-linux-musl",
158+
"x86_64-unknown-linux-ohos",
156159
"x86_64-unknown-netbsd",
157160
"x86_64-unknown-none",
158161
"x86_64-unknown-redox",

0 commit comments

Comments
 (0)