You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

111 lines
3.9 KiB

##
## pdfcropmargins.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 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 versions
%define V_pdfcropmargins_base 1.0.5
%define V_pdfcropmargins_snap 20210309
%define V_python 3.9
# package information
Name: pdfcropmargins
Summary: Crop Margins in PDF Documents
URL: https://github.com/abarker/pdfCropMargins
Vendor: Allen Barker
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: PDF
License: GPL
Version: %{V_pdfcropmargins_base}.%{V_pdfcropmargins_snap}
Release: 20210309
# list of sources
Source0: http://download.openpkg.org/components/versioned/pdfcropmargins/pdfcropmargins-%{V_pdfcropmargins_snap}.tar.xz
Source1: pdfcropmargins.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101
BuildPreReq: python, python-setup
PreReq: python, ghostscript
%description
The pdf-crop-margins(1) program is a command-line application to
automatically crop the margins of PDF files. Cropping the margins
can make it easier to read the pages of a PDF document – whether
the document is printed or displayed on a screen – because the
display fonts are larger.
%track
prog pdfcropmargins:base = {
version = %{V_pdfcropmargins_base}
url = https://pypi.org/project/pdfCropMargins/
regex = pdfCropMargins\s+(\d+\.\d+\.\d+)
}
prog pdfcropmargins:snap = {
version = %{V_pdfcropmargins_snap}
url = http://download.openpkg.org/components/versioned/pdfcropmargins/
regex = pdfcropmargins-(__VER__)\.tar\.xz
}
%prep
%setup -q -n pdfcropmargins
%build
%install
# install package
export HOME=`pwd`
%{l_prefix}/bin/python -m pip \
install \
--root=$RPM_BUILD_ROOT \
--prefix=%{l_prefix}/lib/pdfcropmargins \
--isolated \
--ignore-installed \
--no-warn-script-location \
*
# post-patch program
( cd $RPM_BUILD_ROOT%{l_prefix}/lib/pdfcropmargins/lib/python%{V_python}/site-packages
%{l_patch} -p0 <%{SOURCE pdfcropmargins.patch}
) || exit $?
# provide executable wrapper
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin
( echo "#!/bin/sh"
echo "PATH=\"%{l_prefix}/bin:\$PATH\""
echo "export PATH"
echo "PYTHONPATH=\"%{l_prefix}/lib/pdfcropmargins/lib/python%{V_python}/site-packages:%{l_prefix}/lib/python/site-packages\""
echo "export PYTHONPATH"
echo "exec %{l_prefix}/lib/pdfcropmargins/bin/pdf-crop-margins \${1+\"\$@\"}"
) >$RPM_BUILD_ROOT%{l_prefix}/bin/pdf-crop-margins
chmod a+x $RPM_BUILD_ROOT%{l_prefix}/bin/pdf-crop-margins
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
%files -f files
%clean