File source-highlight.spec of Package source-highlight

# vim: set ts=4 sw=4 et:
#
# spec file for package source-highlight
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           source-highlight
Version:        3.1.6
Release:        0
%define soname  4
Summary:        Source Code Highlighter with Support for Many Languages
License:        GPL-3.0
Group:          Productivity/Publishing/Other
Source:         ftp://ftp.gnu.org/gnu/src-highlite/source-highlight-%{version}.tar.gz
Source1:        source-highlight-apache2.conf
Source99:       %{name}-rpmlintrc
Patch2:         source-highlight-doxygen_disable_timestamp_in_footer.patch
Url:            http://www.gnu.org/software/src-highlite
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  apache2
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  boost-devel
BuildRequires:  ctags
BuildRequires:  doxygen
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  glibc-devel
BuildRequires:  graphviz
BuildRequires:  help2man
BuildRequires:  libicu-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  pkgconfig
BuildRequires:  texinfo
%if 0%{?suse_version} >= 1030
BuildRequires:  fdupes
%endif
PreReq:         %install_info_prereq

%description
Source-highlight reads source language specifications dynamically, thus it can
be easily extended (without recompiling the sources) for handling new
languages. It also reads output format specifications dynamically, and thus it
can be easily extended (without recompiling the sources) for handling new
output formats. The syntax for these specifications is quite easy (take a look
at the manual).

%package -n libsource-highlight%{soname}
Summary:        Source Code Highlighting C++ Library
Group:          System/Libraries
Requires:       ctags

%description -n libsource-highlight%{soname}
Source-highlight reads source language specifications dynamically, thus it can
be easily extended (without recompiling the sources) for handling new
languages. It also reads output format specifications dynamically, and thus it
can be easily extended (without recompiling the sources) for handling new
output formats. The syntax for these specifications is quite easy (take a look
at the manual).

libsource-highlight is a C++ library that provides the features of
Source-highlight.

%package -n libsource-highlight-devel
Summary:        Source Code Highlighting C++ Library
Group:          Development/Libraries/C and C++
Requires:       libsource-highlight%{soname} = %{version}-%{release}
PreReq:         %install_info_prereq

%description -n libsource-highlight-devel
Source-highlight reads source language specifications dynamically, thus it can
be easily extended (without recompiling the sources) for handling new
languages. It also reads output format specifications dynamically, and thus it
can be easily extended (without recompiling the sources) for handling new
output formats. The syntax for these specifications is quite easy (take a look
at the manual).

libsource-highlight is a C++ library that provides the features of
Source-highlight.

%package cgi
Summary:        Source Code Highlighting CGI
Group:          Productivity/Networking/Web/Utilities
Requires:       apache2

%description cgi
Source-highlight reads source language specifications dynamically, thus it can
be easily extended (without recompiling the sources) for handling new
languages. It also reads output format specifications dynamically, and thus it
can be easily extended (without recompiling the sources) for handling new
output formats. The syntax for these specifications is quite easy (take a look
at the manual).

This package contains a CGI that can be used to highlight source code on
your webserver using source-highlight.

%prep
%setup -q
%patch2
%__sed -i 's/\r//g' doc/*.css

%build
BOOST_REGEX=$(/bin/ls -1 "%{_libdir}"/libboost_regex*mt*.so 2>/dev/null | head -1)
[ -n "$BOOST_REGEX" ] || BOOST_REGEX=$(/bin/ls -1 "%{_libdir}"/libboost_regex*.so 2>/dev/null | head -1)
if [ -n "$BOOST_REGEX" ]; then
    BOOST_REGEX="${BOOST_REGEX##*/lib}"
    BOOST_REGEX="${BOOST_REGEX%.so}"
    BOOST_REGEX_PARAM="--with-boost-regex=${BOOST_REGEX}"
else
    BOOST_REGEX_PARAM=""
fi

%configure \
    "$BOOST_REGEX_PARAM" \
    --with-bash-completion="%{_sysconfdir}/bash_completion.d" \
    --with-doxygen

%__make %{?_smp_mflags}

%__make %{?_smp_flags} -C src source-highlight-cgi

%install
%makeinstall

%__install -d "%{buildroot}/srv/source-highlight"
libtool --mode=install install -m 0755 src/source-highlight-cgi "%{buildroot}/srv/source-highlight/source-highlight.cgi"
%__install -D -m0644 "%{SOURCE1}" "%{buildroot}/etc/apache2/conf.d/%{name}.conf"

%__rm "%{buildroot}%{_libdir}"/*.la

%__rm -rf "%{buildroot}%{_docdir}/%{name}/html"
%__rm -rf "%{buildroot}%{_datadir}/doc"

%__chmod 0644 AUTHORS ChangeLog COPYING CREDITS NEWS README THANKS TODO.txt

%if 0%{?suse_version} >= 1030
%fdupes -s "%{buildroot}%{_datadir}/"
%endif

%post
%install_info --info-dir="%{_infodir}" "%{_infodir}/source-highlight".info%{ext_info}

%postun
%install_info_delete --info-dir="%{_infodir}" "%{_infodir}/source-highlight".info%{ext_info}

%post -n libsource-highlight-devel
%install_info --info-dir="%{_infodir}" "%{_infodir}/source-highlight-lib".info%{ext_info}

%postun -n libsource-highlight-devel
%install_info_delete --info-dir="%{_infodir}" "%{_infodir}/source-highlight-lib".info%{ext_info}

%post   -n libsource-highlight%{soname} -p /sbin/ldconfig
%postun -n libsource-highlight%{soname} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING CREDITS NEWS README THANKS TODO.txt
%config %{_sysconfdir}/bash_completion.d/source-highlight
%{_bindir}/check-regexp
%{_bindir}/cpp2html
%{_bindir}/java2html
%{_bindir}/source-highlight
%{_bindir}/src-hilite-lesspipe.sh
%{_bindir}/source-highlight-settings
%dir %{_datadir}/source-highlight
%{_datadir}/source-highlight/*
%doc %{_mandir}/man1/check-regexp.1%{ext_man}
%doc %{_mandir}/man1/source-highlight.1%{ext_man}
%doc %{_mandir}/man1/source-highlight-settings.1%{ext_man}
%doc %{_infodir}/source-highlight.info%{ext_man}

%files -n libsource-highlight%{soname}
%defattr(-,root,root)
%{_libdir}/libsource-highlight.so.%{soname}
%{_libdir}/libsource-highlight.so.%{soname}.*.*

%files -n libsource-highlight-devel
%defattr(-,root,root)
%{_includedir}/srchilite
%{_libdir}/libsource-highlight.so
%{_libdir}/libsource-highlight.a
%{_libdir}/pkgconfig/source-highlight.pc
%doc %{_infodir}/source-highlight-lib.info%{ext_info}

%files cgi
%defattr(-,root,root)
%config(noreplace) /etc/apache2/conf.d/source-highlight.conf
%dir /srv/source-highlight
/srv/source-highlight/source-highlight.cgi

%changelog
openSUSE Build Service is sponsored by