Blob Blame History Raw
%global __strip %{_mingw32_strip}
%global __objdump %{_mingw32_objdump}
%define __debug_install_post %{_mingw32_debug_install_post}

%global mingw_pkg_name antlr

Summary:		MinGW Windows ANTLR C++ run-time library
Name:			mingw-%{mingw_pkg_name}
Version:		2.7.7
Release:		8%{?dist}
License:		Public Domain
URL:			http://www.antlr.org/
Group:			Development/Libraries
Source0:		http://www.antlr2.org/download/%{mingw_pkg_name}-%{version}.tar.gz
Patch1:			%{mingw_pkg_name}-%{version}-newgcc.patch
Patch2:			mingw-%{mingw_pkg_name}.patch

BuildArch:		noarch

BuildRequires:		mingw32-filesystem >= 52
BuildRequires:		mingw32-gcc
BuildRequires:		mingw32-gcc-c++
BuildRequires:		mingw32-binutils
BuildRequires:		libtool
BuildRequires:		autoconf
BuildRequires:		automake

Requires:		pkgconfig


%description
ANTLR is a parser generator. This package contains the MinGW Windows
run-time library for ANTLR C++ parsers.

# Mingw32
%package -n mingw32-%{mingw_pkg_name}
Summary:		%{summary}

%description -n mingw32-%{mingw_pkg_name}
ANTLR is a parser generator. This package contains the MinGW Windows
run-time library for ANTLR C++ parsers.

%package -n mingw32-%{mingw_pkg_name}-static
Summary:		Static Version of the MinGW Windows ANTLR C++ run-time library
Group:			Development/Libraries
Requires:		mingw32-%{mingw_pkg_name} = %{version}-%{release}

%description -n mingw32-%{mingw_pkg_name}-static
Static version of the MinGW Windows ANTLR run-time library.

%{?_mingw32_debug_package}

%prep
%setup -q -n %{mingw_pkg_name}-%{version}
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
%patch1
%patch2 -p1 -b .mingw
# CRLF->LF
sed -i 's/\r//' LICENSE.txt

%build
%{_mingw32_configure} --without-examples
pushd lib/cpp
touch NEWS
rm -f {,antlr,src}/Makefile{.in,}
libtoolize -f -c
aclocal -I m4
autoconf
autoheader
automake -a -c
%{_mingw32_configure} --enable-static
make %{?_smp_mflags}
popd

%install
pushd lib/cpp
make install DESTDIR=$RPM_BUILD_ROOT
popd

rm -f $RPM_BUILD_ROOT%{_mingw32_libdir}/libantlr2.la

mkdir $RPM_BUILD_ROOT%{_bindir}
install -p -m 755 scripts/antlr-config $RPM_BUILD_ROOT%{_mingw32_bindir}/antlr-config
ln -s %{_mingw32_bindir}/antlr-config $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-antlr-config

%files -n mingw32-%{mingw_pkg_name}
%doc LICENSE.txt
%{_mingw32_includedir}/%{mingw_pkg_name}
%{_mingw32_bindir}/antlr-config
%{_mingw32_bindir}/libantlr2-0.dll
%{_mingw32_libdir}/libantlr2.dll.a
%{_mingw32_libdir}/pkgconfig/antlr2.pc
%{_bindir}/%{_mingw32_target}-antlr-config

%files -n mingw32-%{mingw_pkg_name}-static
%{_mingw32_libdir}/libantlr2.a


%changelog
* Mon Feb 27 2012 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.7.7-8
- Rebuild against the mingw-w64 toolchain

* Tue Jan 31 2012 Erik van Pienbroek <epienbro@fedoraproject.org> - 2.7.7-7
- Moved the antlr-config script from %%{_exec_prefix}/%%{_mingw32_target}/bin
  to %%{_mingw32_bindir}
- Dropped the dependency extraction magic as it's done automatically by RPM 4.9
- Dropped the %%clean section and %%defattr tags

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.7-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon May 23 2011 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.7.7-5
- transition to new package naming scheme

* Sun May  1 2011 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.7.7-4
- remove unnecessary cruft reported by Kalev Lember

* Mon Feb 21 2011 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.7.7-3
- build dynamic as well as static library

* Mon Feb 21 2011 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.7.7-2
- fix antlr-config --cxxflags
- workaround for the libtool "cannot link static library to DLL" problem

* Sat Feb 19 2011 Thomas Sailer <t.sailer@alumni.ethz.ch> - 2.7.7-1
- Initial Package (based on the native package)