##
##  mupdf.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:         mupdf
Summary:      PDF Rendering Library
URL:          http://mupdf.com/
Vendor:       Artifex Software
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Postscript
License:      AGPL
Version:      1.26.0
Release:      20250513

#   list of sources
Source0:      https://mupdf.com/downloads/archive/mupdf-%{version}-source.tar.gz
Patch0:       mupdf.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, gcc, gcc::with_cxx = yes
PreReq:       OpenPKG, openpkg >= 20160101

%description
     MuPDF is a lightweight PDF and XPS renderer. It is tailored for
     high quality anti-aliased graphics. It renders text with metrics
     and spacing accurate to within fractions of a pixel for the highest
     fidelity in reproducing the look of a printed page on screen. MuPDF
     is also small, fast, and yet complete. It supports PDF 1.7 with
     transparency, encryption, hyperlinks, annotations, searching and
     more. It also reads XPS and OpenXPS documents. The command line
     tools allow you to annotate, edit, and convert documents to other
     formats such as HTML, SVG, PDF, and CBZ. You can also write scripts
     to manipulate documents using Javascript.

%track
    prog mupdf = {
        version   = %{version}
        url       = https://mupdf.com/releases/index.html
        regex     = mupdf-(\d+\.\d+\.\d+)-source\.tar\.gz
    }

%prep
    %setup -q -n mupdf-%{version}-source
    %patch -p0

%build
    %{l_make} %{l_mflags -O} \
        CC="%{l_cc} %{l_cflags -O}" \
        CXX="%{l_cxx} %{l_cxxflags -O}" \
        HAVE_X11=no \
        prefix=%{l_prefix}

%install
    %{l_make} %{l_mflags} install \
        prefix=$RPM_BUILD_ROOT%{l_prefix}
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/mujstest
    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/mupdf
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

