11#! /bin/bash
2- # UPDATED FOR LEVEL-ZERO COMMIT BUILD - $(date)
32set -e
43set -x
54set -o pipefail
@@ -48,18 +47,16 @@ function get_release() {
4847function get_pre_release_igfx() {
4948 URL=$1
5049 HASH=$2
51- echo " *** USING UPDATED get_pre_release_igfx FUNCTION - COMMIT: $( date) ***"
50+ # echo "*** USING UPDATED get_pre_release_igfx FUNCTION - COMMIT: $(date) ***"
5251 HEADER=" "
5352 if [ " $GITHUB_TOKEN " != " " ]; then
5453 HEADER=" Authorization: Bearer $GITHUB_TOKEN "
5554 fi
56-
57- # Ensure we're in a writable directory
55+
5856 WORK_DIR=" /tmp/igc-download"
5957 mkdir -p " $WORK_DIR "
6058 cd " $WORK_DIR "
61-
62- echo " === NEW IGC DOWNLOAD FUNCTION - Downloading IGC dev package to $WORK_DIR ==="
59+
6360 if ! curl -L -H " $HEADER " -H " Accept: application/vnd.github.v3+json" " $URL " -o " $HASH .zip" ; then
6461 echo " ERROR: Failed to download IGC dev package"
6562 return 1
@@ -88,83 +85,32 @@ function get_pre_release_igfx() {
8885 rm -rf " $WORK_DIR "
8986}
9087
91- # function get_commit_artifacts() {
92- # REPO=$1
93- # COMMIT=$2
94- # HEADER=""
95- # if [ "$GITHUB_TOKEN" != "" ]; then
96- # HEADER="Authorization: Bearer $GITHUB_TOKEN"
97- # fi
98- # # Get artifacts from GitHub Actions for the specific commit
99- # curl -s -L -H "$HEADER" -H "Accept: application/vnd.github.v3+json" \
100- # "https://api.github.com/repos/${REPO}/actions/runs?head_sha=${COMMIT}&status=completed&per_page=1" \
101- # | jq -r '.workflow_runs[0] | select(.conclusion == "success") | .id' \
102- # | head -1 \
103- # | xargs -I {} curl -s -L -H "$HEADER" -H "Accept: application/vnd.github.v3+json" \
104- # "https://api.github.com/repos/${REPO}/actions/runs/{}/artifacts" \
105- # | jq -r '.artifacts[] | select(.name | test(".*deb.*")) | .archive_download_url'
106- # }
107-
108- # function download_commit_artifacts() {
109- # REPO=$1
110- # COMMIT=$2
111- # UBUNTU_VER=$3
112- # HEADER=""
113- # if [ "$GITHUB_TOKEN" != "" ]; then
114- # HEADER="Authorization: Bearer $GITHUB_TOKEN"
115- # fi
116-
117- # echo "Downloading artifacts for commit $COMMIT from $REPO"
118- # get_commit_artifacts $REPO $COMMIT | while read -r artifact_url; do
119- # if [ -n "$artifact_url" ]; then
120- # echo "Downloading artifact: $artifact_url"
121- # curl -L -H "$HEADER" "$artifact_url" -o "artifact-$(basename $artifact_url).zip"
122- # unzip -j "artifact-$(basename $artifact_url).zip" "*.deb" 2>/dev/null || true
123- # rm "artifact-$(basename $artifact_url).zip"
124- # fi
125- # done
126- # }
127-
12888function build_level_zero_from_source() {
12989 COMMIT=$1
13090
13191 echo " Building Level Zero from source at commit $COMMIT "
132-
13392 # Install build dependencies if not already present
134- echo " Ensuring build dependencies are available..."
13593 apt-get update -qq
13694 apt-get install -y build-essential cmake git libc6-dev linux-libc-dev
13795
13896 # Check CMake version (Level Zero requires CMake 3.5+)
13997 # CMAKE_VERSION=$(cmake --version | head -n1 | sed 's/.*cmake version \([0-9]\+\.[0-9]\+\).*/\1/')
14098 # echo "CMake version: $CMAKE_VERSION"
14199
142- # Create temporary build directory
143100 BUILD_DIR=" /tmp/level-zero-build"
144101 INSTALL_DIR=" /tmp/level-zero-install"
145102 rm -rf $BUILD_DIR $INSTALL_DIR
146103 mkdir -p $BUILD_DIR $INSTALL_DIR
147104 cd $BUILD_DIR
148105
149- # Clone and checkout specific commit
150- echo " Cloning Level Zero repository..."
151- if ! git clone https://github.com/oneapi-src/level-zero.git; then
152- echo " ERROR: Failed to clone Level Zero repository"
153- return 1
154- fi
106+ git clone https://github.com/oneapi-src/level-zero.git
155107
156108 cd level-zero
157- if ! git checkout $COMMIT ; then
158- echo " ERROR: Failed to checkout commit $COMMIT "
159- return 1
160- fi
109+ git checkout $COMMIT
161110
162- # Create build directory
163111 mkdir build
164112 cd build
165113
166- # Configure build
167- echo " Configuring Level Zero build..."
168114 cmake .. \
169115 -DCMAKE_BUILD_TYPE=Release \
170116 -DCMAKE_INSTALL_PREFIX=/usr/local \
@@ -176,11 +122,8 @@ function build_level_zero_from_source() {
176122
177123 cp -r $INSTALL_DIR /usr/local/* /usr/local/
178124
179-
180- # Update library cache
181125 ldconfig
182126
183- # Clean up build and install directories
184127 rm -rf $BUILD_DIR $INSTALL_DIR
185128
186129 echo " Level Zero built and installed successfully from commit $COMMIT "
@@ -228,7 +171,6 @@ CheckIGCdevTag() {
228171
229172CheckIfCommitHash () {
230173 local arg=" $1 "
231- # Check if it's a 40-character hex string (SHA-1 commit hash)
232174 if [[ $arg =~ ^[a-f0-9]{40}$ ]]; then
233175 echo " Yes"
234176 else
@@ -268,7 +210,6 @@ InstallIGFX () {
268210 if [ " $IS_L0_COMMIT " == " Yes" ]; then
269211 echo " Level Zero is using commit hash, building from source..."
270212 if ! build_level_zero_from_source $L0_TAG ; then
271- echo " ERROR: Failed to build Level Zero from source"
272213 exit 1
273214 fi
274215 # Install other packages (Level Zero was already installed from source)
0 commit comments