From 94261b167564e1239090a43950698e4c78acc338 Mon Sep 17 00:00:00 2001 From: Dima Pulkinen Date: Wed, 12 Jun 2024 12:40:44 +0300 Subject: [PATCH] patch leptonica for missing realpath and getrusage --- leptonica/PSPBUILD | 18 ++++++++++-- leptonica/leptonica-1.84.1-PSP.patch | 41 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 leptonica/leptonica-1.84.1-PSP.patch diff --git a/leptonica/PSPBUILD b/leptonica/PSPBUILD index 88906d1..54096dd 100644 --- a/leptonica/PSPBUILD +++ b/leptonica/PSPBUILD @@ -1,6 +1,6 @@ pkgname=leptonica pkgver=1.84.1 -pkgrel=1 +pkgrel=2 pkgdesc="An open source C library for efficient image processing and image analysis operations" arch=('mips') url="http://www.leptonica.org/" @@ -8,11 +8,23 @@ license=('BSD-2-Clause') depends=('zlib' 'libpng' 'jpeg') makedepends=() optdepends=() -source=("https://github.com/DanBloomberg/leptonica/releases/download/${pkgver}/$pkgname-${pkgver}.tar.gz") -sha256sums=("2b3e1254b1cca381e77c819b59ca99774ff43530209b9aeb511e1d46588a64f6") +source=( + "https://github.com/DanBloomberg/leptonica/releases/download/${pkgver}/$pkgname-${pkgver}.tar.gz" + "https://github.com/pspdev/newlib/raw/master/newlib/libc/sys/phoenix/realpath.c" + "${pkgname}-${pkgver}-PSP.patch" +) +sha256sums=( + "2b3e1254b1cca381e77c819b59ca99774ff43530209b9aeb511e1d46588a64f6" + "fcc13a98886eb6e2fdbff6a04aa4fdcf3a6c6b6dff8c019a9698303e06722661" + "SKIP" +) prepare() { cd "$pkgname-${pkgver}" + + mv ../realpath.c src + patch -p1 < ../${pkgname}-${pkgver}-PSP.patch + sed -i 's#@prefix@#${PSPDEV}/psp#' lept.pc.in sed -i 's#@exec_prefix@#${prefix}#' lept.pc.in sed -i 's#@libdir@#${prefix}/lib#' lept.pc.in diff --git a/leptonica/leptonica-1.84.1-PSP.patch b/leptonica/leptonica-1.84.1-PSP.patch new file mode 100644 index 0000000..186d4b9 --- /dev/null +++ b/leptonica/leptonica-1.84.1-PSP.patch @@ -0,0 +1,41 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 8997c63..5a4b030 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -1,4 +1,4 @@ +-AM_CPPFLAGS = $(ZLIB_CFLAGS) $(LIBPNG_CFLAGS) $(JPEG_CFLAGS) $(LIBTIFF_CFLAGS) $(LIBWEBP_CFLAGS) $(LIBWEBPMUX_CFLAGS) $(LIBJP2K_CFLAGS) ++AM_CPPFLAGS = $(ZLIB_CFLAGS) $(LIBPNG_CFLAGS) $(JPEG_CFLAGS) $(LIBTIFF_CFLAGS) $(LIBWEBP_CFLAGS) $(LIBWEBPMUX_CFLAGS) $(LIBJP2K_CFLAGS) -DPATH_MAX_SIZE=1024 + + lib_LTLIBRARIES = libleptonica.la + libleptonica_la_LIBADD = $(LIBPNG_LIBS) $(JPEG_LIBS) $(GIFLIB_LIBS) $(LIBTIFF_LIBS) $(LIBWEBP_LIBS) $(LIBWEBPMUX_LIBS) $(LIBJP2K_LIBS) $(GDI_LIBS) $(LIBM) $(ZLIB_LIBS) +@@ -63,7 +63,7 @@ libleptonica_la_SOURCES = adaptmap.c affine.c \ + tiffio.c tiffiostub.c \ + utils1.c utils2.c warper.c watershed.c \ + webpio.c webpiostub.c webpanimio.c webpanimiostub.c \ +- writefile.c zlibmem.c zlibmemstub.c ++ writefile.c zlibmem.c zlibmemstub.c realpath.c + + pkginclude_HEADERS = allheaders.h alltypes.h \ + array.h array_internal.h \ +diff --git a/src/utils1.c b/src/utils1.c +index b8dedd5..c5ec75a 100644 +--- a/src/utils1.c ++++ b/src/utils1.c +@@ -1104,7 +1104,7 @@ size_t bufsize = 100; + /*---------------------------------------------------------------------* + * Timing procs * + *---------------------------------------------------------------------*/ +-#if !defined(_WIN32) && !defined(__Fuchsia__) ++#if !defined(_WIN32) && !defined(__Fuchsia__) && !defined(PSP) + + #include + #include +@@ -1198,7 +1198,7 @@ struct timeval tv; + if (usec) *usec = (l_int32)tv.tv_usec; + } + +-#elif defined(__Fuchsia__) /* resource.h not implemented on Fuchsia. */ ++#elif defined(__Fuchsia__) || defined(PSP) /* resource.h not implemented on Fuchsia. */ + + /* Timer functions are used for testing and debugging, and + * are stubbed out. If they are needed in the future, they