File linux-gpib.spec_old of Package linux-gpib
#
# spec file for package linux-gpib (Version 3.2.14)
#
# Copyright (c) 2009 acurana GmbH, Munich, Germany
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.acurana.de/
#
# norootforbuild
#@TODO:
#- check rpmlint output and fix problems
#- add default GPIB device config file
#- fix Fedora
#- debianize, fix Ubuntu etc.
#- add test files, README etc. in the proper places
#- add more driver packages
%trace
Name: linux-gpib
# SuSE based distributions
%if 0%{?suse_version} || 0%{?sles_version}
%if 0%{?suse_version} < 1120 && 0%{?sles_version} < 11
BuildRequires: module-init-tools kernel-syms python-devel tcl-devel
%else
BuildRequires: %kernel_module_package_buildreqs python-devel tcl-devel
%endif
%else
# RedHat based distributions
%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version}
BuildRequires: redhat-rpm-config module-init-tools kernel-devel python-devel tcl-devel
%endif
%endif
PreReq: coreutils
License: GNU General Public License (GPL)
Group: System/Libraries
Packager: acurana GmbH - http://www.acurana.de/
Summary: A GPIB kernel driver and user-space library
Version: 3.2.14
Release: 0
URL: http://linux-gpib.sourceforge.net/
Source: %name-%{version}.tar.gz
Source1: tnt4882.files
Source2: nec7210.files
# generate Source lines for kmp's
# expansion not supported by obs?
#%{expand:%( \
# for mod in %kmodules ; do \
# echo "Source: $mod.files" ; \
# done \
#) }
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch: fix_kmod_stuff.patch
#see http://www.linuxfoundation.org/en/Sample_KMP_spec_file
#and http://developer.novell.com/wiki/images/8/80/Kmpm-code11.pdf
#@TODO: add more modules
#kernel_module_package -x debug -x trace -n agilent_82350b
#kernel_module_package -x debug -x trace -n agilent_82357a
#kernel_module_package -x debug -x trace -n cb7210
#kernel_module_package -x debug -x trace -n cec
#kernel_module_package -x debug -x trace -n eastwood
#kernel_module_package -x debug -x trace -n hp_82335
#kernel_module_package -x debug -x trace -n hp_82341
#kernel_module_package -x debug -x trace -n ines
#kernel_module_package -x debug -x trace -n ni_usb
#kernel_module_package -x debug -x trace -n pc2
#kernel_module_package -x debug -x trace -n tms9914
# generate files with files section per kmp
# expansion not supported by obs?
#%( \
# for mod in %kmodules ; do \
# echo "%%defattr (-,root,root)" > %_sourcedir/$mod.files ; \
# echo "/lib/modules/%{2}/extra/%{name}/$mod.ko" >> %_sourcedir/$mod.files ; \
# done \
#)
# generate kernel_module_package lines
# expansion not supported by obs?
#%if 0%{?suse_version} < 1100
#%{expand:%( \
# for mod in %kmodules ; do \
# echo "%%suse_kernel_module_package -n %{name}-$mod -f $mod.files kdump um" ; \
# done \
#) }
#%else
#%{expand:%( \
# for mod in %kmodules ; do \
# echo "%%kernel_module_package -n %{name}-$mod -f $mod.files -x kdump -x um" ; \
# done \
#) }
#%endif
%if 0%{?suse_version} < 1120 && 0%{?sles_version} < 11 && 0%{?suse_version}
%suse_kernel_module_package -n %{name}-tnt4882 -f tnt4882.files kdump um debug trace
%suse_kernel_module_package -n %{name}-nec7210 -f nec7210.files kdump um debug trace
%else
%kernel_module_package -n %{name}-tnt4882 -x kdump -x um -x debug -x trace
%kernel_module_package -n %{name}-nec7210 -x kdump -x um -x debug -x trace
%endif
%description
The Linux GPIB Package is a support package for GPIB (IEEE 488) hardware. The package contains kernel driver modules, and a C user-space library with Guile, Perl, PHP, Python and TCL bindings. The API of the C library is intended to be compatible with National Instrument's GPIB library.
Authors:
--------
Frank Mori Hess et. al.
See http://linux-gpib.sourceforge.net/AUTHORS
spec file by Christopher Lang, acurana GmbH - http://www.acurana.de/
%package devel
Group: Development/Libraries
Summary: Development files for the linux-gpib library
%description devel
Files needed for the development for the linux-gpib library.
%package doc
Group: Development/Libraries
Summary: Documentation for the linux-gpib library
%description doc
Documentation files for the linux-gpib library.
%package python
Group: Development/Libraries
Summary: Python bindings for the linux-gpib library
%description python
Python language bindings for the linux-gpib library.
%package -n libgpib_tcl-3_2_14
Group: Development/Libraries
Summary: Tcl bindings for the linux-gpib library
%description -n libgpib_tcl-3_2_14
Tcl language bindings for the linux-gpib library.
%package test
Group: Development/Libraries
Summary: Test programs for the linux-gpib library
%description test
Hardware test programs for the linux-gpib library.
# the "drivers" directories to build modules in
%define drivers tnt4882 sys nec7210
%prep
%setup -q -b 0
%patch -p1
set -- *
%__mkdir source
%__cp -r "drivers/" source/
for driver in %drivers ; do
%__mkdir -p obj/$driver
done
# generate files with %files section per kmp
# not supported in obs?
#for kmodule in %kmodules ; do
# echo "%%defattr (-,root,root)" > %_sourcedir/$kmodule.files ;
# echo "/lib/modules/%{2}/extra/%{name}/gpib_common.ko" >> %_sourcedir/$kmodule.files ;
# echo "/lib/modules/%{2}/extra/%{name}/$kmodule.ko" >> %_sourcedir/$kmodule.files ;
# echo "/lib/modules/%{2}/extra/" >> %_sourcedir/$kmodule.files ;
#done
#echo "/lib/modules/%{2}/extra/%{name}/nec7210.ko" >> %_sourcedir/tnt4882.files ;
%build
%configure --docdir=%{_datadir}/doc/packages/%{name}
%__make
for flavor in %flavors_to_build ; do
for driver in %drivers ; do
%__rm -rf obj/$driver/$flavor
%__cp -r source/drivers/gpib/$driver obj/$driver/$flavor
# SuSE based distributions
%if 0%{?suse_version} || 0%{?sles_version}
%if 0%{?suse_version} < 1120 && 0%{?sles_version} < 11
%__make -C /usr/src/linux-obj/%_target_cpu/$flavor V=1 modules \
M=$PWD/obj/$driver/$flavor
%else
%__make -C %{kernel_source $flavor} V=1 modules M=$PWD/obj/$driver/$flavor
%endif
%else
# RedHat debug
ls -la /usr/src/kernels/
make -C %{kernel_source $flavor} V=1 M=$PWD/obj/$driver/$flavor
# RedHat based distributions
#%if 0%{?fedora_version}
# fix messed up dot in kernel_source macro
# /usr/src/kernels/2.6.29.4-167.fc11.i586 -> exists
# /usr/src/kernels/2.6.29.4-167.fc11-i586 does not exist
#echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}-")%_target_cpu"
# %__make -C %{kernel_source $flavor} V=1 modules M=$PWD/obj/$driver/$flavor
# %__make -C /usr/src/kernels/%{kverrel}.$([ $flavor = default ] || echo "$flavor.")%_target_cpu \
# V=1 modules M=$PWD/obj/$driver/$flavor
#%else
#%if 0%{?centos_version} || 0%{?rhel_version}
# %__make -C /usr/src/kernels/%{kverrel}-$([ $flavor = default ] || echo "$flavor-")%_target_cpu \
# V=1 modules M=$PWD/obj/$driver/$flavor
#%endif
#%endif
%endif
done
done
%install
%__make DESTDIR=$RPM_BUILD_ROOT install
%__cp examples/.libs/* $RPM_BUILD_ROOT%_bindir/
%__cp test/.libs/* $RPM_BUILD_ROOT%_bindir/
%__rm $RPM_BUILD_ROOT%_libdir/python*/site-packages/Gpib.pyc
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=extra/%{name}
for flavor in %flavors_to_build ; do
for driver in %drivers ; do
# SuSE based distributions
%if 0%{?suse_version} || 0%{?sles_version}
%if 0%{?suse_version} < 1120 && 0%{?sles_version} < 11
%__make -C /usr/src/linux-obj/%_target_cpu/$flavor V=1 modules_install \
M=$PWD/obj/$driver/$flavor
%else
%__make -C %{kernel_source $flavor} V=1 modules_install M=$PWD/obj/$driver/$flavor
%endif
%else
# RedHat based distributions
make -C %{kernel_source $flavor} V=1 modules_install \
M=$PWD/obj/$driver/$flavor
#%if 0%{?fedora_version}
# %__make -C /usr/src/kernels/%{kverrel}.$([ $flavor = default ] || echo "$flavor.")%_target_cpu \
# V=1 modules_install M=$PWD/obj/$driver/$flavor
#%else
#%if 0%{?centos_version} || 0%{?rhel_version}
# %__make -C /usr/src/kernels/%{kverrel}-$([ $flavor = default ] || echo "$flavor-")%_target_cpu \
# V=1 modules_install M=$PWD/obj/$driver/$flavor
#%endif
#%endif
%endif
done
done
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post python -p /sbin/ldconfig
%postun python -p /sbin/ldconfig
%post -n libgpib_tcl-3_2_14 -p /sbin/ldconfig
%postun -n libgpib_tcl-3_2_14 -p /sbin/ldconfig
%files
%defattr(-,root,root)
%_sbindir/*
%_libdir/libgpib.*
%_sysconfdir/*
%{_datadir}/usb*
%files devel
%defattr(-, root, root, -)
%{_includedir}/gpib
%files doc
%defattr(-, root, root, -)
%doc AUTHORS COPYING ChangeLog README TODO
%doc %{_datadir}/doc/packages/%{name}*
%files python
%defattr(-,root,root)
%_libdir/python*
%files -n libgpib_tcl-3_2_14
%defattr(-,root,root)
%_libdir/*tcl*
%files test
%defattr(-,root,root)
%_bindir/*
%changelog -n linux-gpib
* Mon Nov 16 2009 - christopher.lang@acurana.de
- fixed suse versions > 1120
* Sat Nov 14 2009 - christopher.lang@acurana.de
- spec file working
- added python and tcl packages
* Tue Nov 09 2009 - christopher.lang@acurana.de
- initial spec file for version 3.2.14