#!/bin/sh # Build script for mupdf 1.28.0 (plain uname-keyed GNU Makefile, bundled # thirdparty). NOT Template A/B - mupdf ships its own Makerules that # selects behavior off `$(OS)` (defaulting to `uname`, which reports # "Hammerhead" - matches none of mupdf's Darwin/Linux/OpenBSD/wasm arms), # so force OS=Linux explicitly to pick up the Linux-shaped defaults # (HAVE_OBJCOPY, LIB_LDFLAGS -shared -Wl,-soname, etc.) which line up with # our GNU-ld/binutils toolchain. # # Use the BUNDLED thirdparty/ (freetype, harfbuzz, jbig2dec, openjpeg, # mujs, zlib-alt) rather than USE_SYSTEM_LIBS=yes - avoids a large, # fragile dependency reconciliation against our own freetype/harfbuzz # ports for a single consumer. Only the X11 viewer libs (libX11/libXext/ # libXrandr/libXcursor) come from the system via pkg-config. # # Old (pre-2015-idiom-heavy in thirdparty/) C - GCC 14 promotes implicit- # decl/incompatible-pointer-type/int-conversion to hard errors by default; # -fpermissive demotes them back to warnings, -fcommon undoes GCC10+'s # -fno-common default (tentative-definition multiple-definition errors). set -e PORTDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) cd "$SRCDIR" for p in "$PORTDIR"/patches/*.patch; do [ -f "$p" ] || continue echo "==> Applying patch: $(basename "$p")" patch -p1 < "$p" done export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH" # Build only first (no install target) - DESTDIR must be a make ARG on the # install step, never exported/used on a plain build, and never omitted - # an install-apps run without DESTDIR would write straight into the live # $PREFIX on the build host. gmake -j${JOBS:-1} \ OS=Linux \ build=release \ HAVE_X11=yes \ HAVE_GLUT=no \ HAVE_OBJCOPY=yes \ prefix="$PREFIX" \ XCFLAGS="-fpermissive -fcommon -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS" \ apps libs # install-apps installs mutool + the view apps (incl. mupdf-x11); # install-libs additionally ships libmupdf + headers for any future consumer. gmake \ OS=Linux \ build=release \ HAVE_X11=yes \ HAVE_GLUT=no \ HAVE_OBJCOPY=yes \ prefix="$PREFIX" \ DESTDIR="$PKGDIR" \ XCFLAGS="-fpermissive -fcommon -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS" \ install-apps install-libs # mupdf - lightweight PDF/XPS/EPUB viewer and library # https://mupdf.com/ [package] name = "mupdf" version = "1.28.0" release = 1 description = "Lightweight PDF/XPS/EPUB viewer and library (X11 viewer)" url = "https://mupdf.com/" license = "AGPL-3.0-or-later" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = ["libX11", "libXext", "libXrandr", "libXcursor", "zlib"] build = ["libX11", "libXext", "libXrandr", "libXcursor", "zlib"] [[source]] file = "mupdf-1.28.0-source.tar.gz" urls = ["https://mupdf.com/downloads/archive/mupdf-1.28.0-source.tar.gz"] checksum = "21c7f064903154f1c3a7458bee81f130fc36f9b5147ea13328f9980e02d2dea2" [build] parallel = true From: Chris Tusa Subject: fitz/deskew: rename index_t (clashes with illumos sys/types.h) illumos's already typedefs index_t as 'short' (an SVR4 STREAMS-era type), which conflicts with deskew.c's own struct index_t typedef (transitively included via mupdf/fitz.h -> mupdf/memento.h -> stdlib.h -> sys/wait.h -> sys/types.h). Rename mupdf's local type to fz_deskew_index_t (deskew.c/.h only - no other file in the tree uses this name) to remove the collision rather than fighting illumos's system header. diff --git a/source/fitz/deskew.c b/source/fitz/deskew.c --- a/source/fitz/deskew.c 2026-06-25 14:05:09.000000000 -0500 +++ b/source/fitz/deskew.c 2026-07-22 21:04:17.710448696 -0500 @@ -261,7 +261,7 @@ uint8_t slow; /* Flag */ int32_t first_pixel; /* offset of first value in source data */ int32_t last_pixel; /* last pixel number */ -} index_t; +} fz_deskew_index_t; #if ARCH_HAS_NEON typedef int16_t weight_t; @@ -271,7 +271,7 @@ typedef void (zoom_y_fn)(uint8_t * dst, const uint8_t * __restrict tmp, - const index_t * __restrict index, + const fz_deskew_index_t * __restrict index, const weight_t * __restrict weights, uint32_t width, uint32_t channels, @@ -279,7 +279,7 @@ int32_t y); typedef void (zoom_x_fn)(uint8_t * __restrict tmp, const uint8_t * __restrict src, - const index_t * __restrict index, + const fz_deskew_index_t * __restrict index, const weight_t * __restrict weights, uint32_t dst_w, uint32_t src_w, @@ -317,9 +317,9 @@ uint32_t dst_h_borderless; uint32_t skip_l; uint32_t skip_t; - index_t *index_x[SUB_PIX_X]; + fz_deskew_index_t *index_x[SUB_PIX_X]; weight_t *weights_x[SUB_PIX_X]; - index_t *index_y[SUB_PIX_Y]; + fz_deskew_index_t *index_y[SUB_PIX_Y]; weight_t *weights_y[SUB_PIX_Y]; uint32_t max_y_weights[SUB_PIX_Y]; uint8_t bg[FZ_MAX_COLORS]; @@ -381,7 +381,7 @@ static void make_x_weights(fz_context *ctx, - index_t **indexp, + fz_deskew_index_t **indexp, weight_t **weightsp, uint32_t src_w, uint32_t dst_w, @@ -391,7 +391,7 @@ int sse_slow) { double squeeze; - index_t *index; + fz_deskew_index_t *index; weight_t *weights; uint32_t i; double offset = ((double)offset_f)/offset_n; @@ -419,7 +419,7 @@ weights = (weight_t *)fz_malloc_aligned(ctx, sizeof(*weights) * max_weights * dst_w + SSE_SLOP, sizeof(weight_t) * 4); memset(weights, 0, sizeof(*weights) * max_weights * dst_w); fz_try(ctx) - index = (index_t *)fz_malloc(ctx, sizeof(*index) * dst_w + SSE_SLOP); + index = (fz_deskew_index_t *)fz_malloc(ctx, sizeof(*index) * dst_w + SSE_SLOP); fz_catch(ctx) { fz_free_aligned(ctx, weights); @@ -497,7 +497,7 @@ */ static void make_y_weights(fz_context *ctx, - index_t **indexp, + fz_deskew_index_t **indexp, weight_t **weightsp, uint32_t *max_weightsp, uint32_t dst_w, @@ -508,7 +508,7 @@ uint32_t h) { double squeeze; - index_t *index; + fz_deskew_index_t *index; weight_t *weights; uint32_t i; double offset = ((double)offset_f)/offset_n; @@ -538,7 +538,7 @@ weights = (weight_t *)fz_malloc_aligned(ctx, sizeof(*weights) * max_weights * dst_w, sizeof(weight_t) * 4); fz_try(ctx) - index = (index_t *)fz_malloc(ctx, sizeof(*index) * dst_w); + index = (fz_deskew_index_t *)fz_malloc(ctx, sizeof(*index) * dst_w); fz_catch(ctx) { fz_free_aligned(ctx, weights); @@ -587,7 +587,7 @@ #ifdef DEBUG_DESKEWER static void -dump_weights(const index_t *index, +dump_weights(const fz_deskew_index_t *index, const weight_t *weights, uint32_t w, const char *str) @@ -623,7 +623,7 @@ uint32_t num_w = deskewer->dst_w; weight_t *new_weights = fz_malloc_aligned(ctx, num_w * deskewer->max_y_weights[i] * sizeof(weight_t) * 4, sizeof(weight_t) * 4); - index_t *index; + fz_deskew_index_t *index; weight_t *weights; index = deskewer->index_y[i]; diff --git a/source/fitz/deskew_c.h b/source/fitz/deskew_c.h --- a/source/fitz/deskew_c.h 2026-06-25 14:05:09.000000000 -0500 +++ b/source/fitz/deskew_c.h 2026-07-22 21:04:17.710702010 -0500 @@ -25,7 +25,7 @@ static void zoom_x(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -109,7 +109,7 @@ static void zoom_x1(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -183,7 +183,7 @@ static void zoom_x3(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -280,7 +280,7 @@ static void zoom_x4(uint8_t * FZ_RESTRICT tmp, const uint8_t * FZ_RESTRICT src, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t dst_w, uint32_t src_w, @@ -388,7 +388,7 @@ static void zoom_y(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -431,7 +431,7 @@ static void zoom_y1(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -471,7 +471,7 @@ static void zoom_y3(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, @@ -520,7 +520,7 @@ static void zoom_y4(uint8_t * dst, const uint8_t * FZ_RESTRICT tmp, - const index_t * FZ_RESTRICT index, + const fz_deskew_index_t * FZ_RESTRICT index, const weight_t * FZ_RESTRICT weights, uint32_t width, uint32_t channels, --- a/source/fitz/subset-cff.c +++ b/source/fitz/subset-cff.c @@ -24,6 +24,11 @@ #include +/* illumos already typedefs index_t (SVR4 STREAMS-era + * short). Rename ours to avoid the redefinition conflict - see the + * same fix in deskew.c. */ +#define index_t mu_index_t + /* For the purposes of this code, and to save my tiny brain from overload, we will adopt the following notation: