Skip to content

Commit 02017c6

Browse files
OSV-style builds
Signed-off-by: Pawel Cieslak <pawel.cieslak@intel.com>
1 parent 7ad007e commit 02017c6

File tree

40 files changed

+1573
-1
lines changed

40 files changed

+1573
-1
lines changed

manifests/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ components:
2020
infra:
2121
branch: infra
2222
dest_dir: infra
23-
revision: e73bc4e8dccc1591ccb3786cceb1f960532cc021
23+
revision: b36b5fcc7c03f81f030e13ad889594c549982172
2424
type: git
2525
internal:
2626
branch: master

scripts/packaging/functions.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright (C) 2021 Intel Corporation
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
set -ex
10+
11+
get_api_version() {
12+
API_VERSION="0"
13+
API_VERSION_SRC="master"
14+
API_DEB_MODEL_LINK=""
15+
API_RPM_MODEL_LINK=""
16+
if [ "${COMPONENT_MODEL}" != "ci" ]; then
17+
API_DEB_MODEL_LINK="~${COMPONENT_MODEL:-unknown}${BUILD_ID:-0}"
18+
API_RPM_MODEL_LINK=".${COMPONENT_MODEL:-unknown}${BUILD_ID:-0}"
19+
fi
20+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (C) 2021 Intel Corporation
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
set -ex
10+
11+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12+
REPO_DIR="$( cd "$( dirname "${DIR}/../../../../" )" && pwd )"
13+
14+
BUILD_DIR="${REPO_DIR}/../build_l0_gpu_driver"
15+
SKIP_UNIT_TESTS=${SKIP_UNIT_TESTS:-FALSE}
16+
17+
BRANCH_SUFFIX="$( cat ${REPO_DIR}/.branch )"
18+
19+
ENABLE_L0_GPU_DRIVER="${ENABLE_L0_GPU_DRIVER:-1}"
20+
if [ "${ENABLE_L0_GPU_DRIVER}" == "0" ]; then
21+
exit 0
22+
fi
23+
24+
LOG_CCACHE_STATS=:"${LOG_CCACHE_STATS:-0}"
25+
26+
BUILD_ID="${BUILD_ID:-1}"
27+
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
28+
DO_NOT_RUN_AUB_TESTS="${DO_NOT_RUN_AUB_TESTS:-FALSE}"
29+
30+
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/functions.sh"
31+
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/l0_gpu_driver.sh"
32+
33+
get_api_version # API_VERSION-API_VERSION_SRC and API_DEB_MODEL_LINK
34+
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH
35+
36+
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}.${API_VERSION}-${API_VERSION_SRC}${API_DEB_MODEL_LINK}"
37+
PKG_VERSION=${VERSION}
38+
39+
if [ "${CMAKE_BUILD_TYPE}" != "Release" ]; then
40+
PKG_VERSION="${PKG_VERSION}+$(echo "$CMAKE_BUILD_TYPE" | tr '[:upper:]' '[:lower:]')1"
41+
fi
42+
43+
rm -rf $BUILD_DIR
44+
mkdir -p $BUILD_DIR/debian
45+
46+
COPYRIGHT="${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/${OS_TYPE}/copyright"
47+
48+
cp -pR ${REPO_DIR}/scripts/packaging/l0_gpu_driver/${OS_TYPE}/debian/* $BUILD_DIR/debian/
49+
cp $COPYRIGHT $BUILD_DIR/debian/
50+
51+
# Update rules file with new version
52+
perl -pi -e "s/^ver = .*/ver = $NEO_L0_VERSION_PATCH/" $BUILD_DIR/debian/rules
53+
54+
#needs a top level CMAKE file
55+
cat << EOF | tee $BUILD_DIR/CMakeLists.txt
56+
cmake_minimum_required (VERSION 3.2 FATAL_ERROR)
57+
58+
project(l0_gpu_driver)
59+
60+
set(SKIP_NEO_UNIT_TESTS TRUE)
61+
62+
add_subdirectory($REPO_DIR l0_gpu_driver)
63+
EOF
64+
65+
(
66+
cd $BUILD_DIR
67+
if [ "${LOG_CCACHE_STATS}" == "1" ]; then
68+
ccache -z
69+
fi
70+
export DEB_BUILD_OPTIONS="nodocs notest nocheck"
71+
export DH_VERBOSE=1
72+
if [ "${CMAKE_BUILD_TYPE}" != "Release" ]; then
73+
export DH_INTERNAL_BUILDFLAGS=1
74+
fi
75+
if [ "${ENABLE_ULT}" == "0" ]; then
76+
SKIP_UNIT_TESTS="TRUE"
77+
fi
78+
export SKIP_UNIT_TESTS
79+
80+
dch -v ${PKG_VERSION} -m "build $PKG_VERSION"
81+
dpkg-buildpackage -j`nproc --all` -us -uc -b -rfakeroot
82+
sudo dpkg -i --force-depends ../*.deb
83+
if [ "${LOG_CCACHE_STATS}" == "1" ]; then
84+
ccache -s
85+
ccache -s | grep 'cache hit rate' | cut -d ' ' -f 4- | xargs -I{} echo LevelZero GPU Driver {} >> $REPO_DIR/../output/logs/ccache.log
86+
fi
87+
)
88+
89+
mkdir -p ${REPO_DIR}/../output/dbgsym
90+
91+
mv ${REPO_DIR}/../*.deb ${REPO_DIR}/../output/
92+
find ${REPO_DIR}/.. -maxdepth 1 -name \*.ddeb -type f -print0 | xargs -0r mv -t ${REPO_DIR}/../output/dbgsym/
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (C) 2021 Intel Corporation
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
set -ex
10+
11+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12+
REPO_DIR="$( cd "$( dirname "${DIR}/../../../../" )" && pwd )"
13+
14+
BUILD_DIR="${REPO_DIR}/../build_l0_gpu_driver"
15+
16+
BRANCH_SUFFIX="$( cat ${REPO_DIR}/.branch )"
17+
18+
ENABLE_L0_GPU_DRIVER="${ENABLE_L0_GPU_DRIVER:-1}"
19+
if [ "${ENABLE_L0_GPU_DRIVER}" == "0" ]; then
20+
exit 0
21+
fi
22+
23+
LOG_CCACHE_STATS=:"${LOG_CCACHE_STATS:-0}"
24+
25+
BUILD_SRPM="${BUILD_SRPM:-1}"
26+
BUILD_RPM="${BUILD_RPM:-1}"
27+
BUILD_NUMBER="${BUILD_NUMBER:-1}"
28+
BUILD_VERSION="${BUILD_VERSION:-dev-build}"
29+
30+
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
31+
32+
export PACKAGING_DIR="$REPO_DIR/scripts/packaging/l0_gpu_driver/${OS_TYPE}"
33+
export SPEC_SRC="$PACKAGING_DIR/SPECS/l0_gpu_driver.spec"
34+
export SPEC="$BUILD_DIR/SPECS/l0_gpu_driver.spec"
35+
export COPYRIGHT="${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/${OS_TYPE}/copyright"
36+
37+
BRANCH_TYPE=`cat ${REPO_DIR}/.branch`
38+
[ -z "$BRANCH_TYPE" ] && BRANCH_TYPE='master'
39+
40+
(
41+
if [ "${BUILD_SRPM}" == "1" ]; then
42+
build_args=()
43+
if [ "${CMAKE_BUILD_TYPE}" == "Debug" ]; then
44+
export CFLAGS=" "
45+
export CXXFLAGS=" "
46+
export FFLAGS=" "
47+
build_args+=(--define 'name_suffix -debug')
48+
build_args+=(--define 'is_debug 1')
49+
fi
50+
51+
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/functions.sh"
52+
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/l0_gpu_driver.sh"
53+
54+
get_api_version # API_VERSION-API_VERSION_SRC and API_RPM_MODEL_LINK
55+
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH
56+
57+
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}.${API_VERSION}"
58+
RELEASE="${API_VERSION_SRC}${API_RPM_MODEL_LINK}"
59+
60+
#setup rpm build tree
61+
rm -rf $BUILD_DIR
62+
mkdir -p $BUILD_DIR/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
63+
tar -c -I 'xz -6 -T0' -f $BUILD_DIR/SOURCES/compute-runtime-$VERSION.tar.xz -C $REPO_DIR --transform "s,${REPO_DIR:1},compute-runtime-$VERSION," --exclude=.git\* $REPO_DIR
64+
cp $COPYRIGHT $BUILD_DIR/SOURCES/
65+
cp $SPEC_SRC $BUILD_DIR/SPECS/
66+
67+
PATCH_SPEC="${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/patch_spec.sh"
68+
69+
if [ -f "$PATCH_SPEC" ]; then
70+
source "$PATCH_SPEC"
71+
fi
72+
73+
# Update spec file with new version
74+
perl -pi -e "s/^%global ver .*/%global ver ${VERSION}/" $SPEC
75+
perl -pi -e "s/^%global rel .*/%global rel ${RELEASE}/" $SPEC
76+
perl -pi -e "s/^%global build_id .*/%global build_id ${NEO_L0_VERSION_PATCH}/" $SPEC
77+
perl -pi -e "s,^%global neo_source_dir .*,%global neo_source_dir ${REPO_DIR}," $SPEC
78+
79+
rpmbuild --define "_topdir $BUILD_DIR" -bs $SPEC --define 'build_type ${CMAKE_BUILD_TYPE}' "${build_args[@]}"
80+
mkdir -p ${REPO_DIR}/../output/SRPMS
81+
echo -n ${VERSION} > ${REPO_DIR}/../output/.l0_gpu.version
82+
cp -v $BUILD_DIR/SRPMS/*.rpm ${REPO_DIR}/../output/SRPMS/
83+
fi
84+
)
85+
86+
if [ "${BUILD_RPM}" == "1" ]; then
87+
rm -rf $BUILD_DIR
88+
mkdir -p $BUILD_DIR/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
89+
90+
build_args=()
91+
build_args+=(--define "_topdir $BUILD_DIR")
92+
93+
VERSION=$(cat ${REPO_DIR}/../output/.l0_gpu.version)
94+
if [ "${LOG_CCACHE_STATS}" == "1" ]; then
95+
ccache -z
96+
fi
97+
rpmbuild --rebuild ${REPO_DIR}/../output/SRPMS/intel-level-zero-gpu-${VERSION}*.src.rpm "${build_args[@]}"
98+
if [ "${LOG_CCACHE_STATS}" == "1" ]; then
99+
ccache -s
100+
ccache -s | grep 'cache hit rate' | cut -d ' ' -f 4- | xargs -I{} echo LevelZero GPU Driver {} >> $REPO_DIR/../output/logs/ccache.log
101+
fi
102+
103+
sudo rpm -Uvh --force $BUILD_DIR/RPMS/*/*.rpm
104+
cp $BUILD_DIR/RPMS/*/*.rpm $REPO_DIR/../output/
105+
fi
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (C) 2021 Intel Corporation
5+
#
6+
# SPDX-License-Identifier: MIT
7+
#
8+
9+
set -ex
10+
11+
get_l0_gpu_driver_version() {
12+
NEO_L0_VERSION_MAJOR=$(grep -m1 NEO_L0_VERSION_MAJOR ${REPO_DIR}/version.cmake | awk -F"MAJOR " '{ print $2 }' | awk -F")" '{ print $1 }')
13+
NEO_L0_VERSION_MINOR=$(grep -m1 NEO_L0_VERSION_MINOR ${REPO_DIR}/version.cmake | awk -F"MINOR " '{ print $2 }' | awk -F")" '{ print $1 }')
14+
NEO_TAG=$(git -C ${REPO_DIR} describe --abbrev=1 --tags | awk -F"." '{ nn=split($NF, nfa, "."); if(nn==2) {printf("%s-%s", nfa[1], nfa[2]);} else {print $NF;} }')
15+
NEO_L0_VERSION_PATCH=$(echo $NEO_TAG | awk -F '-' '{ print $1; }')
16+
NEO_L0_VERSION_HOTFIX=$(echo $NEO_TAG | awk -F '-' '{ if(NF>1) {printf(".%s", $2);} }')
17+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#it's changed by external script
2+
%global ver xxx
3+
%global rel xxx
4+
%global build_id xxx
5+
%global neo_source_dir %{nil}
6+
7+
%define _source_payload w5T16.xzdio
8+
%define _binary_payload w5T16.xzdio
9+
10+
Name: intel-level-zero-gpu
11+
Version: %{ver}
12+
Release: %{rel}%{?dist}
13+
Summary: Intel(R) GPU Driver for oneAPI Level Zero.
14+
15+
Group: System Environment/Libraries
16+
License: MIT
17+
URL: https://github.com/intel/compute-runtime
18+
Source0: %{url}/archive/%{version}/compute-runtime-%{version}.tar.xz
19+
Source1: copyright
20+
21+
BuildRequires: make libva-devel gcc-c++ cmake
22+
BuildRequires: intel-gmmlib-devel
23+
BuildRequires: intel-igc-opencl-devel
24+
25+
Requires: intel-gmmlib
26+
Requires: intel-igc-opencl
27+
28+
%description
29+
Runtime library providing the ability to use Intel GPUs with the oneAPI Level
30+
Zero programming interface.
31+
Level Zero is the primary low-level interface for language and runtime
32+
libraries. Level Zero offers fine-grain control over accelerators capabilities,
33+
delivering a simplified and low-latency interface to hardware, and efficiently
34+
exposing hardware capabilities to applications.
35+
36+
%define debug_package %{nil}
37+
38+
%prep
39+
%autosetup -p1 -n compute-runtime-%{ver}
40+
41+
%build
42+
mkdir build
43+
cd build
44+
cmake .. \
45+
-DNEO_VERSION_BUILD=%{build_id} \
46+
-DCMAKE_BUILD_TYPE=Release \
47+
-DSKIP_UNIT_TESTS=1 \
48+
-DCMAKE_INSTALL_PREFIX=/usr \
49+
-DL0_INSTALL_UDEV_RULES=1 \
50+
-DNEO_SOURCE_DIR=%neo_source_dir \
51+
-DUDEV_RULES_DIR=/etc/udev/rules.d/
52+
%make_build
53+
54+
%install
55+
cd build
56+
%make_install
57+
58+
#Remove OpenCL files before installing
59+
rm -rf %{buildroot}%{_libdir}/intel-opencl/
60+
rm -rf %{buildroot}%{_sysconfdir}/OpenCL/
61+
rm -rf %{buildroot}%{_bindir}/ocloc
62+
rm -rf %{buildroot}%{_libdir}/libocloc.so
63+
rm -rf %{buildroot}%{_includedir}/ocloc_api.h
64+
#Remove debug files
65+
rm -f %{buildroot}/%{_libdir}/intel-opencl/libigdrcl.so.debug
66+
rm -f %{buildroot}/%{_libdir}/libocloc.so.debug
67+
rm -rf %{buildroot}/usr/lib/debug/
68+
#insert license into package
69+
mkdir -p %{buildroot}/usr/share/doc/intel-level-zero-gpu/
70+
cp -pR %{_sourcedir}/copyright %{buildroot}/usr/share/doc/intel-level-zero-gpu/.
71+
72+
%files
73+
%defattr(-,root,root)
74+
%{_libdir}/libze_intel_gpu.so.*
75+
%{_sharedstatedir}/libze_intel_gpu/pci_bind_status_file
76+
%{_sharedstatedir}/libze_intel_gpu/wedged_file
77+
%{_sysconfdir}/udev/rules.d/99-drm_ze_intel_gpu.rules
78+
/usr/share/doc/intel-level-zero-gpu/copyright
79+
%config(noreplace)
80+
81+
%doc
82+
83+
%changelog
84+
* Mon Aug 10 2020 Spruit, Neil R <neil.r.spruit@intel.com> - 1.0.17625
85+
- Update to 1.0.17625
86+
87+
* Tue Apr 28 2020 Jacek Danecki <jacek.danecki@intel.com> - 0.8.16582-1
88+
- Update to 0.8.16582
89+
90+
* Tue Mar 24 2020 Spruit, Neil R <neil.r.spruit@intel.com> - 0.8.0
91+
* Update to 0.8.0
92+
93+
* Fri Mar 13 2020 Pavel Androniychuk <pavel.androniychuk@intel.com> - 0.4.1
94+
- Spec file init
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
MIT License
4+
5+
Copyright (c) 2018-2021 Intel Corporation
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.

0 commit comments

Comments
 (0)