##
##  papyrus.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         papyrus
Summary:      XML Reporting Engine for RDBMS
URL:          http://www.treshna.com/papyrus/
Vendor:       A. Hill, A. Renaud, T. Lord
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Database
License:      GPL
Version:      1.7.0
Release:      20120713

#   list of sources
Source0:      http://www.treshna.com/downloads/papyrus-%{version}.tar.gz
Patch0:       papyrus.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, libtool, gcc, make, pkgconfig, config
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  glib, gettext, libiconv, libxml, libxslt, libgda >= 2.99
PreReq:       glib, gettext, libiconv, libxml, libxslt, libgda >= 2.99

%description
    Papyrus is an XML reporting engine. It enables you to generate
    reports from a variety of different SQL databases. Your reports can
    be generated as PDF, PostScript, XML, HTML, DVI, Latex or straight
    ANSI text. Papyrus will correctly represent the reports in each of
    these outputted mediums with as much support as it can provide. The
    Papyrus XML language is aimed from a formatting perspective. To give
    you the ability to generate the best looking reports at ease.

%track
    prog papyrus = {
        version   = %{version}
        url       = http://www.treshna.com/papyrus/download/
        regex     = papyrus-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -n papyrus
    %patch -p0

%build
    rm -f config.guess config.sub
    %{l_prefix}/bin/config install .
    %{l_shtool} subst \
        -e 's;pkg-config libgda;pkg-config libgda-3.0;g' \
        configure
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O}" \
    CPPFLAGS="%{l_cppflags}" \
    LDFLAGS="%{l_ldflags}" \
    ./configure \
        --prefix=%{l_prefix} \
        --includedir=%{l_prefix}/include/papyrus \
        --enable-libgda
    ( echo "#!/bin/sh"
      echo "exec \"\$@\""
    ) >depcomp
    chmod 755 depcomp
    rm -f libtool
    ln -s %{l_prefix}/bin/libtool .
    %{l_make} %{l_mflags}

%install
    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    rm -rf $RPM_BUILD_ROOT%{l_prefix}/doc
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/share/papyrus
    mv  $RPM_BUILD_ROOT%{l_prefix}/bin/html_output.xsl \
        $RPM_BUILD_ROOT%{l_prefix}/share/papyrus/html_output.xsl
    %{l_shtool} subst \
        -e 's;/bin/bash;%{l_bash};g' \
        -e 's;$bindir/html_output.xsl;%{l_prefix}/share/papyrus/html_output.xsl;g' \
        $RPM_BUILD_ROOT%{l_prefix}/bin/papyrus
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std}

%files -f files

%clean

