%bcond_without dotests Summary: C library for parsing command line parameters Name: popt Version: 1.19 Release: 1 License: MIT Group: Development/Libraries URL: https://github.com/rpm-software-management/popt Source0: http://ftp.rpm.org/popt/releases/popt-1.x/%{name}-%{version}.tar.gz # Below patch hardcodes /opt/freeware/lib/libiconv.a in the library search path # This is needed because base AIX has it's own /usr/lib/libiconv.a which conflicts # with /opt/freeware/lib/libiconv.a if AIX users export /usr/lib first in their # LIBPATH. This also needed for some packages like sudo_ids which requires # /usr/lib first in the LIBPATH Patch1: popt-1.18-aix.patch BuildRequires: gettext-devel >= 0.21 BuildRequires: libiconv >= 1.17 Requires: gettext >= 0.21 Requires: libiconv >= 1.17 %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. The library is available as 32-bit and 64-bit. %prep %setup -q %patch1 -p1 -b .aix # Duplicate source for 32 & 64 bits rm -rf /tmp/%{name}-%{version}-32bit cp -pr . /tmp/%{name}-%{version}-32bit rm -fr * mv /tmp/%{name}-%{version}-32bit 32bit cp -pr 32bit 64bit %build # first build the 64-bit version cd 64bit export CC="gcc -maix64 -O2" export LDFLAGS="-Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib" export OBJECT_MODE=64 ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir}64 \ --mandir=%{_mandir} \ --enable-shared --disable-static \ --with-libiconv-prefix=/opt/freeware gmake %{?_smp_mflags} # now build the 32-bit version cd ../32bit export CC="gcc -maix32 -O2 -D_LARGE_FILES" export LDFLAGS="-Wl,-bmaxdata:0x80000000 -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib" export OBJECT_MODE=32 ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ --enable-shared --disable-static \ --with-libiconv-prefix=/opt/freeware gmake %{?_smp_mflags} # add the 64-bit shared objects to the shared library containing already the # 32-bit shared objects /usr/bin/ar -X32_64 -q src/.libs/libpopt.a ../64bit/src/.libs/libpopt.so.0 %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit gmake DESTDIR=${RPM_BUILD_ROOT} install cd ../32bit gmake DESTDIR=${RPM_BUILD_ROOT} install # Multiple popt configurations are possible mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/popt.d ( cd ${RPM_BUILD_ROOT} for dir in include lib do mkdir -p usr/${dir} cd usr/${dir} ln -sf ../..%{_prefix}/${dir}/* . cd - done ) %check %if %{with dotests} cd 64bit export OBJECT_MODE=64 gmake -k check || true cd ../32bit export OBJECT_MODE=32 gmake -k check || true %endif %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system) %doc 32bit/CHANGES 32bit/COPYING 32bit/README %{_libdir}/*.a %{_libdir}64/*.a %{_libdir}/pkgconfig/*.pc %{_libdir}64/pkgconfig/*.pc /usr/lib/*.a %{_sysconfdir}/popt.d %{_includedir}/* /usr/include/* %{_mandir}/man3/* %{_datadir}/locale/*/*/* %changelog * Thu May 25 2023 Harshith K A 1.19-1 - Update to version popt-1.19-1 * Tue Aug 04 2020 Ayappan P 1.18-1 - Update to 1.18 * Thu Jan 29 2015 Sangamesh Mallayy 1.16-3 - Rebuild for distribution in AIX Toolbox. * Tue Apr 3 2012 Patricia Cugny 1.16-2 - port on AIX 6.1 * Fri May 13 2011 Patricia Cugny 1.16-1 - Update to version 1.16 * Thu Nov 5 2009 Jean Noel Cordenner 1.14-1 - Update to version 1.14