#
# Conditional build:
-%bcond_without static_libs # don't build static libraries
-#
+%bcond_with dietlibc # don't build static dietlibc library
+
Summary: C library for parsing command line parameters
Summary(de.UTF-8): C-Library zum Parsen von Befehlszeilenparametern
Summary(fr.UTF-8): Bibliothèque C pour analyser les paramètres de la ligne de commande
Summary(tr.UTF-8): Komut satırı parametrelerini ayrıştırımak için C arşivi
Summary(uk.UTF-8): Бібліотека C для розбору параметрів командної стрічки
Name: popt
-Version: 1.10.8
-Release: 1
+Version: 1.17
+Release: 3
License: X Consortium (MIT-like)
Group: Libraries
-#Source0: ftp://jbj.org/pub/rpm-4.4.x/%{name}-%{version}.tar.gz
-Source0: ftp://jbj.org/pub/rpm-4.4.x/rpm-4.4.8.tar.gz
-# Source0-md5: dc73bcebf6b206058457c9a90f944c55
-Patch0: %{name}-gettext0.11.patch
-Patch1: %{name}-libdir64.patch
-BuildRequires: autoconf >= 2.50
+Source0: http://rpm5.org/files/popt/%{name}-%{version}.tar.gz
+# Source0-md5: 7f98c657d35981d30dd372da5335c354
+Patch0: %{name}-diet.patch
+Patch1: %{name}-alias-argc.patch
+URL: http://rpm5.org/
+BuildRequires: autoconf >= 2.57
BuildRequires: automake >= 1.4
-BuildRequires: gettext-devel >= 0.11.5
-BuildRequires: libtool
+%{?with_dietlibc:BuildRequires: dietlibc-static >= 2:0.31-5}
+BuildRequires: gettext-tools >= 0.11.5
+BuildRequires: libtool >= 2:2.2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
# don't require very fresh rpm.macros to build
-%define __gettextize gettextize --copy --force --intl ; cp -f po/Makevars{.template,}
+%define __gettextize gettextize --copy --force ; cp -f po/Makevars{.template,}
+
+# for some reason known only to rpm there must be "\\|" not "\|" here
+%define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
+%define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
%description
-Popt is a C library for passing command line parameters. It was heavily
-influenced by the getopt() and getopt_long() functions, but it allows
-more powerful argument expansion. It can parse arbitrary argv[] style
-arrays and automatically set variables based on command line
+Popt is a C library for passing command line parameters. It was
+heavily influenced by the getopt() and getopt_long() functions, but it
+allows more powerful argument expansion. It can parse arbitrary argv[]
+style arrays and automatically set variables based on command line
arguments. It also 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.
Це окремий пакет зі статичними бібліотеками, що більше не входять в
склад popt-devel.
+%package dietlibc
+Summary: Static dietlibc library for popt development
+Summary(pl.UTF-8): Biblioteka statyczna dietlibc popt
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description dietlibc
+Static dietlibc library for popt development.
+
+%description dietlibc -l pl.UTF-8
+Biblioteka statyczna dietlibc popt.
+
%prep
-%setup -q -n rpm-4.4.8
-cd popt
+%setup -q
%patch0 -p1
%patch1 -p1
-mv -f po/{eu_ES,eu}.po
-mv -f po/{no,nb}.po
+%{__sed} -i -e 's#po/Makefile.in intl/Makefile##g' configure.ac
%build
-cd popt
%{__gettextize}
%{__libtoolize}
+%{__aclocal} -I m4
%{__autoheader}
-%{__aclocal}
%{__autoconf}
%{__automake} -i
+
+%if %{with dietlibc}
+__cc="%{__cc}"
+%configure \
+ CC="diet ${__cc#ccache } %{rpmcflags} %{rpmldflags} -Os -static" \
+ ac_cv_func_stpcpy=yes \
+%if "%{?configure_cache}" == "1"
+ --cache-file=%{?configure_cache_file}%{!?configure_cache_file:configure}-initrd.cache \
+%endif
+ --disable-shared \
+ --disable-silent-rules \
+ --enable-static
+
+# libpopt.la dependency on configmake.h missing
+%{__make} configmake.h
+%{__make} libpopt.la
+mv -f .libs/libpopt.a diet-libpopt.a
+%{__make} clean
+%endif
+
%configure \
- %{!?with_static_libs:--disable-static}
+ --disable-silent-rules
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_lib}
+%{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
-%{__make} -C popt install \
+%{__make} install \
+ pkgconfigdir=%{_pkgconfigdir} \
DESTDIR=$RPM_BUILD_ROOT
-mv -f $RPM_BUILD_ROOT%{_libdir}/lib*.so.*.* $RPM_BUILD_ROOT/%{_lib}
-rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.so
-ln -sf /%{_lib}/`(cd $RPM_BUILD_ROOT/%{_lib}; echo *)` \
+mv -f $RPM_BUILD_ROOT%{_libdir}/libpopt.so.* $RPM_BUILD_ROOT/%{_lib}
+ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libpopt.so.*.*.*) \
$RPM_BUILD_ROOT%{_libdir}/libpopt.so
+%{?with_dietlibc:install diet-libpopt.a $RPM_BUILD_ROOT%{dietlibdir}/libpopt.a}
+
%find_lang %{name}
%clean
%files -f %{name}.lang
%defattr(644,root,root,755)
-#%doc CHANGES COPYING README
-%doc popt/{CHANGES,COPYING,README}
+%doc CHANGES COPYING README
%attr(755,root,root) /%{_lib}/libpopt.so.*.*.*
+%attr(755,root,root) %ghost /%{_lib}/libpopt.so.0
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libpopt.so
%{_libdir}/libpopt.la
-%{_mandir}/man3/*
%{_includedir}/popt.h
+%{_pkgconfigdir}/popt.pc
+%{_mandir}/man3/popt.3*
-%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libpopt.a
+
+%if %{with dietlibc}
+%files dietlibc
+%defattr(644,root,root,755)
+%{dietlibdir}/libpopt.a
%endif