#
# Conditional build:
-# _without_dist_kernel - without distribution kernel
+%bcond_without dist_kernel # without distribution kernel
+%bcond_without kernel # don't build kernel modules
+%bcond_without userspace # don't build userspace tools
#
-# TODO: UP/SMP modules
-Summary: dxr3 and h+ driver
-Summary(pl): sterowniki dla dxr3 i h+
+Summary: DXR3 and H+ driver
+Summary(pl): Sterowniki dla DXR3 i H+
Name: em8300
Version: 0.13.0
-Release: 1
+Release: 2
License: GPL
-Group: Libraries
+Group: Applications/System
Source0: http://dxr3.sourceforge.net/download/%{name}-%{version}.tar.gz
# Source0-md5: 306984dfd4f0f29538179cbbf391f5a8
Source1: %{name}.init
Source2: %{name}.sysconf
Patch0: %{name}-automake.patch
URL: http://dxr3.sourceforge.net/
+%if %{with userspace}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gtk+-devel >= 1.2.0
-%{!?_without_dist_kernel:BuildRequires: kernel-headers}
+%endif
+%if %{with kernel} && %{with dist_kernel}
+BuildRequires: kernel-headers >= 2.4
+BuildRequires: kernel-headers < 2.5
BuildRequires: rpmbuild(macros) >= 1.118
-Requires(post,postun): /sbin/ldconfig
+%endif
Requires(post,preun): /sbin/chkconfig
+Requires: %{name}-libs = %{version}-%{release}
Provides: dxr3
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
telewizyjne tych kart nie tylko w/w formatów, ale tak¿e wszystkich
formatów video, które te programy rozpoznaj±.
+%package libs
+Summary: libdxr3 library for DXR3/Hollywood+ cards
+Summary(pl): Biblioteka libdxr3 do kart DXR3/Hollywood+
+Group: Libraries
+
+%description libs
+libdxr3 library for DXR3/Hollywood+ cards.
+
+%description libs -l pl
+Biblioteka libdxr3 do kart DXR3/Hollywood+.
+
%package devel
Summary: Files required to develop programs using em8300
Summary(pl): Pliki potrzebne do tworzenia programów korzystaj±cych z em8300
Group: Development/Libraries
-Requires: %{name} = %{version}
+Requires: %{name}-libs = %{version}-%{release}
%description devel
Header files and additional scripts useful for developers of em8300
Summary: Static libraries for em8300
Summary(pl): Statyczne biblioteki dla em8300
Group: Development/Libraries
-Requires: %{name}-devel = %{version}
+Requires: %{name}-devel = %{version}-%{release}
%description static
Static libraries for em8300.
Summary: Utility programs for em8300 using gtk+
Summary(pl): Programy u¿ytkowe em8300 u¿ywaj±ce bibliteki gtk+
Group: X11/Applications
-Requires: %{name} = %{version}
+Requires: %{name} = %{version}-%{release}
%description gtk
Utility programs for em8300 using gtk+ toolkit.
Summary: em8300 Linux kernel modules
Summary(pl): Modu³y j±dra Linuksa em8300
Group: Base/Kernel
-%{!?_without_dist_kernel:%requires_releq_kernel_up}
+%{?with_dist_kernel:%requires_releq_kernel_up}
Requires(post,postun): /sbin/depmod
%description -n kernel-video-em8300
%description -n kernel-video-em8300 -l pl
Modu³y j±dra Linuksa em8300.
+%package -n kernel-smp-video-em8300
+Summary: em8300 Linux SMP kernel modules
+Summary(pl): Modu³y j±dra Linuksa SMP em8300
+Group: Base/Kernel
+%{?with_dist_kernel:%requires_releq_kernel_smp}
+Requires(post,postun): /sbin/depmod
+
+%description -n kernel-smp-video-em8300
+em8300 Linux SMP kernel modules.
+
+%description -n kernel-smp-video-em8300 -l pl
+Modu³y j±dra Linuksa SMP em8300.
+
%prep
%setup -q
%patch0 -p1
%build
-rm -f missing
+%if %{with userspace}
%{__libtoolize}
%{__aclocal} -I autotools
%{__autoconf}
%{__automake}
%configure
%{__make}
+%endif
+
+%if %{with kernel}
+%{__make} -C modules \
+ KERNEL_LOCATION="%{_kernelsrcdir}" \
+ EM8300_DEBUG="%{rpmcflags} -D__SMP__"
+
+for f in em8300.o adv717x.o bt865.o; do
+ mv -f modules/$f modules/$f.smp
+done
+
+%{__make} -C modules clean
%{__make} -C modules \
KERNEL_LOCATION="%{_kernelsrcdir}" \
EM8300_DEBUG="%{rpmcflags}"
+%endif
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with userspace}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-%{__make} -C modules install-newkern \
- KERNVER=%{_kernel_ver} \
- prefix=$RPM_BUILD_ROOT
-
mv -f modules/{INSTALL,INSTALL.modules}
install -D modules/em8300.uc $RPM_BUILD_ROOT%{_datadir}/misc/em8300.uc
install -D %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install -D %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+rm -f $RPM_BUILD_ROOT%{_datadir}/em8300/{modules.tar.gz,em8300.sysv}
+%endif
+
+%if %{with kernel}
+%{__make} -C modules install-newkern \
+ KERNVER=%{_kernel_ver} \
+ SMODINST=kernel/drivers/video
+ prefix=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/kernel/drivers/video
+for f in em8300.o adv717x.o bt865.o; do
+ install modules/$f.smp \
+ $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/kernel/drivers/video/$f
+done
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
%post
-/sbin/ldconfig
/sbin/chkconfig --add %{name}
if [ -f /var/lock/subsys/%{name} ]; then
/etc/rc.d/init.d/%{name} restart 1>&2
/sbin/chkconfig --del %{name}
fi
-%postun -p /sbin/ldconfig
+%post libs -p /sbin/ldconfig
+%postun libs -p /sbin/ldconfig
%post -n kernel-video-em8300
%depmod %{_kernel_ver}
%postun -n kernel-video-em8300
%depmod %{_kernel_ver}
+%post -n kernel-smp-video-em8300
+%depmod %{_kernel_ver}smp
+
+%postun -n kernel-smp-video-em8300
+%depmod %{_kernel_ver}smp
+
+%if %{with userspace}
%files
%defattr(644,root,root,755)
%doc AUTHORS ChangeLog README modules/{README*,INSTALL*,devices.sh,devfs_symlinks}
%attr(755,root,root) %{_bindir}/em8300_microcode_upload
%{_datadir}/misc/em8300.uc
-%attr(755,root,root) %{_libdir}/lib*.so.*.*.*
+%dir %{_datadir}/em8300
+%{_datadir}/em8300/em8300.pm
+%attr(755,root,root) %{_datadir}/em8300/*.pl
%attr(754,root,root) /etc/rc.d/init.d/%{name}
%config(noreplace) %verify(not size mtime md5) /etc/sysconfig/%{name}
+%files libs
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/lib*.so.*.*.*
+
%files devel
%defattr(644,root,root,755)
-%{_includedir}/libdxr3
-%{_includedir}/linux/*.h
%attr(755,root,root) %{_libdir}/lib*.so
%{_libdir}/lib*.la
-%attr(755,root,root) %dir %{_datadir}/em8300
-%attr(755,root,root) %{_datadir}/em8300/*
+%{_includedir}/libdxr3
+%{_includedir}/linux/em8300.h
%files static
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/dhc
%attr(755,root,root) %{_bindir}/dxr3view
%attr(755,root,root) %{_bindir}/em8300setup
+%endif
+%if %{with kernel}
%files -n kernel-video-em8300
%defattr(644,root,root,755)
/lib/modules/%{_kernel_ver}/kernel/drivers/video/*.o*
+
+%files -n kernel-smp-video-em8300
+%defattr(644,root,root,755)
+/lib/modules/%{_kernel_ver}smp/kernel/drivers/video/*.o*
+%endif