30ab69404d5165b43702bacfe45f654b1b39b123
[profile/ivi/OpenAVB.git] / packaging / openavb.spec
1 %{!?_with_debug:%{!?_without_debug:%define _without_debug 0}}
2
3 %define kernel kernel-x86-ivi
4 %define kernel_relstr "%(/bin/rpm -q --queryformat '%{VERSION}-%{RELEASE}' %{kernel})"
5 %define kernel_release %(echo %{kernel_relstr})
6 %define kernel_modstr "%(/bin/rpm -ql %{kernel} | sort | grep /lib/modules/%{kernel_release} | head -1 | sed 's#/*$##g')"
7 %define kernel_modpath %(echo %{kernel_modstr})
8 %define kernel_moddir  %(echo %{kernel_modstr} | sed 's#.*/##g')
9
10 Summary: OpenAVB
11 Name: openavb
12 Version: 20130418
13 Release: 1
14 License: Other
15 Group: System Environment/Daemons
16 URL: https://github.com/intel-ethernet/Open-AVB
17 Source0: %{name}-%{version}.tar.gz
18 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
19 Requires: openavb-kmod-igb
20
21 BuildRequires: libstdc++-devel
22 BuildRequires: %{kernel}-devel
23 BuildRequires: pkgconfig(libpci)
24 BuildRequires: pkgconfig(zlib)
25
26 %package kmod-igb
27 Summary: OpenAVB kernel module for Intel ethernet cards.
28 Group: System Environment/Kernel
29 Requires: %{kernel}-%{kernel_release}
30
31 %package libigb
32 Summary: igb runtime library from the OpenAVB distribution.
33 Group: System Environment/Libraries
34
35 %package examples
36 Summary: Example clients from the OpenAVB distribution.
37 Group: Applications/Communications
38 Requires: openavb-libigb = %{version}
39
40 %package devel
41 Summary: Headers and libraries from the OpenAVB distribution.
42 Group: Development/Libraries
43
44 %package doc
45 Summary: Documentation from theOpenAVB distribution.
46 Group: Documentation
47
48 %description
49 This package contains the basic OpenAVB userspace daemons.
50
51 %description kmod-igb
52 This package contains the kernel module required by OpenAVB for Intel
53 ethernet cards.
54
55 %description libigb
56 This package contains the libigb runtime library from the OpenAVB
57 distribution.
58
59 %description examples
60 This package contains various test and example utilities for OpenAVB.
61
62 %description devel
63 This package contains header files and libraries for OpenAVB.
64
65 %description doc
66 This package contains some documentation from the OpenAVB distribution.
67
68 %prep
69 %setup -q
70
71 %build
72 %if %{?_with_debug:1}%{!?_with_debug:0}
73 export CFLAGS="-O0 -g3"
74 export CXXFLAGS="-O0 -g3"
75 %endif
76
77 NUM_CPUS="`cat /proc/cpuinfo | tr -s '\t' ' ' | \
78                grep '^processor *:' | wc -l`"
79 [ -z "$NUM_CPUS" ] && NUM_CPUS=1
80
81 ./bootstrap && \
82     %configure $CONFIG_OPTIONS && \
83     make BUILD_KERNEL=%{kernel_moddir} clean && \
84     make BUILD_KERNEL=%{kernel_moddir} -j$(($NUM_CPUS + 1))
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88
89 make DESTDIR=$RPM_BUILD_ROOT \
90     INSTALL_MOD_PATH=$RPM_BUILD_ROOT \
91     BUILD_KERNEL=%{kernel_moddir} install
92
93 rm -f $RPM_BUILD_ROOT%{_libdir}/libigb.la
94
95 %clean
96 rm -rf $RPM_BUILD_ROOT
97
98 %post libigb
99 ldconfig
100
101 %post kmod-igb
102 depmod -a %{kernel_moddir}
103
104 %files
105 %defattr(-,root,root,-)
106 %{_sbindir}/daemon_cl
107 %{_sbindir}/mrpd
108 %{_bindir}/mrpctl
109
110 %files kmod-igb
111 %defattr(-,root,root,-)
112 %{kernel_modpath}/kernel/drivers/net/igb_avb
113
114 %files libigb
115 %defattr(-,root,root,-)
116 %{_libdir}/libigb.so.*
117
118 %files examples
119 %defattr(-,root,root,-)
120 %{_bindir}/mrpl
121 %{_bindir}/mrpq
122 %{_bindir}/simple_talker
123
124 %files devel
125 %defattr(-,root,root,-)
126 %{_includedir}/igb
127 %{_libdir}/libigb.so
128 %{_libdir}/pkgconfig/igb.pc
129
130 %files doc
131 %defattr(-,root,root,-)
132 %doc README.rst documents examples
133
134 %changelog
135 * Tue Nov 27 2012 Krisztian Litkey <krisztian.litkey@intel.com> -
136 - Initial build for 2.0alpha.