# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= mupdf VERSION= 1.24.1 KEYWORDS= graphics VARIANTS= standard SDESC[standard]= Lightweight PDF and XPS viewer HOMEPAGE= https://mupdf.com/ CONTACT= nobody DOWNLOAD_GROUPS= main SITES[main]= https://mupdf.com/downloads/archive/ https://mupdf.com/downloads/ DISTFILE[1]= mupdf-1.24.1-source.tar.gz:main DF_INDEX= 1 SPKGS[standard]= complete primary tools dev man docs examples OPTIONS_AVAILABLE= none OPTIONS_STANDARD= none BUILD_DEPENDS= harfbuzz:dev:standard gumbo:dev:standard freeglut:dev:standard openjpeg:dev:standard BUILDRUN_DEPENDS= harfbuzz:primary:standard openjpeg:primary:standard jbig2dec:single:standard freeglut:primary:standard gumbo:primary:standard EXRUN[tools]= mupdf:primary:standard USES= cpe gmake pkgconfig zlib:build curl freetype XORG_COMPONENTS= x11 xcursor xext xinerama xrandr DISTNAME= mupdf-1.24.1-source LICENSE= AGPLv3+:primary LICENSE_TERMS= primary:{{WRKDIR}}/TERMS LICENSE_FILE= AGPLv3+:{{WRKSRC}}/COPYING LICENSE_SCHEME= solo CPE_VENDOR= artifex FPC_EQUIVALENT= graphics/mupdf MAKE_ARGS= build=release prefix={{PREFIX}} mandir={{MANPREFIX}}/man verbose=yes SOVERSION=1.24.1 SOVERSION= 1.24.1 CFLAGS= `pkg-config --cflags libopenjp2` -I{{WRKSRC}}/include/mupdf -I{{LOCALBASE}}/include/freetype2 -I{{LOCALBASE}}/include/harfbuzz VAR_ARCH[x86_64]= CFLAGS=-fPIC post-install: ${MV} ${STAGEDIR}${PREFIX}/bin/mupdf-x11 ${STAGEDIR}${PREFIX}/bin/mupdf ${INSTALL_PROGRAM} ${WRKSRC}/build/release/muraster \ ${STAGEDIR}${PREFIX}/bin ${LN} -s libmupdf.so.1.24.1 \ ${STAGEDIR}${PREFIX}/lib/libmupdf.so ${LN} -s libmupdfthird.so.1.24.1 \ ${STAGEDIR}${PREFIX}/lib/libmupdfthird.so ${MKDIR ${STAGEDIR}${PREFIX}/share/examples ${MV} ${STAGEDIR}${PREFIX}/share/doc/mupdf/examples \ ${STAGEDIR}${STD_EXAMPLESDIR} ${RM} ${STAGEDIR}${STD_DOCDIR}/COPYING pre-configure: ${REINPLACE_CMD} -e "s|%%OPSYS%%|${OPSYS}|; s/-pipe -O2 //" \ ${WRKSRC}/Makerules post-extract: ${RM} -r ${WRKSRC}/thirdparty/curl \ ${WRKSRC}/thirdparty/freetype \ ${WRKSRC}/thirdparty/freeglut \ ${WRKSRC}/thirdparty/harfbuzz \ ${WRKSRC}/thirdparty/jbig2dec \ ${WRKSRC}/thirdparty/openjpeg \ ${WRKSRC}/thirdparty/zlib ${AWK} '/^LICENSE/,/^REPORTING/' ${WRKSRC}/README > ${WRKDIR}/TERMS post-patch-sunos: ${REINPLACE_CMD} -e '/define _XOPEN_SOURCE/d' \ ${WRKSRC}/platform/x11/x11_image.c [FILE:828:descriptions/desc.primary] MuPDF is a lightweight PDF viewer and toolkit written in portable C. The renderer in MuPDF is tailored for high quality anti-aliased graphics. It renders text with metrics and spacing accurate to within fractions of a pixel for the highest fidelity in reproducing the look of a printed page on screen. MuPDF has a small footprint. A binary that includes the standard Roman fonts is only one megabyte. A build with full CJK support (including an Asian font) is approximately five megabytes. MuPDF has support for all non-interactive PDF 1.7 features, and the toolkit provides a simple API for accessing the internal structures of the PDF document. Example code for navigating interactive links and bookmarks, encrypting PDF files, extracting fonts, images, and searchable text, and rendering pages to image files is provided. [FILE:35:descriptions/desc.tools] This package contains MuPDF tools. [FILE:105:distinfo] 5840308280a2be7bd55f5e8a0b5a3ab8839689fa389a48a91433dcabd465be4d 55310618 mupdf-1.24.1-source.tar.gz [FILE:64:manifests/plist.primary] lib/ libmupdf.so.%%SOVERSION%% libmupdfthird.so.%%SOVERSION%% [FILE:56:manifests/plist.tools] bin/ mupdf mupdf-gl mupdf-x11-curl muraster mutool [FILE:878:manifests/plist.dev] include/mupdf/ fitz.h html.h memento.h pdf.h ucdn.h include/mupdf/fitz/ archive.h band-writer.h bidi.h bitmap.h buffer.h color.h compress.h compressed-buffer.h config.h context.h crypt.h device.h display-list.h document.h export.h filter.h font.h geometry.h getopt.h glyph-cache.h glyph.h hash.h heap-imp.h heap.h image.h link.h log.h outline.h output-svg.h output.h path.h pixmap.h pool.h separation.h shade.h store.h story-writer.h story.h stream.h string-util.h structured-text.h system.h text.h track-usage.h transition.h tree.h types.h util.h version.h write-pixmap.h writer.h xml.h include/mupdf/pdf/ annot.h clean.h cmap.h crypt.h document.h event.h font.h form.h image-rewriter.h interpret.h javascript.h name-table.h object.h page.h parse.h resource.h xref.h lib/ libmupdf.so libmupdfthird.so [FILE:41:manifests/plist.man] share/man/man1/ mupdf.1.gz mutool.1.gz [FILE:34:manifests/plist.docs] share/doc/mupdf/ CHANGES README [FILE:425:manifests/plist.examples] share/examples/mupdf/ SnarkFront.svg bbox-device.js copy-outline.js create-thumbnail.js draw-device.js draw-document.js example.c fix-s22pdf.js huntingofthesnark.png import-fdf.js jpx-to-pdf.js multi-threaded.c pdf-bake.js pdf-create-lowlevel.js pdf-create.js pdf-dejpx.js pdf-extract-rich-media.js pdf-merge.js pdf-portfolio.js pdf-trace.js reconvert-cmyk.js storytest.c storytest.js trace-device.js [FILE:772:patches/patch-Makefile] --- Makefile.orig 2024-04-02 11:10:54 UTC +++ Makefile @@ -313,9 +313,9 @@ $(THIRD_GLUT_LIB) : $(THIRD_GLUT_OBJ) $(THREAD_LIB) : $(THREAD_OBJ) $(PKCS7_LIB) : $(PKCS7_OBJ) else -MUPDF_LIB = $(OUT)/libmupdf.a +MUPDF_LIB = libmupdf.so.$(SOVERSION) +THIRD_LIB = libmupdfthird.so.$(SOVERSION) LIBS_TO_INSTALL_IN_LIB = $(MUPDF_LIB) $(THIRD_LIB) -THIRD_LIB = $(OUT)/libmupdf-third.a ifneq ($(USE_SYSTEM_GLUT),yes) THIRD_GLUT_LIB = $(OUT)/libmupdf-glut.a endif @@ -330,7 +330,11 @@ $(PKCS7_LIB) : $(PKCS7_OBJ) endif $(MUPDF_LIB) : $(MUPDF_OBJ) + $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname=$@ -o $@ $^ $(LIBS) + $(THIRD_LIB) : $(THIRD_OBJ) + $(CC) $(LDFLAGS) -fPIC -shared -Wl,-soname=$@ -o $@ $^ $(LIBS) + $(THREAD_LIB) : $(THREAD_OBJ) $(PKCS7_LIB) : $(PKCS7_OBJ) [FILE:728:patches/patch-Makerules] --- Makerules.orig 2024-04-02 11:10:54 UTC +++ Makerules @@ -171,7 +171,7 @@ ifneq "$(CLUSTER)" "" CFLAGS += -DCLUSTER endif -ifeq ($(OS),Linux) +ifeq ($(OS),%%OPSYS%%) LINUX_OR_OPENBSD := yes endif ifeq ($(OS),OpenBSD) @@ -206,7 +206,7 @@ else ifeq ($(OS),MACOS) else ifeq ($(LINUX_OR_OPENBSD),yes) - ifeq ($(OS),Linux) + ifeq ($(OS),%%OPSYS%%) HAVE_OBJCOPY := yes endif @@ -281,7 +281,7 @@ else ifeq ($(LINUX_OR_OPENBSD),yes) endif ifeq ($(HAVE_LIBCRYPTO),) - HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes) + HAVE_LIBCRYPTO := no endif ifeq ($(HAVE_LIBCRYPTO),yes) LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO [FILE:546:patches/patch-Makethird] --- Makethird.orig 2024-04-02 11:10:54 UTC +++ Makethird @@ -1,5 +1,6 @@ # GNU Makefile for third party libraries used by MuPDF +USE_SYSTEM_LIBS := yes ifeq ($(USE_SYSTEM_LIBS),yes) USE_SYSTEM_FREETYPE := yes USE_SYSTEM_GUMBO := yes @@ -7,7 +8,6 @@ ifeq ($(USE_SYSTEM_LIBS),yes) USE_SYSTEM_JBIG2DEC := yes USE_SYSTEM_JPEGXR := no # not available USE_SYSTEM_LCMS2 := no # lcms2mt is strongly preferred - USE_SYSTEM_LIBJPEG := yes USE_SYSTEM_MUJS := no # not available USE_SYSTEM_OPENJPEG := yes USE_SYSTEM_ZLIB := yes [FILE:2566:patches/patch-source_fitz_crypt-sha2.c] $NetBSD: patch-ae,v 1.5 2016/02/04 11:50:24 leot Exp $ Avoid namespace conflicts with bswap(3). --- source/fitz/crypt-sha2.c.orig 2024-04-02 11:10:54 UTC +++ source/fitz/crypt-sha2.c @@ -19,7 +19,7 @@ static inline int isbigendian(void) return *(char*)&one == 0; } -static inline unsigned int bswap32(unsigned int num) +static inline unsigned int mup_bswap32(unsigned int num) { return ( (((num) << 24)) | (((num) << 8) & 0x00FF0000) @@ -27,7 +27,7 @@ static inline unsigned int bswap32(unsig | (((num) >> 24)) ); } -static inline uint64_t bswap64(uint64_t num) +static inline uint64_t mup_bswap64(uint64_t num) { return ( (((num) << 56)) | (((num) << 40) & 0x00FF000000000000ULL) @@ -101,7 +101,7 @@ transform256(unsigned int state[8], unsi /* ensure big-endian integers */ if (!isbigendian()) for (j = 0; j < 16; j++) - data[j] = bswap32(data[j]); + data[j] = mup_bswap32(data[j]); /* Copy state[] to working vars. */ memcpy(T, state, sizeof(T)); @@ -194,8 +194,8 @@ void fz_sha256_final(fz_sha256 *context, if (!isbigendian()) { - context->buffer.u32[14] = bswap32(context->count[1]); - context->buffer.u32[15] = bswap32(context->count[0]); + context->buffer.u32[14] = mup_bswap32(context->count[1]); + context->buffer.u32[15] = mup_bswap32(context->count[0]); } else { @@ -206,7 +206,7 @@ void fz_sha256_final(fz_sha256 *context, if (!isbigendian()) for (j = 0; j < 8; j++) - context->state[j] = bswap32(context->state[j]); + context->state[j] = mup_bswap32(context->state[j]); memcpy(digest, &context->state[0], 32); memset(context, 0, sizeof(fz_sha256)); @@ -273,7 +273,7 @@ transform512(uint64_t state[8], uint64_t /* ensure big-endian integers */ if (!isbigendian()) for (j = 0; j < 16; j++) - data[j] = bswap64(data[j]); + data[j] = mup_bswap64(data[j]); /* Copy state[] to working vars. */ memcpy(T, state, sizeof(T)); @@ -366,8 +366,8 @@ void fz_sha512_final(fz_sha512 *context, if (!isbigendian()) { - context->buffer.u64[14] = bswap64(context->count[1]); - context->buffer.u64[15] = bswap64(context->count[0]); + context->buffer.u64[14] = mup_bswap64(context->count[1]); + context->buffer.u64[15] = mup_bswap64(context->count[0]); } else { @@ -378,7 +378,7 @@ void fz_sha512_final(fz_sha512 *context, if (!isbigendian()) for (j = 0; j < 8; j++) - context->state[j] = bswap64(context->state[j]); + context->state[j] = mup_bswap64(context->state[j]); memcpy(digest, &context->state[0], 64); memset(context, 0, sizeof(fz_sha512)); [FILE:1594:patches/patch-source_fitz_load-jpx.c] $NetBSD: patch-source_fitz_load-jpx.c,v 1.10 2020/05/07 20:42:57 leot Exp $ - MuPDF does some locking around its allocation calls; it overrides openjpeg's allocators to do this locking too. However mupdf tries to manually align things in a way that doesn't match what openjpeg does, which we noticed when frees were segfaulting because the addresses didn't match up. In the case of the openjpeg port it's relying on malloc(3)'s guarantee "The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object" so patch mupdf to do the same. Fixes crash noticed by jca@ in https://www.broadband-forum.org/technical/download/TR-177.pdf From OpenBSD ports textproc/mupdf/patch-source_fitz_load-jpx_c,v 1.5. --- source/fitz/load-jpx.c.orig 2024-04-02 11:10:54 UTC +++ source/fitz/load-jpx.c @@ -163,19 +163,7 @@ void opj_free(void *ptr) static void * opj_aligned_malloc_n(size_t alignment, size_t size) { - uint8_t *ptr; - size_t off; - - if (size == 0) - return NULL; - - size += alignment + sizeof(uint8_t); - ptr = opj_malloc(size); - if (ptr == NULL) - return NULL; - off = alignment-(((int)(intptr_t)ptr) & (alignment - 1)); - ptr[off-1] = (uint8_t)off; - return ptr + off; + return opj_malloc(size); } void * opj_aligned_malloc(size_t size) @@ -190,13 +178,7 @@ void * opj_aligned_32_malloc(size_t size void opj_aligned_free(void* ptr_) { - uint8_t *ptr = (uint8_t *)ptr_; - uint8_t off; - if (ptr == NULL) - return; - - off = ptr[-1]; - opj_free((void *)(((unsigned char *)ptr) - off)); + opj_free(ptr_); } #if 0