File owfs.spec of Package owfs

#
# spec file for package owfs
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libversion 3_1-0
Name:           owfs
Version:        3.1p0
Release:        0
Summary:        1-Wire Virtual File System
Summary:        Virtual filesystem on top of owfs-libs providing access to 1-Wire networks
License:        GPL-2.0
Group:          System/Libraries
Url:            http://sourceforge.net/projects/owfs
Source:         %{name}-%{version}.tar.gz
Source1:        owfs.tmpfiles
BuildRequires:  systemd
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  ed
BuildRequires:  fdupes
BuildRequires:  libtool
BuildRequires:  perl
BuildRequires:  php5-devel
BuildRequires:  swig
BuildRequires:  pkgconfig(fuse) >= 1.0
BuildRequires:  pkgconfig(python) >= 2.0
BuildRequires:  pkgconfig(python-2.7) >= 2.0
BuildRequires:  pkgconfig(python2) >= 2.0
BuildRequires:  pkgconfig(tcl) >= 8.1
BuildRequires:  libavahi-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libusb-1.0) >= 0.9.1
BuildRequires:  libusb-compat-devel
%{?systemd_requires}
# PATCH-FIX-UPSTREAM libusb-include.patch -- adds LIBUSB_CFLAGS in serveral places where it's needed to compile
Patch1: libusb-include.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
OWFS is a userspace virtual filesystem providing access to 1-Wire networks.

%package devel
Summary:        Devel files for owfs
Group:          Development/Libraries/Other
Requires:       libcapi-%{libversion} = %{version}
Requires:       libow-%{libversion} = %{version}
Requires:       libownet-%{libversion} = %{version}
Requires:       owfs-php

%description devel
Files needed to write your own programs using the owfs libraries.

%package -n libow-%{libversion}
Summary:        Core library providing base functions to other OWFS modules
Group:          System/Libraries

%description -n libow-%{libversion}
Core library providing base functions to other OWFS modules.

%package -n libowcapi-%{libversion}
Summary:        C-API to develop third-part applications which access 1-Wire networks
Group:          System/Libraries

%description -n libowcapi-%{libversion}
C-API library on top of libow providing an easy API to develop third-part applications
to access to 1-Wire networks.

%package -n libownet-%{libversion}
Summary:        C-API to develop third-part applications which access 1-Wire networks
Group:          System/Libraries

%description -n libownet-%{libversion}
Ownet library provids an easy API to develop third-part applications to access to 1-Wire networks.
It doesn't depend on owlib, and only supports remote-server connections.
This library doesn't include any 1-wire adapter support, except server connections.

%package fs
Summary:        Virtual filesystem on top of owfs-libs providing access to 1-Wire networks
Group:          System/Daemons

%description fs
Virtual filesystem on top of owfs-libs providing access to 1-Wire networks.

%package httpd
Summary:        HTTP daemon providing access to 1-Wire networks
Group:          System/Daemons

%description httpd
HTTP daemon on top of owfs providing access to 1-Wire networks.

%package ftpd
Summary:        FTP daemon providing access to 1-Wire networks
Group:          System/Daemons

%description ftpd
FTP daemon on top of owfs providing access to 1-Wire networks.

%package server
Summary:        Backend server (daemon) for 1-wire control
Group:          System/Daemons

%description server
The backend component of the OWFS 1-wire bus control system.
owserver arbitrates access to the bus from multiple client processes. The
physical bus is usually connected to a serial or USB port, and other processes
connect to owserver over network sockets (tcp port). Communication can be local
or over a network.

%package tap
Summary:        Packet sniffer for the owserver protocol
Group:          System/Daemons

%description tap
Packet sniffer for the owserver protocol

%package mon
Summary:        Statistics and settings monitor for owserver
Group:          System/Daemons

%description mon
Graphical monitor of owserver\'s status

%package -n perl-owfs
Summary:        Perl interface for the 1-wire filesystem
Group:          System/Libraries

%description -n perl-owfs
Perl interface for the 1-wire filesystem

%package -n python-owfs
Summary:        Python interface for the 1-wire filesystem
Group:          System/Libraries
Requires:       python-base

%description -n python-owfs
Python interface for the 1-wire filesystem

%package php
Summary:        Php interface for the 1-wire filesystem
Group:          System/Libraries

%description php
Php interface for the 1-wire filesystem

%package tcl
Summary:        Tcl interface for the 1-wire filesystem
Group:          System/Libraries

%description tcl
Tcl interface for the 1-wire filesystem

%package shell
Summary:        Light weight shell access to owserver and the 1-wire filesystem
Group:          System/Console

%description shell
Small programs to easily access owserver (and thus the 1-wire system) from shell scripts.

%prep
%setup -q
%patch -P 1 -p1

%build
export CFLAGS="$RPM_OPT_FLAGS"
./bootstrap

./configure \
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--disable-static \
	--enable-usb \
	--enable-owfs \
	--enable-owhttpd \
	--enable-owcapi \
	--enable-ownetlib \
	--enable-owftpd \
	--enable-owserver \
	--enable-owtap \
	--enable-owmon \
	--enable-owperl \
	--enable-owpython \
	--enable-owphp \
	--enable-owtcl \
	--with-systemdsystemunitdir=%{_unitdir} \

make %{?_smp_mflags}

%install
%if 0%{?sles_version} <= 11
make DESTDIR=%{buildroot} install %{?_smp_mflags}
%else
%make_install
%endif

%{__install} -d -m 0755 %{buildroot}%{_includedir}/owfs
mv -f %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/owfs

sed -i "s/User=ow/User=daemon/g" %{buildroot}%{_unitdir}/owhttpd.service
sed -i "s/Group=ow/Group=root/g" %{buildroot}%{_unitdir}/owhttpd.service
sed -i "s/User=ow/User=daemon/g" %{buildroot}%{_unitdir}/owftpd.service
sed -i "s/Group=ow/Group=root/g" %{buildroot}%{_unitdir}/owftpd.service
sed -i "s/User=ow/User=daemon/g" %{buildroot}%{_unitdir}/owserver.service
sed -i "s/Group=ow/Group=root/g" %{buildroot}%{_unitdir}/owserver.service

%{__install} -d -m 0755 %{buildroot}%{_tmpfilesdir}
%{__install} -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf

install -d -m 755 %{buildroot}%{_datadir}/tcl%{tcl_version}/owtcl-1.0
mv -f %{buildroot}%{_libdir}/owtcl-1.0/pkgIndex.tcl %{buildroot}%{_datadir}/tcl%{tcl_version}/owtcl-1.0

%{__install} -d -m 755 %{buildroot}%{perl_vendorlib}
mv -f %{buildroot}%{perl_sitelib}/* %{buildroot}%{perl_vendorlib}/

rm -f %{buildroot}%{_mandir}/man1/*.1so %{buildroot}%{_mandir}/man1/*.1so.gz
rm -f %{buildroot}%{_mandir}/man3/*.3so %{buildroot}%{_mandir}/man3/*.3so.gz
rm -f %{buildroot}%{_mandir}/man5/*.5so %{buildroot}%{_mandir}/man5/*.5so.gz
rm -f %{buildroot}%{_mandir}/mann/*.nso %{buildroot}%{_mandir}/mann/*.nso.gz
rm -f %{buildroot}%{perl_archlib}/perllocal.pod
rm -f %{buildroot}%{perl_vendorarch}/auto/OW/.packlist
rm -f %{buildroot}%{perl_vendorarch}/auto/OWNet/.packlist
rm -f %{buildroot}%{_libdir}/php5/extensions/libowphp.la %{buildroot}%{_libdir}/php5/extensions/libowphp.a
rm -f %{buildroot}%{_libdir}/owtcl-*/ow.la %{buildroot}%{_libdir}/owtcl-*/ow.a
find %{buildroot} -type f -name "*.la" -delete -print
rm -f %{buildroot}%{_libdir}/python*/site-packages/ownet/connection.pyc
rm -f %{buildroot}%{_libdir}/python*/site-packages/ow/__init__.pyc
rm -f %{buildroot}%{_libdir}/python*/site-packages/ownet/__init__.pyc

%{__install} -d -m 0755 %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcowfs
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcowftpd
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcowhttpd
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcowserver

%fdupes -s %{buildroot}/%{_mandir}

%post -n libow-%{libversion} -p /sbin/ldconfig

%postun -n libow-%{libversion} -p /sbin/ldconfig

%post -n libowcapi-%{libversion} -p /sbin/ldconfig

%postun -n libowcapi-%{libversion} -p /sbin/ldconfig

%post -n libownet-%{libversion} -p /sbin/ldconfig

%postun -n libownet-%{libversion} -p /sbin/ldconfig

%pre fs
%service_add_pre owfs.service

%post fs
%service_add_post owfs.service
systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf

%preun fs
%service_del_preun owfs.service

%postun fs
%service_del_postun owfs.service

%pre httpd
%service_add_pre owhttpd.service

%post httpd
%service_add_post owhttpd.service

%preun httpd
%service_del_preun owhttpd.service

%postun httpd
%service_del_postun owhttpd.service

%pre ftpd
%service_add_pre owftpd.service

%post ftpd
%service_add_post owftpd.service

%preun ftpd
%service_del_preun owftpd.service

%postun ftpd
%service_del_postun owftpd.service

%pre server
%service_add_pre owserver.service
%service_add_pre owserver.socket

%post server
%service_add_post owserver.service
%service_add_post owserver.socket

%preun server
%service_del_preun owserver.service
%service_del_preun owserver.socket

%postun server
%service_del_postun owserver.service
%service_del_postun owserver.socket


%files devel
%defattr(-,root,root)
%dir %{_includedir}/owfs
%{_includedir}/owfs/owfs_config.h
%{_includedir}/owfs/owcapi.h
%{_includedir}/owfs/ownetapi.h
%{_libdir}/libowcapi.so
%{_libdir}/libow.so
%{_libdir}/libownet.so
%{_libdir}/php5/extensions/libowphp.so

%files -n libow-%{libversion}
%defattr(-,root,root)
%doc README NEWS ChangeLog AUTHORS COPYING
%{_libdir}/libow-*.so*
%{_mandir}/man3/DS1427.3.gz
%{_mandir}/man3/DS1821.3.gz
%{_mandir}/man3/DS1822.3.gz
%{_mandir}/man3/DS1825.3.gz
%{_mandir}/man3/DS18B20.3.gz
%{_mandir}/man3/DS18S20.3.gz
%{_mandir}/man3/DS1904.3.gz
%{_mandir}/man3/DS1920.3.gz
%{_mandir}/man3/DS1921.3.gz
%{_mandir}/man3/DS1963L.3.gz
%{_mandir}/man3/DS1963S.3.gz
%{_mandir}/man3/DS1971.3.gz
%{_mandir}/man3/DS1977.3.gz
%{_mandir}/man3/DS1982.3.gz
%{_mandir}/man3/DS1982U.3.gz
%{_mandir}/man3/DS1985.3.gz
%{_mandir}/man3/DS1985U.3.gz
%{_mandir}/man3/DS1986.3.gz
%{_mandir}/man3/DS1986U.3.gz
%{_mandir}/man3/DS1990A.3.gz
%{_mandir}/man3/DS1991.3.gz
%{_mandir}/man3/DS1992.3.gz
%{_mandir}/man3/DS1993.3.gz
%{_mandir}/man3/DS1994.3.gz
%{_mandir}/man3/DS1995.3.gz
%{_mandir}/man3/DS1996.3.gz
%{_mandir}/man3/DS2401.3.gz
%{_mandir}/man3/DS2404.3.gz
%{_mandir}/man3/DS2404S.3.gz
%{_mandir}/man3/DS2405.3.gz
%{_mandir}/man3/DS2406.3.gz
%{_mandir}/man3/DS2407.3.gz
%{_mandir}/man3/DS2408.3.gz
%{_mandir}/man3/DS2409.3.gz
%{_mandir}/man3/DS2411.3.gz
%{_mandir}/man3/DS2413.3.gz
%{_mandir}/man3/DS2415.3.gz
%{_mandir}/man3/DS2417.3.gz
%{_mandir}/man3/DS2423.3.gz
%{_mandir}/man3/DS2430A.3.gz
%{_mandir}/man3/DS2431.3.gz
%{_mandir}/man3/DS2433.3.gz
%{_mandir}/man3/DS2436.3.gz
%{_mandir}/man3/DS2437.3.gz
%{_mandir}/man3/DS2438.3.gz
%{_mandir}/man3/DS2450.3.gz
%{_mandir}/man3/DS2502-E48.3.gz
%{_mandir}/man3/DS2502-UNW.3.gz
%{_mandir}/man3/DS2502.3.gz
%{_mandir}/man3/DS2505-UNW.3.gz
%{_mandir}/man3/DS2505.3.gz
%{_mandir}/man3/DS2506-UNW.3.gz
%{_mandir}/man3/DS2506.3.gz
%{_mandir}/man3/DS2720.3.gz
%{_mandir}/man3/DS2740.3.gz
%{_mandir}/man3/DS2751.3.gz
%{_mandir}/man3/DS2755.3.gz
%{_mandir}/man3/DS2756.3.gz
%{_mandir}/man3/DS2760.3.gz
%{_mandir}/man3/DS2761.3.gz
%{_mandir}/man3/DS2762.3.gz
%{_mandir}/man3/DS2770.3.gz
%{_mandir}/man3/DS2780.3.gz
%{_mandir}/man3/DS2781.3.gz
%{_mandir}/man3/DS2788.3.gz
%{_mandir}/man3/DS2804.3.gz
%{_mandir}/man3/DS2890.3.gz
%{_mandir}/man3/DS28E04.3.gz
%{_mandir}/man3/DS28EA00.3.gz
%{_mandir}/man3/DS28EC20.3.gz
%{_mandir}/man3/EDS.3.gz
%{_mandir}/man3/EDS0064.3.gz
%{_mandir}/man3/EDS0065.3.gz
%{_mandir}/man3/EDS0066.3.gz
%{_mandir}/man3/EDS0067.3.gz
%{_mandir}/man3/EDS0068.3.gz
%{_mandir}/man3/EDS0071.3.gz
%{_mandir}/man3/EDS0072.3.gz
%{_mandir}/man3/EEEF.3.gz
%{_mandir}/man3/LCD.3.gz
%{_mandir}/man3/MAX31826.3.gz
%{_mandir}/man3/Thermachron.3.gz
%{_mandir}/man3/UVI.3.gz
%{_mandir}/man3/mAM001.3.gz
%{_mandir}/man3/mCM001.3.gz
%{_mandir}/man3/mRS001.3.gz
%{_mandir}/man3/mDI001.3.gz
%{_mandir}/man3/EDS0070.3.gz
%{_mandir}/man3/EDS0080.3.gz
%{_mandir}/man3/EDS0082.3.gz
%{_mandir}/man3/EDS0083.3.gz
%{_mandir}/man3/EDS0085.3.gz
%{_mandir}/man3/EDS0090.3.gz
%{_mandir}/man3/MAX31820.3.gz
%{_mandir}/man3/MAX31850.3.gz
%{_mandir}/man3/MAX31851.3.gz

%files -n libowcapi-%{libversion}
%defattr(-,root,root)
%{_libdir}/libowcapi-*.so*
%{_mandir}/man1/*owcapi.1.*

%files -n libownet-%{libversion}
%defattr(-,root,root)
%{_libdir}/libownet-*.so*
%{_mandir}/man1/*ownet*.1.*

%files fs
%defattr(-,root,root)
%{_unitdir}/owfs.service
%{_sbindir}/rcowfs
%{_tmpfilesdir}/%{name}.conf
%{_bindir}/owfs
%{_mandir}/man1/owfs.1.*
%{_mandir}/man5/owfs.5.*
%{_mandir}/man5/owfs.conf.5.*

%files httpd
%defattr(-,root,root)
%{_unitdir}/owhttpd.service
%{_sbindir}/rcowhttpd
%{_bindir}/owhttpd
%{_mandir}/man1/owhttpd.1.*

%files shell
%defattr(-,root,root)
%{_bindir}/owdir
%{_bindir}/owread
%{_bindir}/owwrite
%{_bindir}/owget
%{_bindir}/owpresent
%{_bindir}/owexist
%{_bindir}/owexternal
%{_mandir}/man1/owshell.1.*
%{_mandir}/man1/owdir.1.*
%{_mandir}/man1/owread.1.*
%{_mandir}/man1/owget.1.*
%{_mandir}/man1/owpresent.1.*
%{_mandir}/man1/owwrite.1.*
%{_mandir}/mann/ow.n.*

%files ftpd
%defattr(-,root,root)
%{_unitdir}/owftpd.service
%{_sbindir}/rcowftpd
%{_bindir}/owftpd
%{_mandir}/man1/owftpd.1.*

%files server
%defattr(-,root,root)
%{_unitdir}/owserver.service
%{_sbindir}/rcowserver
%{_unitdir}/owserver.socket
%{_bindir}/owserver
%{_mandir}/man1/owserver.1.*

%files tap
%defattr(-,root,root)
%{_bindir}/owtap
%{_mandir}/man1/owtap.1.*

%files mon
%defattr(-,root,root)
%{_bindir}/owmon
%{_mandir}/man1/owmon.1.*

%files  -n perl-owfs
%defattr(-,root,root)
%dir %{perl_vendorarch}/auto
%dir %{perl_vendorarch}/auto/OW
%{perl_vendorarch}/auto/OW/OW.*
%{perl_vendorarch}/OW.pm
%{perl_vendorlib}/OWNet.pm
%{_mandir}/man3/OWNet.3*
%{_mandir}/man3/owperl.3.gz

%files -n python-owfs
%defattr(-,root,root)
%{_libdir}/python*/site-packages/ow-*.egg-info
%dir %{_libdir}/python*/site-packages/ow
%{_libdir}/python*/site-packages/ow/_OW.so
%{_libdir}/python*/site-packages/ow/__init__.py
%{_libdir}/python*/site-packages/ownet-*.egg-info
%dir %{_libdir}/python*/site-packages/ownet
%{_libdir}/python*/site-packages/ownet/__init__.py
%{_libdir}/python*/site-packages/ownet/connection.py

%files php
%defattr(-,root,root)
%dir %{_libdir}/php5/extensions
%{_libdir}/php5/extensions/libowphp.so.*
%dir %{_datadir}/php
%dir %{_datadir}/php/OWNet
%{_datadir}/php/OWNet/ownet.php

%files tcl
%defattr(-,root,root)
%dir %{_datadir}/tcl%{tcl_version}
%dir %{_datadir}/tcl%{tcl_version}/owtcl-*
%{_datadir}/tcl%{tcl_version}/owtcl-*/*
%dir %{_libdir}/owtcl-*
%{_libdir}/owtcl-*/*
%{_mandir}/mann/owtcl.n.*

%changelog
openSUSE Build Service is sponsored by