-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add env overrides to cargo simics-build for properties specified in C…
…argo.toml
- Loading branch information
1 parent
3c429cb
commit 1697142
Showing
9 changed files
with
242 additions
and
20 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
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
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,62 @@ | ||
# hadolint global ignore=DL3033,SC3044 | ||
FROM fedora:20 | ||
|
||
ENV PATH="${PATH}:/root/.cargo/bin/" | ||
|
||
COPY .github/builder/rsrc/rust-nightly-x86_64-unknown-linux-gnu.tar.xz /install/rust-nightly-x86_64-unknown-linux-gnu.tar.xz | ||
COPY .github/builder/rsrc/make-4.4.1.tar.gz /install/make-4.4.1.tar.gz | ||
COPY .github/builder/rsrc/cmake-3.28.0-rc5-linux-x86_64.tar.gz /install/cmake-3.28.0-rc5-linux-x86_64.tar.gz | ||
COPY .github/builder/rsrc/lld-5.0.2.src.tar.xz /install/lld-5.0.2.src.tar.xz | ||
COPY .github/builder/rsrc/cfe-5.0.2.src.tar.xz /install/cfe-5.0.2.src.tar.xz | ||
COPY .github/builder/rsrc/llvm-5.0.2.src.tar.xz /install/llvm-5.0.2.src.tar.xz | ||
COPY .github/builder/rsrc/rpms /install/rpms | ||
COPY .github/builder/rsrc/simics /simics | ||
COPY .github/builder/rsrc/ispm /simics/ispm | ||
|
||
RUN yum -y install /install/rpms/*.rpm && yum clean all | ||
|
||
RUN tar -C /install -xvf /install/rust-nightly-x86_64-unknown-linux-gnu.tar.xz && \ | ||
/install/rust-nightly-x86_64-unknown-linux-gnu/install.sh && \ | ||
mkdir -p /make && \ | ||
tar -C /make --strip-components=1 -xf /install/make-4.4.1.tar.gz && \ | ||
pushd /make && \ | ||
./configure && \ | ||
make && \ | ||
make install && \ | ||
make clean && \ | ||
popd && \ | ||
tar -C /usr/local/ --strip-components=1 -xf /install/cmake-3.28.0-rc5-linux-x86_64.tar.gz && \ | ||
mkdir -p /llvm/tools/clang && \ | ||
mkdir -p /llvm/tools/lld && \ | ||
tar -C /llvm --strip-components=1 -xf /install/llvm-5.0.2.src.tar.xz && \ | ||
tar -C /llvm/tools/clang --strip-components=1 -xf /install/cfe-5.0.2.src.tar.xz && \ | ||
tar -C /llvm/tools/lld --strip-components=1 -xf /install/lld-5.0.2.src.tar.xz && \ | ||
mkdir -p /llvm/build && \ | ||
pushd /llvm/build && \ | ||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="MinSizeRel" -DLLVM_TARGETS_TO_BUILD="X86" .. && \ | ||
make -j "$(nproc)" && \ | ||
make install && \ | ||
make clean && \ | ||
rm -rf /llvm/build/ && \ | ||
popd && \ | ||
rm -rf /make /llvm | ||
|
||
WORKDIR / | ||
|
||
ENV PATH="${PATH}:/simics/ispm/" | ||
ENV PATH="${PATH}:/root/.cargo/bin/" | ||
|
||
COPY . /tsffs/ | ||
|
||
WORKDIR /tsffs/ | ||
|
||
RUN ispm settings install-dir /simics && \ | ||
ispm packages --list | ||
|
||
RUN RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=$(which ld.lld)" && \ | ||
export RUSTFLAGS && \ | ||
cargo install --path simics-rs/cargo-simics-build && \ | ||
export SIMICS_PACKAGE_VERSION="$(ispm packages --list | grep 1000 | awk '{print $3}' | cut -d '.' -f1).$(grep -E '^version = ' < Cargo.toml | sed -n '$p' | grep -oE '\"[^\"]+\"' | tr -d '\"' | cut -d'.' -f2-)" && \ | ||
cargo simics-build -r && \ | ||
mkdir -p /packages-internal && \ | ||
cp target/release/*.ispm /packages-internal |
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
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
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,109 @@ | ||
|
||
#!/bin/bash | ||
|
||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# NOTE: This script requires the Intel version of `ispm` to be installed and available | ||
# on the PATH. We do not download a new copy of it because despite its public | ||
# unavailability, we want to be able to keep this script in the public repository | ||
# without revealing any internal URLs. It will *not* work correctly with the public | ||
# version of ISPM unless you are an Intel or Wind River Simics customer. | ||
|
||
set -e | ||
|
||
LLD_URL="https://releases.llvm.org/5.0.2/lld-5.0.2.src.tar.xz" | ||
CFE_URL="https://releases.llvm.org/5.0.2/cfe-5.0.2.src.tar.xz" | ||
LLVM_SRC_URL="https://releases.llvm.org/5.0.2/llvm-5.0.2.src.tar.xz" | ||
MAKE_SRC_URL="https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz" | ||
RUST_URL="https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.xz" | ||
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.28.0-rc5/cmake-3.28.0-rc5-linux-x86_64.tar.gz" | ||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
ROOT_DIR="${SCRIPT_DIR}/../" | ||
BUILDER_DIR="${ROOT_DIR}/.github/builder/" | ||
IMAGE_NAME="tsffs-builder-internal" | ||
CONTAINER_UID=$(echo "${RANDOM}" | sha256sum | head -c 8) | ||
CONTAINER_NAME="${IMAGE_NAME}-tmp-${CONTAINER_UID}" | ||
|
||
mkdir -p "${BUILDER_DIR}/rsrc" | ||
|
||
ISPM=$(which ispm) | ||
ISPM_DIR=$(dirname "${ISPM}") | ||
|
||
if [ ! -d "${BUILDER_DIR}/rsrc/ispm" ]; then | ||
echo "ISPM not found. Copying local installation..." | ||
cp -a "${ISPM_DIR}" "${BUILDER_DIR}/rsrc/ispm" | ||
fi | ||
|
||
if [ ! -d "${BUILDER_DIR}/rsrc/simics" ]; then | ||
echo "Simics packages not found. Installing..." | ||
mkdir -p "${BUILDER_DIR}/rsrc/simics" | ||
ispm packages --install-dir "${BUILDER_DIR}/rsrc/simics" -i \ | ||
1000-latest \ | ||
1020-latest \ | ||
1030-latest \ | ||
1031-latest \ | ||
2050-latest \ | ||
2053-latest \ | ||
2096-latest \ | ||
4094-latest \ | ||
6010-latest \ | ||
7801-latest \ | ||
8112-latest \ | ||
8126-latest \ | ||
8144-latest \ | ||
--non-interactive | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/lld-5.0.2.src.tar.xz" ]; then | ||
echo "LLD not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/lld-5.0.2.src.tar.xz" \ | ||
"${LLD_URL}" | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/cfe-5.0.2.src.tar.xz" ]; then | ||
echo "CFE not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/cfe-5.0.2.src.tar.xz" \ | ||
"${CFE_URL}" | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/llvm-5.0.2.src.tar.xz" ]; then | ||
echo "LLVM not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/llvm-5.0.2.src.tar.xz" \ | ||
"${LLVM_SRC_URL}" | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/make-4.4.1.tar.gz" ]; then | ||
echo "Make not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/make-4.4.1.tar.gz" \ | ||
"${MAKE_SRC_URL}" | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/rust-nightly-x86_64-unknown-linux-gnu.tar.xz" ]; then | ||
echo "rust not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/rust-nightly-x86_64-unknown-linux-gnu.tar.xz" \ | ||
"${RUST_URL}" | ||
fi | ||
|
||
if [ ! -f "${BUILDER_DIR}/rsrc/cmake-3.28.0-rc5-linux-x86_64.tar.gz" ]; then | ||
echo "CMake not found. Downloading..." | ||
curl --noproxy '*.intel.com' -L -o "${BUILDER_DIR}/rsrc/cmake-3.28.0-rc5-linux-x86_64.tar.gz" \ | ||
"${CMAKE_URL}" | ||
fi | ||
|
||
if [ ! -d "${BUILDER_DIR}/rsrc/rpms" ]; then | ||
echo "RPM dependencies not found. Downloading..." | ||
# NOTE: This may stop working at some point, as Fedora 20 is EOL. Therefore, we download the | ||
# packages with the expectation that we will provide them separately if they are no longer | ||
# available. | ||
docker run -v "${BUILDER_DIR}/rsrc/rpms:/rpms" fedora:20 bash -c \ | ||
'yum -y update && yum install --downloadonly --downloaddir=/rpms coreutils gcc gcc-c++ make which && chmod -R 755 /rpms/' | ||
fi | ||
|
||
unset SIMICS_BASE | ||
docker build \ | ||
-t "${IMAGE_NAME}" -f "${BUILDER_DIR}/Dockerfile-internal" "${ROOT_DIR}" | ||
docker create --name "${CONTAINER_NAME}" "${IMAGE_NAME}" bash | ||
mkdir -p "${ROOT_DIR}/packages-internal" | ||
docker cp "${CONTAINER_NAME}:/packages-internal" "${ROOT_DIR}/" | ||
docker rm -f "${CONTAINER_NAME}" |
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
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,5 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
ispm packages --list-installed --json | jq -r '.installedPackages[] | select(.pkgNumber == 1000) | .version' | tac | grep -v pre | sed -ne '/6.0.163/,$ p' |
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