Skip to content

Commit 993bdc4

Browse files
added rpm spec file
Change-Id: I33ad32d9a61636dc32b5d06d3143030a7cad953c Signed-off-by: Artur Harasimiuk <[email protected]>
1 parent f0c9619 commit 993bdc4

File tree

3 files changed

+147
-1
lines changed

3 files changed

+147
-1
lines changed

manifests/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ components:
1717
branch: infra
1818
clean_on_sync: true
1919
dest_dir: infra
20-
revision: 137cb4cb7547c6effdab84108ac7734ee1b8abf7
20+
revision: 78e3a842ab6f4094edf00d2ba6a90af6c72c49fe
2121
type: git
2222
internal:
2323
branch: master

scripts/build_spec.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright (c) 2018, Intel Corporation
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a
6+
# copy of this software and associated documentation files (the "Software"),
7+
# to deal in the Software without restriction, including without limitation
8+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
# and/or sell copies of the Software, and to permit persons to whom the
10+
# Software is furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21+
# OTHER DEALINGS IN THE SOFTWARE.
22+
23+
# Usage:
24+
# ./scripts/build_spec.py manifests/manifest.yml scripts/fedora.spec.in <version> <revision>
25+
#
26+
27+
import datetime
28+
import git
29+
import re
30+
import sys
31+
import yaml
32+
33+
if len(sys.argv) < 5:
34+
print "ERROR! invalid number of parameters"
35+
print
36+
print "Usage:"
37+
print " ./scripts/build_spec.py <manifest> <spec.in> <version> <revision>"
38+
print
39+
sys.exit(1)
40+
41+
manifest_file = sys.argv[1]
42+
43+
repo = git.Repo(".")
44+
neo_revision = repo.head.commit
45+
46+
with open(manifest_file, 'r') as f:
47+
manifest = yaml.load(f)
48+
49+
gmmlib_revision = manifest['components']['gmmlib']['revision']
50+
51+
c = repo.commit(neo_revision)
52+
cd = datetime.datetime.fromtimestamp(c.committed_date)
53+
54+
with open("CMakeLists.txt", "r") as f:
55+
for line in f.readlines():
56+
m = re.match("^(pkg_check_modules)(\s*\(\s*)(\S+)\s+(\S+[^>\s])(>?=)([^=\s]\S+)(\s*\)\s*)$", line.strip())
57+
if not m is None:
58+
if m.groups()[3] == 'igc-opencl':
59+
igc_revision = m.groups()[5]
60+
61+
pkg_version = "%s.%s.%s" %(str(cd.isocalendar()[0])[-2:], cd.isocalendar()[1], sys.argv[3])
62+
63+
with open(sys.argv[2], 'r') as f:
64+
for line in f.readlines():
65+
if not re.match(".*__NEO_COMMIT_ID__$", line.strip()) is None:
66+
print "%s" % (line.rstrip().replace("__NEO_COMMIT_ID__", "%s" % neo_revision))
67+
continue
68+
69+
if not re.match(".*__GMMLIB_COMMIT_ID__$", line.strip()) is None:
70+
print "%s" % (line.rstrip().replace("__GMMLIB_COMMIT_ID__", "%s" % gmmlib_revision))
71+
continue
72+
73+
if not re.match(".*__NEO_PACKAGE_VERSION__$", line.strip()) is None:
74+
print "%s" % (line.rstrip().replace("__NEO_PACKAGE_VERSION__", "%s" % pkg_version))
75+
continue
76+
77+
if not re.match(".*__NEO_PACKAGE_RELEASE__.*", line.strip()) is None:
78+
print "%s" % (line.rstrip().replace("__NEO_PACKAGE_RELEASE__", "%s" % sys.argv[4]))
79+
continue
80+
81+
if not re.match(".*__IGC_VERSION_REQUIRED__$", line.strip()) is None:
82+
print "%s" % (line.rstrip().replace("__IGC_VERSION_REQUIRED__", "%s" % igc_revision))
83+
continue
84+
85+
print line.rstrip()
86+

scripts/fedora.spec.in

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
%global neo_commit_id __NEO_COMMIT_ID__
2+
%global gmmlib_commit_id __GMMLIB_COMMIT_ID__
3+
4+
Name: intel-opencl
5+
Version: __NEO_PACKAGE_VERSION__
6+
Release: __NEO_PACKAGE_RELEASE__%{?dist}
7+
Summary: Intel(R) Graphics Compute Runtime for OpenCL(TM)
8+
9+
Group: System Environment/Libraries
10+
License: MIT
11+
URL: https://github.com/intel/compute-runtime
12+
Source0: https://github.com/intel/compute-runtime/archive/%{neo_commit_id}/neo.tar.gz
13+
Source1: https://github.com/intel/gmmlib/archive/%{gmmlib_commit_id}/gmmlib.tar.gz
14+
15+
BuildRequires: cmake clang gcc-c++ ninja-build make procps python2 sed libva-devel
16+
BuildRequires: intel-igc-opencl-devel >= __IGC_VERSION_REQUIRED__
17+
Requires: intel-igc-opencl >= __IGC_VERSION_REQUIRED__
18+
19+
%description
20+
21+
22+
%prep
23+
24+
25+
%build
26+
echo "==== BUILD ===="
27+
rm -rf *
28+
29+
mkdir neo gmmlib
30+
tar xzf $RPM_SOURCE_DIR/neo.tar.gz -C neo --strip-components=1
31+
tar xzf $RPM_SOURCE_DIR/gmmlib.tar.gz -C gmmlib --strip-components=1
32+
33+
mkdir build
34+
cd build
35+
cmake ../neo -DCMAKE_BUILD_TYPE=Release -DNEO_DRIVER_VERSION=%{version}
36+
make -j`nproc` igdrcl_dll
37+
echo "==== DONE ===="
38+
39+
40+
%install
41+
echo "==== INSTALL ===="
42+
mkdir -p $RPM_BUILD_ROOT/usr/lib64
43+
mkdir -p $RPM_BUILD_ROOT/etc/OpenCL/vendors
44+
cp $RPM_BUILD_DIR/build/bin/libigdrcl.so $RPM_BUILD_ROOT/usr/lib64/
45+
strip $RPM_BUILD_ROOT/usr/lib64/libigdrcl.so
46+
echo "/usr/lib64/libigdrcl.so" > $RPM_BUILD_ROOT/etc/OpenCL/vendors/intel.icd
47+
echo "==== DONE ===="
48+
49+
50+
%files
51+
%defattr(-,root,root)
52+
/usr/lib64/libigdrcl.so
53+
54+
%config(noreplace)
55+
/etc/OpenCL/vendors/intel.icd
56+
57+
# %doc
58+
59+
60+
# %changelog

0 commit comments

Comments
 (0)