%define	ver	0.12.5
%define	srcver	%{ver}
%define	rel	1%{?_dist_release}
%define support_perl 0

Name:		pilot-link
Summary:	File transfer utilities between Linux and PalmPilots.
Summary(ja):	Linux と Palm handheld device を接続する為のユーティリティ
Version:	%{ver}
Release:	%{rel}
Epoch:		1

Group:		Applications/Other
License:	GPL/LGPL
URL:            http://www.pilot-link.org/

Source0:		http://downloads.pilot-link.org/pilot-link-%{version}.tar.bz2
Source1:	connect-palm-ppp.tar.bz2
Source2:	60-libpisock.rules.vine

# (fc) 0.10.99 fix python/perl installation
Patch1:		pilot-link-0.11.0-perlmd5.patch
Patch2:		pilot-link-0.11.0-perlpollute.patch
Patch3:		pilot-link-0.11.2-malsync.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	bison >= 1.35
BuildRequires:	libusb-devel >= 0.1
BuildRequires:	readline-devel
BuildRequires:	bluez-libs-devel
BuildRequires:	popt-devel
%if %{support_perl}
BuildRequires:	perl
%endif

Vendor:		Project Vine
Distribution:	Vine Linux

%description
This suite of tools allows you to upload and download programs and
data files between a Linux/UNIX machine and the PalmPilot.  It has a
few extra utils that will allow for things like syncing the
PalmPilot's calendar app with Ical.  Note that you might still need to
consult the sources for pilot-link if you would like the Python, Tcl,
or Perl bindings.

Install pilot-link if you want to synchronize your Palm with your Vine
Linux system.

%description -l ja
このツールを使うと、Linux/Unix マシンと Palm handheld device の間で
プログラムやファイルを転送することができます。このツールには、Palm 
handheld device の予定表と Ical との間で同期を可能にするようないくつ
かのユーティリティが付属しています。もし Python や Tcl、あるいは
Perl bindingsを使用する場合は、pilot-link の source を調べる必要が
あることに注意してください。

Palm handheld device を Vine Linux システムで同期させたい場合は
pilot-link をインストールします。

%package libs
Summary:	Runtime libraries for %{name}
Summary(ja): 	%{name} のランタイムライブラリ
Group:		System Environment/Libraries
Requires:	libusb >= 0.1

%description libs
This package provides the shared libraries for any pilot-link client 
program or interface.

%package devel
Summary:	PalmPilot development header files.
Summary(ja): 	Palm handheld プログラム開発用のヘッダ ファイル
Group:		Development/Libraries
Requires:	%{name}-libs = %{epoch}:%{version}

%description devel
This package contains the development headers that are used to build
the pilot-link package.  It also includes the static libraries
necessary to build static pilot apps.

If you want to develop PalmPilot synchronizing applications, you'll
need to install pilot-link-devel.

%description devel -l ja
このパッケージには、pilot-link パッケージを構築する為に必要な開発用の
ヘッダ ファイルが含まれます。また、スタティックな Palm 用アプリケーション
の構築に必要なスタティック ライブラリも含まれます。

Palm handheld deviceと同期するアプリケーションを開発したい場合は、
pilot-link-devel パッケージをインストールする必要があります。

%prep 
%setup -q -a 1
%if %{support_perl}
%patch1 -p1 -b .perlmd5
%patch2 -p1 -b .perlpollute
%patch3 -p1 -b .malsync
%endif

%build
%configure\
  --disable-static \
  --enable-conduits \
  --enable-libusb \
  --with-libpng \
  --with-bluez \
  --without-python \
  --without-tcl \
  --without-java \
%if %{support_perl}
  --with-perl
%else
  --without-perl
%endif

make

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%if %{support_perl}
if test -f bindings/Perl/Makefile.PL ; then
   cd bindings/Perl
   perl -pi -e 's|^\$libdir =.*|\$libdir = "%{buildroot}%{_libdir}";|g' Makefile.PL
   CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT/usr INSTALLDIRS=vendor
   make
   cd ../..
fi
%endif

%__make install DESTDIR=$RPM_BUILD_ROOT
#%makeinstall -C doc/man

%if %{support_perl}
make install -C bindings/Perl
rm -f %{buildroot}%{_libdir}/perl5/vendor_perl/%{perl_version}/*/auto/PDA/Pilot/Pilot.bs \
      %{buildroot}%{_libdir}/perl5/site_perl/*/*/*/PDA/Pilot/.packlist
%endif

# install modified udev rules.
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/60-libpisock.rules

# remove files we don't want to include
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING ChangeLog README NEWS AUTHORS doc/README.*
%{_bindir}/*
%{_mandir}/man1/*

%files libs
%defattr(-,root,root)
%doc COPYING.LIB 
%{_sysconfdir}/udev/rules.d/60-libpisock.rules
%{_libdir}/*.so.*
%if %{support_perl}
%{_libdir}/perl5/vendor_perl/*/*/*/PDA
%{_libdir}/perl5/vendor_perl/*/*/PDA
%endif
%{_datadir}/pilot-link
%{_mandir}/man7/*

%files devel
%defattr(-, root, root)
%{_libdir}/*.so
#{_libdir}/*.la
%{_libdir}/pkgconfig/pilot-link.pc
%{_includedir}/*
%{_datadir}/aclocal/*.m4


%changelog
* Thu Sep 30 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.12.5-1
- new upstream release
- split libraries to subpackage
- built with rpm-4.8.1 for pkg-config
- added URL tag

* Wed Aug 26 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.12.4-1
- new upstream release
- removed static libraries from devel package
- added --with-bluez to %%configure (added also BR: bluez-libs-devel)

* Mon Sep 08 2008 Shu KONNO <owa@bg.wakwak.com> 0.12.0-1vl5
- applied new versioning policy, spec in utf-8

* Sat Sep 30 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.12.0-0vl2
- add modified udev rules (Source2). <BTS:VineLinux:222>

* Sat Sep 02 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.12.0-0vl1
- source update.
- change Group to Applications/Other
- use %%configure macro instead of ./configure
- delete unused configure options for itcl and tk. 
- use '%%__make install' to use DESTDIR variable.
- comment out '%%makeinstall -C doc/man'(not required to install man).
- add 60-libpisock.rules for udev in %%files.
- add pilot-link.pc in %%files for -devel.
- add Requires libusb and BuildRequires libusb-devel >= 0.1.

* Fri Jan  6 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 0.11.8-0vl3
- rebuild for VineSeed
- add "%%{epoch}:" to Requires in pilot-link-devel

* Sun Nov 07 2004 Kazutaka Harada <kazutaka@dc4.so-net.ne.jp> 0.11.8-0vl2
- convert spec from SJIS to EUC.

* Wed Nov 03 2004 Kazutaka Harada <kazutaka@dc4.so-net.ne.jp> 0.11.8-0vl1
- source update
- add japanese translation(summary & description).
- use License tag instead of Copyright.
- change BuildRequires XFree86-devel to XOrg-devel.
- add BuildRequires readline-devel.
- add new Patch9.(avoid make error "undefined reference to `pow'")

* Fri May 23 2003 Tomoya TAKA <taka@vinelinux.org> 0.11.7-0vl2
- disuse %%configure macro to avoid unsuitable prefixed filename

* Mon Mar 24 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 0.11.7-0vl1
- source update

* Fri Jan 04 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.9.5-0vl2
- unfortunately added Epoch 1
  (the previous version was 0.9.5.pre5-0vl2. Sigh...)

* Sat Oct 13 2001 <uh@u.dhis.portside.net>
- 0.9.5-0vl1
- upgrade to 0.9.5
- add COPYING.LIB to %doc

* Mon Mar 26 2001 Akira TAGOH <tagoh@gnome.gr.jp> 0.9.5-pre5-0vl1
- New upstream release.
- Fixed defattr stuff for devel package.
- Use rpmmacros.

* Wed Oct 20 1999 Preston Brown <pbrown@redhat.com>
- upgrade to pilot-link 0.9.3, rewrite spec.

* Tue Apr 06 1999 Preston Brown <pbrown@redhat.com>
- strip binaries

* Tue Mar 30 1999 Preston Brown <pbrown@redhat.com>
- added missing files from devel subpackage

* Fri Mar 26 1999 Preston Brown <pbrown@redhat.com>
- move /usr/lib/pix to /usr/lib/pilot-link (dumb, BAD name)

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 5)

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Thu Jan 21 1999 Bill Nottingham <notting@redhat.com>
- arm fix

* Fri Sep 24 1998 Michael Maher <mike@redhat.com>
- cleaned up spec file, updated package

* Tue May 19 1998 Michael Maher <mike@redhat.com>
- updated rpm

* Thu Jan 29 1998 Otto Hammersmith <otto@redhat.com>
- added changelog
- updated to 0.8.9
- removed explicit requires for /usr/bin/perl

