Files
haikuports/app-text/xpdf/xpdf-4.06.recipe
2025-11-25 12:15:16 +01:00

108 lines
3.1 KiB
Bash

SUMMARY="Open source Portable Document Format (PDF) viewer"
DESCRIPTION="Xpdf is a free PDF viewer and toolkit, including a text extractor, image \
converter, HTML converter, and more. Most of the tools are available as \
open source."
HOMEPAGE="https://www.xpdfreader.com/"
COPYRIGHT="1996-2025 Glyph & Cog, LLC."
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://dl.xpdfreader.com/xpdf-$portVersion.tar.gz"
CHECKSUM_SHA256="1c38f527c46caee0f712386d42a885b96a31ed9ce11904e872559859894d137e"
SOURCE_DIR="xpdf-$portVersion"
PATCHES="xpdf-$portVersion.patchset"
ADDITIONAL_FILES="xpdfreader.rdef.in"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
xpdf$secondaryArchSuffix = $portVersion
app:XpdfViewer = $portVersion
cmd:pdftopng$commandSuffix = $portVersion
cmd:xpdf$commandSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
urw_base35_fonts
lib:libfontconfig$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libpaper$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libtiff$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libfontconfig$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libpaper$secondaryArchSuffix >= 2
devel:libpng16$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:libtiff$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
"
BUILD()
{
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_INSTALL_MANDIR=$manDir \
-DSPLASH_CMYK=ON -L
make -C build $jobArgs
}
INSTALL()
{
make -C build install
mkdir -p $appsDir
mv $prefix/bin/xpdf $appsDir/XpdfReader
ln -s $appsDir/XpdfReader $prefix/bin/xpdf
# remove stuff provided by poppler
for tool in pdfdetach pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext pdftohtml; do
rm "$commandBinDir/${tool}" "$manDir/man1/${tool}.1"
done
local APP_SIGNATURE="application/x-vnd.xpdf"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local MINOR="01"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/xpdfreader.rdef.in > xpdfreader.rdef
addResourcesToBinaries xpdfreader.rdef $appsDir/XpdfReader
addAppDeskbarSymlink $appsDir/XpdfReader
}