File usbmuxd.spec of Package usbmuxd

#
# spec file for package usbmuxd
#
# 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/
#


Name:           usbmuxd
Version:        1.0.9git20140528
Release:        0
Summary:        A socket daemon to multiplex connections from and to iOS devices
License:        GPL-2.0 or GPL-3.0
Group:          System/Libraries
Url:            http://cgit.sukimashita.com/usbmuxd.git/
# To update libimobiledevice4 to support iOS 7, we need libusbmuxd
# which requires usbmuxd to be updated to git snapshot as well
#Source:         http://www.libimobiledevice.org/downloads/%{name}-%{version}.tar.bz2
Source:         %{name}-%{version}.tar.bz2
Source1:        usbmuxd.service.in
Source99:       baselibs.conf
BuildRequires:  gcc-c++
BuildRequires:  libimobiledevice-devel >= 1.0.6
BuildRequires:  libplist-devel >= 1.11
BuildRequires:  libtool
BuildRequires:  libusb-1_0-devel >= 1.0.3
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)
Requires:       libusbmuxd2 >= 1.0.9
Requires(pre):  pwdutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d}
%{?systemd_requires}

%description
This package provides the usbmuxd daemon for software to use through the
libusbmuxd library to talk with iPhone/iPod Touch devices.

Usbmux is an encapsulation protocol (think IP, ATM, PPP) that allows
multiplexing several conversations onto a single pair of wires.

%prep
%setup -q
./autogen.sh

%build
%configure
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}
# install systemd service
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
# fix udev rules
mkdir -p %{buildroot}%{_udevrulesdir}
mv %{buildroot}/lib/udev/rules.d/* %{buildroot}%{_udevrulesdir}/
rm -rf %{buildroot}/lib

%pre
getent passwd usbmux >/dev/null || useradd -r -g nogroup -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "%{name} daemon" usbmux
%service_add_pre usbmuxd.service
exit 0

%preun
%service_del_preun usbmuxd.service

%post
%{?udev_rules_update:%{udev_rules_update}}
%service_add_post usbmuxd.service
/sbin/ldconfig

%postun
%service_del_postun usbmuxd.service
/sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING.GPLv2 COPYING.GPLv3 README
%{_sbindir}/usbmuxd
%{_udevrulesdir}/39-usbmuxd.rules
%{_unitdir}/usbmuxd.service

%changelog
openSUSE Build Service is sponsored by