Skip to content

Commit

Permalink
Merge pull request #165 from tpimh/leptonica
Browse files Browse the repository at this point in the history
Patch leptonica for missing realpath and getrusage
  • Loading branch information
diamant3 authored Jun 12, 2024
2 parents 9ef7f29 + 94261b1 commit c541e2a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
18 changes: 15 additions & 3 deletions leptonica/PSPBUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
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/"
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
Expand Down
41 changes: 41 additions & 0 deletions leptonica/leptonica-1.84.1-PSP.patch
Original file line number Diff line number Diff line change
@@ -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 <sys/time.h>
#include <sys/resource.h>
@@ -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

0 comments on commit c541e2a

Please sign in to comment.