diff --git a/app-text/mupdf/mupdf-1.7.recipe b/app-text/mupdf/mupdf-1.7.recipe new file mode 100644 index 000000000..7486ba223 --- /dev/null +++ b/app-text/mupdf/mupdf-1.7.recipe @@ -0,0 +1,104 @@ +SUMMARY="A lightweight XPS and PDF rendering library" +DESCRIPTION=" +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 is also small, fast, and yet complete. It supports PDF 1.7 with \ +transparency, encryption, hyperlinks, annotations, searching and more. It also \ +reads XPS and OpenXPS documents. MuPDF is written modularly, so features can \ +be added on by integrators if they so desire. +" +HOMEPAGE="http://www.mupdf.com" +LICENSE="AGPL-3.0" +COPYRIGHT="2006-2015 Artifex Software, Inc" +SRC_URI="http://www.mupdf.com/downloads/mupdf-$portVersion-source.tar.gz" +SOURCE_DIR="mupdf-$portVersion-source" +CHECKSUM_SHA256="d0bd5c656c464411cb5788c73d5a7c9a5b89f1e9e84e3c8c7c982ed8b90f5642" + +REVISION="1" +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + mupdf$secondaryArchSuffix = $portVersion compat >= 1.1 + lib:libmupdf$secondaryArchSuffix = $portVersion compat >= 1.1 + cmd:mudraw$secondaryArchSuffix + cmd:mujstest$secondaryArchSuffix + cmd:mutool$secondaryArchSuffix + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libfreetype$secondaryArchSuffix + lib:libjbig2dec$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix + lib:libopenjp2$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +BUILD_REQUIRES=" + devel:libfreetype$secondaryArchSuffix + devel:libjbig2dec$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix + devel:libopenjp2$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel + cmd:find + cmd:freetype_config$secondaryArchSuffix + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + " +PATCHES=" + mupdf-1.7.patchset + mupdf-1.6-openjpeg21-1.patch + " + +BUILD() +{ + # don't use builtin libs + rm -rf thirdparty + + # static lib + my_soname=libmupdf.so.$portVersion + my_soname_js_none=libmupdf-js-none.so.$portVersion + sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \ + -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \ + -e "/^MUPDF_LIB :=/s:=.*:= \$(OUT)/${my_soname}:" \ + -e "\$a\$(MUPDF_JS_NONE_LIB):" \ + -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \ + -e "/install/s: COPYING : :" \ + -i Makefile || die + make XCFLAGS=-fpic build=release $jobArgs +} + +INSTALL() +{ + make build=release install \ + prefix=$prefix \ + bindir=$binDir \ + docdir=$docDir \ + libdir=$libDir \ + incdir=$includeDir \ + mandir=$manDir + + ln -s libmupdf.so.$portVersion $libDir/libmupdf.so + + prepareInstalledDevelLibs libmupdf + + # devel package + packageEntries devel \ + $developDir +} + + +# ----- devel package ------------------------------------------------------- + +PROVIDES_devel=" + mupdf${secondaryArchSuffix}_devel = $portVersion + devel:libmupdf$secondaryArchSuffix = $portVersion compat >= 1 + " +REQUIRES_devel=" + mupdf$secondaryArchSuffix == $portVersion + " diff --git a/app-text/mupdf/patches/mupdf-1.7.patchset b/app-text/mupdf/patches/mupdf-1.7.patchset new file mode 100644 index 000000000..3e03a6f96 --- /dev/null +++ b/app-text/mupdf/patches/mupdf-1.7.patchset @@ -0,0 +1,144 @@ +From 822c66106b347a8483d72db3ac8adffd1bf1aacc Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 21 Apr 2015 12:57:05 +0300 +Subject: gcc2 fixes + + +diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h +index 5df0c50..9e56bdb 100644 +--- a/include/mupdf/fitz/system.h ++++ b/include/mupdf/fitz/system.h +@@ -61,6 +61,12 @@ + #define fz_jmp_buf jmp_buf + #endif + ++#ifdef __HAIKU__ ++#if __GNUC__ < 3 ++#define va_copy __va_copy ++#endif ++#endif ++ + #ifdef _MSC_VER /* Microsoft Visual C */ + + /* MSVC up to VS2012 */ +diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c +index 3c4540e..0953d93 100644 +--- a/scripts/cmapdump.c ++++ b/scripts/cmapdump.c +@@ -19,6 +19,24 @@ + #include "../source/fitz/ftoa.c" + #include "../source/fitz/printf.c" + ++#ifdef __HAIKU__ ++#if __GNUC__ < 3 ++#include "../source/fitz/output.c" ++ ++unsigned int ++fz_pixmap_size(fz_context *ctx, fz_pixmap * pix) ++{ ++ if (pix == NULL) ++ return 0; ++ return sizeof(*pix) + pix->n * pix->w * pix->h; ++} ++int pdf_objcmp_resolve(fz_context *ctx, pdf_obj *a, pdf_obj *b) ++{ ++ return 0; ++} ++#endif ++#endif ++ + #include "../source/pdf/pdf-lex.c" + #include "../source/pdf/pdf-cmap.c" + #include "../source/pdf/pdf-cmap-parse.c" +-- +2.2.2 + + +From 72fa503df92c304b9bfc3d181424cfe1083b4cfe Mon Sep 17 00:00:00 2001 +From: Chris Roberts +Date: Mon, 18 Nov 2013 01:10:58 -0700 +Subject: Remove libm and add install-libs target + + +diff --git a/Makefile b/Makefile +index 8e45697..f3d352d 100644 +--- a/Makefile ++++ b/Makefile +@@ -16,7 +16,7 @@ include Makethird + # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that + # set a variable that was set on the command line. + CFLAGS += $(XCFLAGS) -Iinclude -I$(GEN) +-LIBS += $(XLIBS) -lm ++LIBS += $(XLIBS) + + THIRD_LIBS += $(FREETYPE_LIB) + THIRD_LIBS += $(JBIG2DEC_LIB) +@@ -330,7 +330,17 @@ third: $(THIRD_LIBS) $(CURL_LIB) + libs: $(INSTALL_LIBS) + apps: $(INSTALL_APPS) + +-install: libs apps ++install: install-libs apps ++ install -d $(DESTDIR)$(bindir) ++ install $(INSTALL_APPS) $(DESTDIR)$(bindir) ++ ++ install -d $(DESTDIR)$(mandir)/man1 ++ install docs/man/*.1 $(DESTDIR)$(mandir)/man1 ++ ++ install -d $(DESTDIR)$(docdir) ++ install README COPYING CHANGES docs/*.txt $(DESTDIR)$(docdir) ++ ++install-libs: libs + install -d $(DESTDIR)$(incdir)/mupdf + install -d $(DESTDIR)$(incdir)/mupdf/fitz + install -d $(DESTDIR)$(incdir)/mupdf/pdf +@@ -341,14 +351,6 @@ install: libs apps + install -d $(DESTDIR)$(libdir) + install $(INSTALL_LIBS) $(DESTDIR)$(libdir) + +- install -d $(DESTDIR)$(bindir) +- install $(INSTALL_APPS) $(DESTDIR)$(bindir) +- +- install -d $(DESTDIR)$(mandir)/man1 +- install docs/man/*.1 $(DESTDIR)$(mandir)/man1 +- +- install -d $(DESTDIR)$(docdir) +- install README COPYING CHANGES docs/*.txt $(DESTDIR)$(docdir) + + tarball: + bash scripts/archive.sh +diff --git a/Makerules b/Makerules +index 47b6d1c..bcd27ae 100644 +--- a/Makerules ++++ b/Makerules +@@ -53,6 +53,27 @@ AR = xcrun ar + LD = xcrun ld + RANLIB_CMD = xcrun ranlib $@ + ++else ifeq "$(OS)" "Haiku" ++ ++ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes" ++SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL $(shell pkg-config --cflags libcrypto) ++SYS_OPENSSL_LIBS = $(shell pkg-config --libs libcrypto) ++endif ++ ++ifeq "$(shell pkg-config --exists libcurl && echo yes)" "yes" ++HAVE_CURL = yes ++SYS_CURL_CFLAGS = $(shell pkg-config --cflags libcurl) ++SYS_CURL_LIBS = $(shell pkg-config --libs libcurl) ++endif ++ ++SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2) ++SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2) ++SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2) ++SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2) ++SYS_JBIG2DEC_LIBS = -ljbig2dec ++SYS_JPEG_LIBS = -ljpeg ++SYS_ZLIB_LIBS = -lz ++ + # Linux uses pkg-config for system libraries. + else ifeq "$(OS)" "Linux" + +-- +2.2.2 +