added rpm spec file

Change-Id: I33ad32d9a61636dc32b5d06d3143030a7cad953c
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Artur Harasimiuk
2018-06-20 23:49:02 +02:00
committed by sys_ocldev
parent f0c9619919
commit 993bdc4ea0
3 changed files with 147 additions and 1 deletions

View File

@ -17,7 +17,7 @@ components:
branch: infra
clean_on_sync: true
dest_dir: infra
revision: 137cb4cb7547c6effdab84108ac7734ee1b8abf7
revision: 78e3a842ab6f4094edf00d2ba6a90af6c72c49fe
type: git
internal:
branch: master

86
scripts/build_spec.py Executable file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env python
#
# Copyright (c) 2018, Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# Usage:
# ./scripts/build_spec.py manifests/manifest.yml scripts/fedora.spec.in <version> <revision>
#
import datetime
import git
import re
import sys
import yaml
if len(sys.argv) < 5:
print "ERROR! invalid number of parameters"
print
print "Usage:"
print " ./scripts/build_spec.py <manifest> <spec.in> <version> <revision>"
print
sys.exit(1)
manifest_file = sys.argv[1]
repo = git.Repo(".")
neo_revision = repo.head.commit
with open(manifest_file, 'r') as f:
manifest = yaml.load(f)
gmmlib_revision = manifest['components']['gmmlib']['revision']
c = repo.commit(neo_revision)
cd = datetime.datetime.fromtimestamp(c.committed_date)
with open("CMakeLists.txt", "r") as f:
for line in f.readlines():
m = re.match("^(pkg_check_modules)(\s*\(\s*)(\S+)\s+(\S+[^>\s])(>?=)([^=\s]\S+)(\s*\)\s*)$", line.strip())
if not m is None:
if m.groups()[3] == 'igc-opencl':
igc_revision = m.groups()[5]
pkg_version = "%s.%s.%s" %(str(cd.isocalendar()[0])[-2:], cd.isocalendar()[1], sys.argv[3])
with open(sys.argv[2], 'r') as f:
for line in f.readlines():
if not re.match(".*__NEO_COMMIT_ID__$", line.strip()) is None:
print "%s" % (line.rstrip().replace("__NEO_COMMIT_ID__", "%s" % neo_revision))
continue
if not re.match(".*__GMMLIB_COMMIT_ID__$", line.strip()) is None:
print "%s" % (line.rstrip().replace("__GMMLIB_COMMIT_ID__", "%s" % gmmlib_revision))
continue
if not re.match(".*__NEO_PACKAGE_VERSION__$", line.strip()) is None:
print "%s" % (line.rstrip().replace("__NEO_PACKAGE_VERSION__", "%s" % pkg_version))
continue
if not re.match(".*__NEO_PACKAGE_RELEASE__.*", line.strip()) is None:
print "%s" % (line.rstrip().replace("__NEO_PACKAGE_RELEASE__", "%s" % sys.argv[4]))
continue
if not re.match(".*__IGC_VERSION_REQUIRED__$", line.strip()) is None:
print "%s" % (line.rstrip().replace("__IGC_VERSION_REQUIRED__", "%s" % igc_revision))
continue
print line.rstrip()

60
scripts/fedora.spec.in Normal file
View File

@ -0,0 +1,60 @@
%global neo_commit_id __NEO_COMMIT_ID__
%global gmmlib_commit_id __GMMLIB_COMMIT_ID__
Name: intel-opencl
Version: __NEO_PACKAGE_VERSION__
Release: __NEO_PACKAGE_RELEASE__%{?dist}
Summary: Intel(R) Graphics Compute Runtime for OpenCL(TM)
Group: System Environment/Libraries
License: MIT
URL: https://github.com/intel/compute-runtime
Source0: https://github.com/intel/compute-runtime/archive/%{neo_commit_id}/neo.tar.gz
Source1: https://github.com/intel/gmmlib/archive/%{gmmlib_commit_id}/gmmlib.tar.gz
BuildRequires: cmake clang gcc-c++ ninja-build make procps python2 sed libva-devel
BuildRequires: intel-igc-opencl-devel >= __IGC_VERSION_REQUIRED__
Requires: intel-igc-opencl >= __IGC_VERSION_REQUIRED__
%description
%prep
%build
echo "==== BUILD ===="
rm -rf *
mkdir neo gmmlib
tar xzf $RPM_SOURCE_DIR/neo.tar.gz -C neo --strip-components=1
tar xzf $RPM_SOURCE_DIR/gmmlib.tar.gz -C gmmlib --strip-components=1
mkdir build
cd build
cmake ../neo -DCMAKE_BUILD_TYPE=Release -DNEO_DRIVER_VERSION=%{version}
make -j`nproc` igdrcl_dll
echo "==== DONE ===="
%install
echo "==== INSTALL ===="
mkdir -p $RPM_BUILD_ROOT/usr/lib64
mkdir -p $RPM_BUILD_ROOT/etc/OpenCL/vendors
cp $RPM_BUILD_DIR/build/bin/libigdrcl.so $RPM_BUILD_ROOT/usr/lib64/
strip $RPM_BUILD_ROOT/usr/lib64/libigdrcl.so
echo "/usr/lib64/libigdrcl.so" > $RPM_BUILD_ROOT/etc/OpenCL/vendors/intel.icd
echo "==== DONE ===="
%files
%defattr(-,root,root)
/usr/lib64/libigdrcl.so
%config(noreplace)
/etc/OpenCL/vendors/intel.icd
# %doc
# %changelog