-# TODO: fix Name vs filename
#
# Conditional build:
%bcond_without dist_kernel # allow non-distribution kernel
%bcond_without userspace # don't build userspace module
%bcond_with verbose # verbose build (V=1)
#
-# main package.
-#
Summary: Linux Dazuko driver
Summary(pl): Sterownik Dazuko dla Linuksa
Name: dazuko
%define _rel 1
Release: %{_rel}
Epoch: 0
-License: BSD/GPL
+License: BSD (library), GPL (Linux kernel module)
Group: Base/Kernel
Source0: http://www.dazuko.org/files/dazuko-%{version}.tar.gz
# Source0-md5: 844498651d22ddd76bea4104bf7c3e43
Release: %{_rel}@%{_kernel_ver_str}
Group: Base/Kernel
Requires(post,postun): /sbin/depmod
-%if %{with dist_kernel}
+%if %{with kernel} && %{with dist_kernel}
%requires_releq_kernel_up
Requires(postun): %releq_kernel_up
%endif
Release: %{_rel}@%{_kernel_ver_str}
Group: Base/Kernel
Requires(post,postun): /sbin/depmod
-%if %{with dist_kernel}
+%if %{with kernel} && %{with dist_kernel}
%requires_releq_kernel_smp
Requires(postun): %releq_kernel_smp
%endif
%package examples
Summary: Example code for Dazuko
+Summary(pl): Przyk³adowy kod dla Dazuko
+License: BSD
Group: Development/Libraries
%description examples
Example code for Dazuko.
-%package static
-Summary: Static libraries for Dazuko
-Group: Development/Libraries
-
-%description static
-Static libraries for Dazuko.
+%description examples -l pl
+Przyk³adowy kod dla Dazuko.
%package devel
Summary: Headers for Dazuko
+Summary(pl): Pliki nag³ówkowe Dazuko
+License: BSD
Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
%description devel
Headers for Dazuko.
+%description devel -l pl
+Pliki nag³ówkowe Dazuko.
+
+%package static
+Summary: Static libraries for Dazuko
+Summary(pl): Statyczne biblioteki Dazuko
+License: BSD
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libraries for Dazuko.
+
+%description static -l pl
+Statyczne biblioteki Dazuko.
+
%prep
%setup -q
%build
-
-%if %{with kernel}
# NOTE: It's not autoconf configure.
bash ./configure \
- --kernelsrcdir=%{_kernelsrcdir}
+ --kernelsrcdir=%{_kernelsrcdir} \
+ --disable-local-dpath \
+ %{!?with_userspace:--without-library} \
+ %{!?with_kernel:--without-module}
-# kernel module(s)
+%if %{with kernel}
for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do
if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then
exit 1
ln -sf %{_kernelsrcdir}/config-$cfg .config
ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h
ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm
+ ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers
touch include/config/MARKER
#
# patching/creating makefile(s) (optional)
%if %{with userspace}
cd library
-make CFLAGS=-fPIC
-gcc -shared -Wl,-soname,libdazuko.so.0 -o libdazuko.so.0.0.0 *.o
+%{__make} \
+ CC="%{__cc}" \
+ CFLAGS="%{rpmcflags} -fPIC"
+%{__cc} -shared -Wl,-soname,libdazuko.so.0 -o libdazuko.so.0.0.0 *.o
ln -s libdazuko.so.0.0.0 libdazuko.so.0
ln -s libdazuko.so.0.0.0 libdazuko.so
cd ..
cp -a example* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-install library/libdazuko.* $RPM_BUILD_ROOT/%{_libdir}
-install dazukoio.h $RPM_BUILD_ROOT/%{_includedir}
+cp -af library/libdazuko.* $RPM_BUILD_ROOT%{_libdir}
+install dazukoio.h $RPM_BUILD_ROOT%{_includedir}
%endif
%if %{with kernel}
%clean
rm -rf $RPM_BUILD_ROOT
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
%post -n kernel-misc-dazuko
%depmod %{_kernel_ver}
%if %{with userspace}
%files
-%attr(755,root,root) /usr/lib/libdazuko.so.*
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libdazuko.so.*.*.*
%files examples
-%doc README
%defattr(644,root,root,755)
+%doc README
%{_examplesdir}/%{name}-%{version}
%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libdazuko.so
%{_includedir}/dazukoio.h
-%{_libdir}/*.so
%files static
-%{_libdir}/*.a
+%defattr(644,root,root,755)
+%{_libdir}/lib*.a
%endif