File bison.spec of Package bison

%define realname bison
%define realver  3.4.2
%define srcext   tar.xz

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

%if 0%{?suse_version} < 1500 || 0%{?rhel} < 7
%define cxx11abi -D_GLIBCXX_USE_CXX11_ABI=0
%endif

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License:       GPL-2.0
Group:         Development/Languages/C and C++
URL:           http://www.gnu.org/software/bison/bison.html
Summary:       The Yacc-compatible Parser Generator

# Install-time parameters
Provides:      yacc

# Build-time parameters
BuildRequires: xz
BuildRequires: gcc-c++
BuildRequires: flex m4 perl%{?suse_version:-base}
%if 0%{?rhel} || 0%{?sles_version}
BuildRequires: libxslt
%else
BuildRequires: libxslt-tools
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://ftp.gnu.org/gnu/bison/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
Bison is a general-purpose parser generator that converts an annotated
context-free grammar into a deterministic LR or generalized LR (GLR) parser
employing LALR(1) parser tables. As an experimental feature, Bison can also
generate IELR(1) or canonical LR(1) parser tables. Once you are proficient with
Bison, you can use it to develop a wide range of language parsers, from those
used in simple desk calculators to complex programming languages.

Bison is upward compatible with Yacc: all properly-written Yacc grammars ought
to work with Bison with no change. Anyone familiar with Yacc should be able to
use Bison with little trouble. You need to be fluent in C or C++ programming in
order to use Bison. Java is also supported as an experimental feature.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
_CFLAGS='%{optflags}'
_CXXFLAGS='%{optflags} %{?cxx11abi}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all'
%configure \
 --disable-assert \
 --disable-rpath \
 CFLAGS="$_CFLAGS" \
 CXXFLAGS="$_CXXFLAGS" \
 LDFLAGS="$_LDFLAGS" \
 LIBS="-lrt"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
if [ "%{buildroot}" != "/" ]; then
    %{__rm} -rf %{buildroot}%{_datadir}/doc/%{name}
    test -f %{buildroot}%{_infodir}/dir && %{__rm} -f %{buildroot}%{_infodir}/dir
fi
%find_lang %{name}
%find_lang %{name}-gnulib
%find_lang %{name}-runtime
cat %{name}-gnulib.lang  >> %{name}.lang
cat %{name}-runtime.lang >> %{name}.lang

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README THANKS
%{_bindir}/*
%{_libdir}/liby.a
%dir %{_datadir}/aclocal/
%{_datadir}/aclocal/bison-i18n.m4
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/*
%doc %{_mandir}/man1/*
%doc %{_infodir}/bison.info*

%post
/sbin/install-info %{_infodir}/bison.info* %{_infodir}/dir || :

%preun
[ $1 = 0 ] && /sbin/install-info --delete %{_infodir}/bison.info* %{_infodir}/dir || :

%changelog
openSUSE Build Service is sponsored by