-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
141 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 OR ISC | ||
|
||
FROM ubuntu:24.04 | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
VOLUME ["/aws_lc_rs"] | ||
|
||
WORKDIR / | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y ca-certificates build-essential cmake git wget curl jq unzip clang sudo && \ | ||
apt-get autoremove --purge -y && \ | ||
apt-get clean && \ | ||
apt-get autoclean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
rm -rf /tmp/* | ||
|
||
RUN mkdir /ohos && \ | ||
wget --progress=dot:giga https://repo.huaweicloud.com/openharmony/os/5.0.0-Release/ohos-sdk-windows_linux-public.tar.gz && \ | ||
wget https://repo.huaweicloud.com/openharmony/os/5.0.0-Release/ohos-sdk-windows_linux-public.tar.gz.sha256 && \ | ||
diff <(sha256sum ohos-sdk-windows_linux-public.tar.gz | cut -d ' ' -f 1) ohos-sdk-windows_linux-public.tar.gz.sha256 && \ | ||
tar zxvf ohos-sdk-windows_linux-public.tar.gz -C /ohos && \ | ||
cd /ohos/linux && \ | ||
unzip native-linux-x64-5.0.0.*-Release.zip && \ | ||
rm -rf /ohos/windows /ohos/linux/*.zip | ||
|
||
RUN useradd -m docker | ||
USER docker | ||
RUN cd "${HOME}" && \ | ||
git config --global --add safe.directory '*' && \ | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ./rustup.sh && \ | ||
chmod +x ./rustup.sh && \ | ||
./rustup.sh -y && \ | ||
. "${HOME}/.cargo/env" && \ | ||
cargo install --locked bindgen-cli && \ | ||
rustup component add rustfmt clippy && \ | ||
rustup target add aarch64-unknown-linux-ohos armv7-unknown-linux-ohos x86_64-unknown-linux-ohos && \ | ||
rm ./rustup.sh | ||
|
||
COPY aws_lc_rs_build.sh / | ||
COPY entry.sh / | ||
|
||
ENV CMAKE_TOOLCHAIN_FILE=/ohos/linux/native/build/cmake/ohos.toolchain.cmake | ||
ENV OHOS_NDK_HOME=/ohos/linux | ||
ENV OHOS_SDK_NATIVE=/ohos/linux/native | ||
|
||
ENTRYPOINT ["/entry.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 OR ISC | ||
|
||
set -ex -o pipefail | ||
|
||
. "${HOME}/.cargo/env" | ||
SRC_DIR="${SRC_DIR:-/aws_lc_rs}" | ||
|
||
pushd "${SRC_DIR}" | ||
|
||
declare -A target_map | ||
target_map[aarch64-unknown-linux-ohos]="aarch64-linux-ohos" | ||
target_map[armv7-unknown-linux-ohos]="arm-linux-ohos" | ||
target_map[x86_64-unknown-linux-ohos]="x86_64-linux-ohos" | ||
|
||
function build_ohos_targets() { | ||
for target in aarch64-unknown-linux-ohos armv7-unknown-linux-ohos x86_64-unknown-linux-ohos | ||
do | ||
export CPATH=/ohos/linux/native/sysroot/usr/include/:/ohos/linux/native/sysroot/usr/include/${target_map[${target}]} | ||
cargo build -p aws-lc-rs --target ${target} | ||
cargo clean | ||
done | ||
} | ||
|
||
cargo clean | ||
build_ohos_targets | ||
unset CMAKE_TOOLCHAIN_FILE | ||
build_ohos_targets | ||
unset OHOS_NDK_HOME | ||
build_ohos_targets | ||
|
||
popd # ${SRC_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 OR ISC | ||
|
||
set -ex | ||
|
||
# Ubuntu: | ||
# sudo apt-get install jq | ||
|
||
# Amazon Linux: | ||
# sudo yum install jq | ||
|
||
# Log Docker hub limit https://docs.docker.com/docker-hub/download-rate-limit/#how-can-i-check-my-current-rate | ||
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token) | ||
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest | ||
|
||
EXTRA_ARGS=() | ||
if [[ -n "${GOPROXY:+x}" ]]; then | ||
EXTRA_ARGS=("--build-arg" "GOPROXY=${GOPROXY}" "${EXTRA_ARGS[@]}") | ||
fi | ||
|
||
docker build -t ohos:5.0.0 . --load "${EXTRA_ARGS[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 OR ISC | ||
|
||
set -ex -o pipefail | ||
|
||
/aws_lc_rs_build.sh "${argv[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters