1 #----------------------------------------------------------------------------
2 # Copyright (c) 2002-2010, Intel Corporation.
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 #----------------------------------------------------------------------------
23 %define debug_package %{nil}
24 %define kernel_number_str "%(/bin/rpm -q kernel-adaptation-intel-automotive --queryformat \"%{VERSION}-%{RELEASE}\"|grep -iv 'installed')"
25 %define kernel_number %(echo %{kernel_number_str})
26 %define kernel_version %{kernel_number}-adaptation-intel-automotive
27 %define modpath /lib/modules/%{kernel_version}/kernel/drivers/gpu/drm/emgd
30 Summary: Intel EMGD kernel module
36 Source0: %{name}-%{version}.tar.gz
37 BuildRequires: kernel-adaptation-intel-automotive-devel
41 Requires(post): /bin/ln
42 %if %{kernel_number_str} != ""
43 Requires: kernel-adaptation-intel-automotive = %{kernel_number}
45 Requires: kernel-adaptation-intel-automotive
49 Intel EMGD kernel module for kernel
55 make -C drivers %{?_smp_mflags}
58 mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/basic.target.wants/
59 mkdir -p $RPM_BUILD_ROOT/usr/libexec/
60 install -m 755 -d $RPM_BUILD_ROOT%{modpath}
61 install -m 744 drivers/emgd.ko $RPM_BUILD_ROOT%{modpath}
62 install -m 755 -D service/%{name}.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
63 install -m 755 -D service/%{name}.init $RPM_BUILD_ROOT/usr/libexec/
65 ln -sf ../%{name}.service $RPM_BUILD_ROOT/%{_libdir}/systemd/system/basic.target.wants/%{name}.service
68 rm -Rf $RPM_BUILD_ROOT
71 ## create the dependency of kernel modules
72 /sbin/depmod -av %{kernel_version} >/dev/null 2>&1
74 if [ -x /bin/systemctl ]; then
75 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
76 /bin/systemctl start %{name}.service > /dev/null 2>&1 || :
80 /sbin/depmod -av %{kernel_version} >/dev/null 2>&1
81 if [ -x /bin/systemctl ]; then
82 systemctl daemon-reload >/dev/null 2>&1 || :
86 if [ -x /bin/systemctl ]; then
87 sytemctl stop %{name}.service >/dev/null 2>&1 || :
91 %defattr(-,root,root,-)
93 %{_libdir}/systemd/system/%{name}.service
94 %{_libdir}/systemd/system/basic.target.wants/%{name}.service
95 /usr/libexec/%{name}.init