%global __strip %{_mingw32_strip}
%global __objdump %{_mingw32_objdump}
%global _use_internal_dependency_generator 0
%global __find_requires %{_mingw32_findrequires}
%global __find_provides %{_mingw32_findprovides}
%define __debug_install_post %{_mingw32_debug_install_post}
Name: mingw32-libgnurx
Version: 2.5.1
Release: 6%{?dist}
Summary: MinGW Regex library
License: LGPLv2+
Group: Development/Libraries
URL: http://mingw.sourceforge.net/
Source0: http://kent.dl.sourceforge.net/sourceforge/mingw/mingw-libgnurx-%{version}-src.tar.gz
Source1: mingw32-libgnurx-configure.ac
Source2: mingw32-libgnurx-Makefile.am
Patch0: mingw32-libgnurx-honor-destdir.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: autoconf automake libtool
BuildRequires: mingw32-filesystem >= 52
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
%description
MinGW Windows regular expression library.
%package static
Summary: Static version of the MinGW Windows regular expression library
Requires: %{name} = %{version}-%{release}
Group: Development/Libraries
%description static
Static version of the MinGW Windows regular expression library.
%{_mingw32_debug_package}
%prep
%setup -q -n mingw-libgnurx-%{version}
%patch0 -p0
# The Makefile which is delivered with this package can't create static
# libraries and misnames the resulting import libraries
# So replace the buildsystem by a more proper one
cp %{SOURCE1} configure.ac
cp %{SOURCE2} Makefile.am
touch NEWS
touch AUTHORS
libtoolize --copy
aclocal
autoconf
automake --add-missing
%build
%{_mingw32_configure} --enable-static --enable-shared
make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
# make install expects %{_mingw32_includedir} to exist
mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
make DESTDIR=$RPM_BUILD_ROOT install
# make install installs two import libraries named libgnurx.a and
# libgnurx.dll.a. As most applications requiring regex functions
# try to perform 'gcc -lregex' we rename the import libraries for this to work
mv $RPM_BUILD_ROOT%{_mingw32_libdir}/libgnurx.a $RPM_BUILD_ROOT%{_mingw32_libdir}/libregex.a
mv $RPM_BUILD_ROOT%{_mingw32_libdir}/libgnurx.dll.a $RPM_BUILD_ROOT%{_mingw32_libdir}/libregex.dll.a
mv $RPM_BUILD_ROOT%{_mingw32_libdir}/libgnurx.la $RPM_BUILD_ROOT%{_mingw32_libdir}/libregex.la
sed -i s/gnurx/regex/ $RPM_BUILD_ROOT%{_mingw32_libdir}/libregex.la
# Drop the man pages
rm -rf $RPM_BUILD_ROOT%{_mingw32_datadir}/man
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYING.LIB
%{_mingw32_bindir}/libgnurx-0.dll
%{_mingw32_includedir}/regex.h
%{_mingw32_libdir}/libregex.dll.a
%{_mingw32_libdir}/libregex.la
%files static
%defattr(-,root,root,-)
%{_mingw32_libdir}/libregex.a
%changelog
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Mon Jun 22 2009 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.5.1-5
- The wrong RPM variable was overriden for -debuginfo support. Should be okay now
* Mon Jun 22 2009 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.5.1-4
- Split out debug symbols to a -debuginfo subpackage
* Wed Jun 3 2009 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.5.1-3
- The libtool .la file referenced to the wrong file. Fixed
* Tue May 26 2009 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.5.1-2
- Fixed license tag
* Sun May 24 2009 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.5.1-1
- Initial release