%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
Summary:	C library for parsing command line parameters
Summary(ja):    コマンドラインパラメータを文法解析するためのCライブラリ
Name:		popt
Version:	1.14
Release:	4%{?_dist_release}
License:	MIT
Group:		System Environment/Libraries
URL:		http://www.rpm5.org/
Source0:	http://www.rpm5.org/files/%{name}/%{name}-%{version}.tar.gz
BuildRequires:	gettext, doxygen, graphviz
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root

%description
Popt is a C library for parsing command line parameters. Popt was
heavily influenced by the getopt() and getopt_long() functions, but
it improves on them by allowing more powerful argument expansion.
Popt can parse arbitrary argv[] style arrays and automatically set
variables based on command line arguments. Popt allows command line
arguments to be aliased via configuration files and includes utility
functions for parsing arbitrary strings into argv[] arrays using
shell-like rules.

%description -l ja
Poptはコマンドパラメータを文法解析するためのCライブラリです。
Poptは getopt()やgetopt_long()関数の影響を強く受けていますが、
もっと強力な引数の拡張を施すことによって、それらをもっと進化
させています。Poptは 任意の argv[]形式配列を解析して、コマンド
ライン引数に基づいて変数を自動的に設定します。
Poptは、コマンドライン引数を設定ファイルによってエイリアス化を
許可したり、シェルライクな方針を用いた任意の文字列を文法解析し
てargv[]配列に変換したりするユーティリティ関数を含んでいます。

%package devel
Summary:	Development files for the popt library
Summary(ja):    popt ライブラリの開発ファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}

%description devel
The popt-devel package includes header files and libraries necessary
for developing programs which use the popt C library. It contains the
API documentation of the popt library, too.

%package -n compat32-%{name}
Summary: A C library for parsing command line parameters.
Summary(ja): コマンドラインパラメータを文法解析するためのCライブラリ
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
Popt is a C library for parsing command line parameters. Popt was
heavily influenced by the getopt() and getopt_long() functions, but it
improves on them by allowing more powerful argument expansion. Popt
can parse arbitrary argv[] style arrays and automatically set
variables based on command line arguments. Popt allows command line
arguments to be aliased via configuration files and includes utility
functions for parsing arbitrary strings into argv[] arrays using
shell-like rules.

%description -n compat32-%{name} -l ja
Poptはコマンドパラメータを文法解析するためのCライブラリです。
Poptは getopt()やgetopt_long()関数の影響を強く受けていますが、
もっと強力な引数の拡張を施すことによって、それらをもっと進化
させています。Poptは 任意の argv[]形式配列を解析して、コマンド
ライン引数に基づいて変数を自動的に設定します。
Poptは、コマンドライン引数を設定ファイルによってエイリアス化を
許可したり、シェルライクな方針を用いた任意の文字列を文法解析し
てargv[]配列に変換したりするユーティリティ関数を含んでいます。

%package -n compat32-%{name}-devel
Summary:	Development files for the popt library
Summary(ja):    popt ライブラリの開発ファイル
Group:		Development/Libraries
Requires:	compat32-%{name} = %{version}-%{release}
Requires:	%{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
The popt-devel package includes header files and libraries necessary
for developing programs which use the popt C library. It contains the
API documentation of the popt library, too.

%prep
%setup -q

%build
%configure --libdir=/%{_lib}
make %{?_smp_mflags}
doxygen

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

# Move libpopt.{so,a} to %{_libdir}
rm -f $RPM_BUILD_ROOT/%{_lib}/libpopt.{la,so}
pushd $RPM_BUILD_ROOT/%{_lib}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
ln -sf ../../%{_lib}/$(ls libpopt.so.?.?.?) $RPM_BUILD_ROOT%{_libdir}/libpopt.so
popd
mv -f $RPM_BUILD_ROOT/%{_lib}/libpopt.a $RPM_BUILD_ROOT%{_libdir}/libpopt.a

# Multiple popt configurations are possible
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/popt.d

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig

%files -f %{name}.lang
%defattr(-,root,root)
%doc CHANGES COPYING
%{_sysconfdir}/popt.d
/%{_lib}/libpopt.so.*

%files devel
%defattr(-,root,root)
%doc README doxygen/html
%{_libdir}/libpopt.so
%{_libdir}/libpopt.a
%{_includedir}/popt.h
%{_mandir}/man3/popt.3*

%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
/%{_lib}/libpopt.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libpopt.so
%{_libdir}/libpopt.a
%endif


%changelog
* Fri Feb 12 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.14-4
- rebuilt with new toolchain

* Sun Jun 28 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.14-3
- updated Requires: and %%files section on compat32 subpackages

* Mon Jun 08 2009 Shu KONNO <owa@bg.wakwak.com> 1.14-2
- added %%define build_compat32
- fixed compat32 directories

* Mon Aug 18 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.14-1
- initial build for Vine Linux
  - splitted out from rpm, based on rpm5.org source.
- move libpopt to /lib[64] from /usr/lib[64]
  - initscripts-8 uses libpopt.

* Sun May 25 2008 Robert Scheck <robert@fedoraproject.org> 1.13-4
- Solved multilib problems at doxygen generated files (#342921)

* Wed Feb 20 2008 Robert Scheck <robert@fedoraproject.org> 1.13-3
- Revert the broken bind_textdomain_codeset() patch (#433324)

* Thu Feb 14 2008 Robert Scheck <robert@fedoraproject.org> 1.13-2
- Added patch to work around missing bind_textdomain_codeset()

* Sun Dec 30 2007 Robert Scheck <robert@fedoraproject.org> 1.13-1
- Upgrade to 1.13 (#290531, #332201, #425803)
- Solved multilib problems at doxygen generated files (#342921)

* Thu Aug 23 2007 Robert Scheck <robert@fedoraproject.org> 1.12-3
- Added buildrequirement to graphviz (#249352)
- Backported bugfixes from CVS (#102254, #135428 and #178413)

* Sun Aug 12 2007 Robert Scheck <robert@fedoraproject.org> 1.12-2
- Move libpopt to /lib[64] (#249814)
- Generate API documentation, added buildrequirement to doxygen

* Mon Jul 23 2007 Robert Scheck <robert@fedoraproject.org> 1.12-1
- Changes to match with Fedora Packaging Guidelines (#249352)

* Tue Jul 10 2007 Jeff Johnson <jbj@rpm5.org>
- release popt-1.12 through rpm5.org.

* Sat Jun  9 2007 Jeff Johnson <jbj@rpm5.org>
- release popt-1.11 through rpm5.org.

* Thu Dec 10 1998 Michael Johnson <johnsonm@redhat.com>
- released 1.2.2; see CHANGES

* Tue Nov 17 1998 Michael K. Johnson <johnsonm@redhat.com>
- added man page to default install

* Thu Oct 22 1998 Erik Troan <ewt@redhat.com>
- see CHANGES file for 1.2

* Thu Apr 09 1998 Erik Troan <ewt@redhat.com>
- added ./configure step to spec file
