Skip to content

Commit

Permalink
media-libs/leptonica: Version bump to 1.79.0
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.95, Repoman-2.3.20
Signed-off-by: James Le Cuirot <[email protected]>
  • Loading branch information
chewi committed Mar 24, 2020
1 parent 037714c commit 0f291ef
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 0 deletions.
1 change: 1 addition & 0 deletions media-libs/leptonica/Manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DIST leptonica-1.74.4.tar.gz 12349877 BLAKE2B 5c4a71c1c4f44b617f16b1b1029455badee268dc1ac459f1c7ffe6af5b8dbe702bdbaa6e5564af6e41d0881c59e1aa43dc40d5164f618f13ca2a563b2aa3bd0e SHA512 e74732c10218430463ca01f15e19d329dceb938e315586ed100c634c4d50809824f1d9bf7eeaf91654caf42ed78a5ae5de7c08e7a1d8884c580c536121627891
DIST leptonica-1.77.0.tar.gz 12888756 BLAKE2B a1de6ff8d886c4e302faa362ad5c18ece727771e5cdbe62b33c34c950d1af9e0e97418e59485568a6386eb2a7e51fd42ffb2fd01f16591c5bc668961640f1f4d SHA512 3cf764c76d5acb6d5982c44e78c02d7a7c3b5e79937c41df193e71dd8a02dbbf965d34a2ecdf0444e907cb73c06bdb8bcae4ceafbf5ee1483c022659e897015b
DIST leptonica-1.78.0.tar.gz 12905925 BLAKE2B 6a7b74e8aa78a3e4fa6429bbf180001e7d362ebd37d4fd179ba90df7a41993e52d708813ea5a2b30dc90516b7bec83e5386735025993d73f279ab595c39f6c9c SHA512 f059ccc8e7b5ff2c796aeb4ab18bd25e133ec4f38c36b9e2ee203db35a1e68cf45b8baf78ebc4acba4e3607328d1374ea0e8425f35cbe06c6c5728a1ec8c3f50
DIST leptonica-1.79.0.tar.gz 13438669 BLAKE2B 59c126c0bc4690cf48937171f818637f420b4e4c56ebf866ca4c0d2a9a8f2ae2653f6ef7650340138fb1dd2ca2d3826e0f844d44afddb14856e31daf10f41c41 SHA512 4d0830683757004bb47752a17985d80c6758b97c0fd6ec64d23bbf43c9c68b04bee751831574afa4c25f5d5030c0c9f7fc22d9fc8ef932aa990401344f588ba5
299 changes: 299 additions & 0 deletions media-libs/leptonica/files/1.79.0-tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
From b4cdb9256934c8f35cad558bf7288567211a792f Mon Sep 17 00:00:00 2001
From: James Le Cuirot <[email protected]>
Date: Tue, 24 Mar 2020 20:59:17 +0000
Subject: [PATCH] Fix parallel running of tests by using unique directories

diff --git a/prog/pdfio2_reg.c b/prog/pdfio2_reg.c
index 3f2090d..19da5a3 100644
--- a/prog/pdfio2_reg.c
+++ b/prog/pdfio2_reg.c
@@ -55,7 +55,7 @@ L_REGPARAMS *rp;
return 1;

l_pdfSetDateAndVersion(0);
- lept_mkdir("lept/pdf");
+ lept_mkdir("lept/pdf2");

/* ---------- pdf convert segmented with image regions ---------- */
fprintf(stderr, "\n*** Writing segmented images with image regions\n");
@@ -65,6 +65,12 @@ L_REGPARAMS *rp;
* small bogus regions at the top, but we'll keep them for
* the demonstration. */
pix1 = pixRead("rabi.png");
+ pix2 = pixScaleToGray2(pix1);
+ pixWrite("/tmp/lept/pdf2/rabi8.jpg", pix2, IFF_JFIF_JPEG);
+ pix3 = pixThresholdTo4bpp(pix2, 16, 1);
+ pixWrite("/tmp/lept/pdf2/rabi4.png", pix3, IFF_PNG);
+ pixDestroy(&pix2);
+ pixDestroy(&pix3);
pixSetResolution(pix1, 300, 300);
pixGetDimensions(pix1, &w, &h, NULL);
pix2 = pixGenerateHalftoneMask(pix1, NULL, NULL, NULL);
@@ -77,41 +83,41 @@ L_REGPARAMS *rp;

/* 1 bpp input */
convertToPdfSegmented("rabi.png", 300, L_G4_ENCODE, 128, boxa1,
- 0, 0.25, NULL, "/tmp/lept/pdf/file00.pdf");
+ 0, 0.25, NULL, "/tmp/lept/pdf2/file00.pdf");
convertToPdfSegmented("rabi.png", 300, L_JPEG_ENCODE, 128, boxa1,
- 0, 0.25, NULL, "/tmp/lept/pdf/file01.pdf");
+ 0, 0.25, NULL, "/tmp/lept/pdf2/file01.pdf");
convertToPdfSegmented("rabi.png", 300, L_FLATE_ENCODE, 128, boxa1,
- 0, 0.25, NULL, "/tmp/lept/pdf/file02.pdf");
+ 0, 0.25, NULL, "/tmp/lept/pdf2/file02.pdf");

/* 8 bpp input, no cmap */
- convertToPdfSegmented("/tmp/lept/pdf/rabi8.jpg", 150, L_G4_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file03.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/rabi8.jpg", 150, L_JPEG_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file04.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/rabi8.jpg", 150, L_FLATE_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file05.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi8.jpg", 150, L_G4_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file03.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi8.jpg", 150, L_JPEG_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file04.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi8.jpg", 150, L_FLATE_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file05.pdf");

/* 4 bpp input, cmap */
- convertToPdfSegmented("/tmp/lept/pdf/rabi4.png", 150, L_G4_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file06.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/rabi4.png", 150, L_JPEG_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file07.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/rabi4.png", 150, L_FLATE_ENCODE, 128,
- boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file08.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_G4_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file06.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_JPEG_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file07.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_FLATE_ENCODE, 128,
+ boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file08.pdf");

/* 4 bpp input, cmap, data output */
data = NULL;
- convertToPdfDataSegmented("/tmp/lept/pdf/rabi4.png", 150, L_G4_ENCODE,
+ convertToPdfDataSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_G4_ENCODE,
128, boxa2, 0, 0.5, NULL, &data, &nbytes);
- l_binaryWrite("/tmp/lept/pdf/file09.pdf", "w", data, nbytes);
+ l_binaryWrite("/tmp/lept/pdf2/file09.pdf", "w", data, nbytes);
lept_free(data);
- convertToPdfDataSegmented("/tmp/lept/pdf/rabi4.png", 150, L_JPEG_ENCODE,
+ convertToPdfDataSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_JPEG_ENCODE,
128, boxa2, 0, 0.5, NULL, &data, &nbytes);
- l_binaryWrite("/tmp/lept/pdf/file10.pdf", "w", data, nbytes);
+ l_binaryWrite("/tmp/lept/pdf2/file10.pdf", "w", data, nbytes);
lept_free(data);
- convertToPdfDataSegmented("/tmp/lept/pdf/rabi4.png", 150, L_FLATE_ENCODE,
+ convertToPdfDataSegmented("/tmp/lept/pdf2/rabi4.png", 150, L_FLATE_ENCODE,
128, boxa2, 0, 0.5, NULL, &data, &nbytes);
- l_binaryWrite("/tmp/lept/pdf/file11.pdf", "w", data, nbytes);
+ l_binaryWrite("/tmp/lept/pdf2/file11.pdf", "w", data, nbytes);
lept_free(data);
fprintf(stderr, "Segmented images time: %7.3f\n", stopTimer());

@@ -125,17 +131,17 @@ L_REGPARAMS *rp;

pix1 = pixRead("candelabrum.011.jpg");
pix2 = pixScale(pix1, 3.0, 3.0);
- pixWrite("/tmp/lept/pdf/candelabrum3.jpg", pix2, IFF_JFIF_JPEG);
- GetImageMask(pix2, 200, &boxa1, rp, "/tmp/lept/pdf/seg1.jpg");
- convertToPdfSegmented("/tmp/lept/pdf/candelabrum3.jpg", 200, L_G4_ENCODE,
+ pixWrite("/tmp/lept/pdf2/candelabrum3.jpg", pix2, IFF_JFIF_JPEG);
+ GetImageMask(pix2, 200, &boxa1, rp, "/tmp/lept/pdf2/seg1.jpg");
+ convertToPdfSegmented("/tmp/lept/pdf2/candelabrum3.jpg", 200, L_G4_ENCODE,
100, boxa1, 0, 0.25, NULL,
- "/tmp/lept/pdf/file12.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/candelabrum3.jpg", 200, L_JPEG_ENCODE,
+ "/tmp/lept/pdf2/file12.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/candelabrum3.jpg", 200, L_JPEG_ENCODE,
100, boxa1, 0, 0.25, NULL,
- "/tmp/lept/pdf/file13.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/candelabrum3.jpg", 200, L_FLATE_ENCODE,
+ "/tmp/lept/pdf2/file13.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/candelabrum3.jpg", 200, L_FLATE_ENCODE,
100, boxa1, 0, 0.25, NULL,
- "/tmp/lept/pdf/file14.pdf");
+ "/tmp/lept/pdf2/file14.pdf");

pixDestroy(&pix1);
pixDestroy(&pix2);
@@ -143,25 +149,25 @@ L_REGPARAMS *rp;

pix1 = pixRead("lion-page.00016.jpg");
pix2 = pixScale(pix1, 3.0, 3.0);
- pixWrite("/tmp/lept/pdf/lion16.jpg", pix2, IFF_JFIF_JPEG);
+ pixWrite("/tmp/lept/pdf2/lion16.jpg", pix2, IFF_JFIF_JPEG);
pix3 = pixRead("lion-mask.00016.tif");
boxa1 = pixConnComp(pix3, NULL, 8);
boxa2 = boxaTransform(boxa1, 0, 0, 3.0, 3.0);
- convertToPdfSegmented("/tmp/lept/pdf/lion16.jpg", 200, L_G4_ENCODE,
- 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file15.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/lion16.jpg", 200, L_JPEG_ENCODE,
- 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file16.pdf");
- convertToPdfSegmented("/tmp/lept/pdf/lion16.jpg", 200, L_FLATE_ENCODE,
- 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file17.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/lion16.jpg", 200, L_G4_ENCODE,
+ 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file15.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/lion16.jpg", 200, L_JPEG_ENCODE,
+ 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file16.pdf");
+ convertToPdfSegmented("/tmp/lept/pdf2/lion16.jpg", 200, L_FLATE_ENCODE,
+ 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file17.pdf");

/* Quantize the non-image part and flate encode.
* This is useful because it results in a smaller file than
* when you flate-encode the un-quantized non-image regions. */
pix4 = pixScale(pix3, 3.0, 3.0); /* higher res mask, for combining */
pix5 = QuantizeNonImageRegion(pix2, pix4, 12);
- pixWrite("/tmp/lept/pdf/lion16-quant.png", pix5, IFF_PNG);
- convertToPdfSegmented("/tmp/lept/pdf/lion16-quant.png", 200, L_FLATE_ENCODE,
- 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf/file18.pdf");
+ pixWrite("/tmp/lept/pdf2/lion16-quant.png", pix5, IFF_PNG);
+ convertToPdfSegmented("/tmp/lept/pdf2/lion16-quant.png", 200, L_FLATE_ENCODE,
+ 190, boxa2, 0, 0.5, NULL, "/tmp/lept/pdf2/file18.pdf");
fprintf(stderr, "Color segmented images time: %7.3f\n", stopTimer());

pixDestroy(&pix1);
@@ -197,8 +203,8 @@ L_REGPARAMS *rp;

startTimer();
convertFilesToPdf("/tmp/lept/image", "file", 100, 0.8, 0, 75, "4 file test",
- "/tmp/lept/pdf/file19.pdf");
- fprintf(stderr, "4-page pdf generated: /tmp/lept/pdf/file19.pdf\n"
+ "/tmp/lept/pdf2/file19.pdf");
+ fprintf(stderr, "4-page pdf generated: /tmp/lept/pdf2/file19.pdf\n"
"Multi-page gen time: %7.3f\n", stopTimer());
pixDestroy(&pix1);
pixDestroy(&pix2);
@@ -208,26 +214,26 @@ L_REGPARAMS *rp;
pixDestroy(&pix6);
#endif

- regTestCheckFile(rp, "/tmp/lept/pdf/file00.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file01.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file02.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file03.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file04.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file05.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file06.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file07.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file08.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file09.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file10.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file11.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file12.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file13.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file14.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file15.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file16.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file17.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file18.pdf");
- regTestCheckFile(rp, "/tmp/lept/pdf/file19.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file00.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file01.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file02.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file03.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file04.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file05.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file06.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file07.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file08.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file09.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file10.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file11.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file12.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file13.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file14.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file15.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file16.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file17.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file18.pdf");
+ regTestCheckFile(rp, "/tmp/lept/pdf2/file19.pdf");

#if 1
/* ------------------ Test multipage pdf generation ----------------- */
@@ -235,9 +241,9 @@ L_REGPARAMS *rp;

/* Generate a multi-page pdf from all these files */
startTimer();
- concatenatePdf("/tmp/lept/pdf", "file", "/tmp/lept/pdf/cat_lept.pdf");
+ concatenatePdf("/tmp/lept/pdf2", "file", "/tmp/lept/pdf2/cat_lept.pdf");
fprintf(stderr,
- "All files have been concatenated: /tmp/lept/pdf/cat_lept.pdf\n"
+ "All files have been concatenated: /tmp/lept/pdf2/cat_lept.pdf\n"
"Concatenation time: %7.3f\n", stopTimer());
#endif

@@ -249,7 +255,7 @@ L_REGPARAMS *rp;
lept_mkdir("lept/good");
lept_cp("testfile1.pdf", "lept/good", NULL, NULL);
lept_cp("testfile2.pdf", "lept/good", NULL, NULL);
- concatenatePdf("/tmp/lept/good", "file", "/tmp/lept/pdf/good.pdf");
+ concatenatePdf("/tmp/lept/good", "file", "/tmp/lept/pdf2/good.pdf");

/* Make a bad version with the pdf id removed, so that it is not
* recognized as a pdf */
@@ -273,8 +279,8 @@ L_REGPARAMS *rp;
fprintf(stderr, "\nWe attempt to build from a bad directory\n");
fprintf(stderr, "The next 3 error messages are intentional\n");
lept_cp("testfile1.pdf", "lept/bad", NULL, NULL);
- concatenatePdf("/tmp/lept/bad", "file", "/tmp/lept/pdf/bad.pdf");
- filesAreIdentical("/tmp/lept/pdf/good.pdf", "/tmp/lept/pdf/bad.pdf", &same);
+ concatenatePdf("/tmp/lept/bad", "file", "/tmp/lept/pdf2/bad.pdf");
+ filesAreIdentical("/tmp/lept/pdf/good.pdf", "/tmp/lept/pdf2/bad.pdf", &same);
if (same)
fprintf(stderr, "Fixed: files are the same\n"
"Attempt succeeded\n");
@@ -290,8 +296,8 @@ L_REGPARAMS *rp;
l_int32 ret;

fprintf(stderr, "\n*** pdftk writes multipage pdfs from images\n");
- tempfile1 = genPathname("/tmp/lept/pdf", "file*.pdf");
- tempfile2 = genPathname("/tmp/lept/pdf", "cat_pdftk.pdf");
+ tempfile1 = genPathname("/tmp/lept/pdf2", "file*.pdf");
+ tempfile2 = genPathname("/tmp/lept/pdf2", "cat_pdftk.pdf");
snprintf(buffer, sizeof(buffer), "pdftk %s output %s",
tempfile1, tempfile2);
ret = system(buffer); /* pdftk */
diff --git a/prog/webpanimio_reg.c b/prog/webpanimio_reg.c
index 8f61aab..3938e16 100644
--- a/prog/webpanimio_reg.c
+++ b/prog/webpanimio_reg.c
@@ -75,8 +75,8 @@ L_REGPARAMS *rp;
return 0;
#endif /* abort */

- lept_rmdir("lept/webp");
- lept_mkdir("lept/webp");
+ lept_rmdir("lept/webpanim");
+ lept_mkdir("lept/webpanim");

niters = 5;
duration = 250; /* ms */
@@ -85,9 +85,9 @@ L_REGPARAMS *rp;
pixa = pixaCreate(6);
pixaAddPix(pixa, pix1, L_COPY);
pixaAddPix(pixa, pix2, L_COPY);
- pixaWriteWebPAnim("/tmp/lept/webp/margeanim.webp", pixa, niters,
+ pixaWriteWebPAnim("/tmp/lept/webpanim/margeanim.webp", pixa, niters,
duration, 80, 0);
- regTestCheckFile(rp, "/tmp/lept/webp/margeanim.webp");
+ regTestCheckFile(rp, "/tmp/lept/webpanim/margeanim.webp");
pixaDestroy(&pixa);
pixDestroy(&pix1);
pixDestroy(&pix2);
diff --git a/prog/reg_wrapper.sh b/prog/reg_wrapper.sh
index 94a6fa3..804954c 100755
--- a/prog/reg_wrapper.sh
+++ b/prog/reg_wrapper.sh
@@ -31,7 +31,7 @@ TEST_NAME="${TEST##*/}"
TEST_NAME="${TEST_NAME%_reg*}"

case "${TEST_NAME}" in
- baseline|boxa[1234]|colormask|colorspace|dna|enhance|extrema|fpix1|italic|kernel|nearline|numa[12]|projection|rankbin|rankhisto|wordboxes)
+ baseline|boxa[1234]|colormask|colorspace|dna|enhance|extrema|fpix1|italic|kernel|nearline|numa[12]|pixa1|projection|rankbin|rankhisto|wordboxes)
GNUPLOT=$(which gnuplot || which wgnuplot)

if [ -z "${GNUPLOT}" ] || ! "${GNUPLOT}" -e "set terminal png" 2>/dev/null ; then
--
2.25.1
77 changes: 77 additions & 0 deletions media-libs/leptonica/leptonica-1.79.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit libtool multilib-minimal

DESCRIPTION="C library for image processing and analysis"
HOMEPAGE="http://www.leptonica.org/"
SRC_URI="https://github.com/DanBloomberg/${PN}/releases/download/${PV}/${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0/5"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos"
IUSE="gif jpeg jpeg2k png static-libs test tiff utils webp zlib"
RESTRICT="!test? ( test )"

# N.B. Tests need some features enabled:
REQUIRED_USE="test? ( jpeg png tiff zlib )"

RDEPEND="gif? ( >=media-libs/giflib-5.1.3:=[${MULTILIB_USEDEP}] )
jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}]
sys-libs/zlib:=[${MULTILIB_USEDEP}] )
tiff? ( media-libs/tiff:0=[${MULTILIB_USEDEP}] )
webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
zlib? ( sys-libs/zlib:=[${MULTILIB_USEDEP}] )"

DEPEND="${RDEPEND}
test? ( media-libs/tiff:0[zlib] )"

PATCHES=(
"${FILESDIR}"/${PV}-tests.patch
)

ECONF_SOURCE="${S}"
DOCS=( README version-notes )

src_prepare() {
default
elibtoolize

# unhtmlize docs
local X
for X in ${DOCS[@]}; do
awk '/<\/pre>/{s--} {if (s) print $0} /<pre>/{s++}' \
"${X}.html" > "${X}" || die 'awk failed'
rm -f -- "${X}.html"
done
}

multilib_src_configure() {
econf \
--enable-shared \
$(use_with gif giflib) \
$(use_with jpeg) \
$(use_with jpeg2k libopenjpeg) \
$(use_with png libpng) \
$(use_with tiff libtiff) \
$(use_with webp libwebp) \
$(use_with zlib) \
$(use_enable static-libs static) \
$(multilib_native_use_enable utils programs)
}

multilib_src_test() {
default

# ${TMPDIR} is not respected. It used to be but it lead to issues
# and there have been long debates with upstream about it. :(
rm -rf /tmp/lept/ || die
}

multilib_src_install_all() {
# libtool archives covered by pkg-config.
find "${D}" -name "*.la" -delete || die
}

0 comments on commit 0f291ef

Please sign in to comment.