From 6891aad0bc29803f5887307405f5ac8624e71eda Mon Sep 17 00:00:00 2001 From: svenper Date: Mon, 28 Aug 2017 22:33:53 +0200 Subject: [PATCH] mupdf: generate shared libraries This allows to have the font information (around 35 MB) at one place only, instead of in all the executables. --- common/shlibs | 3 ++ srcpkgs/libmupdf | 1 + .../patches/0002-mupdf-shared-libs.patch | 50 +++++++++++++++++++ srcpkgs/mupdf/template | 42 +++++++++++----- 4 files changed, 84 insertions(+), 12 deletions(-) create mode 120000 srcpkgs/libmupdf create mode 100644 srcpkgs/mupdf/patches/0002-mupdf-shared-libs.patch diff --git a/common/shlibs b/common/shlibs index 4f770c435e..7dc93e5419 100644 --- a/common/shlibs +++ b/common/shlibs @@ -2831,3 +2831,6 @@ libccext2-1.8.so.0 commoncpp2-1.8.1_1 libucommon.so.8 ucommon-7.0.0_1 libusecure.so.8 ucommon-7.0.0_1 libcommoncpp.so.8 ucommon-7.0.0_1 +libmupdf.so.1.11 libmupdf-1.11_4 +libmupdfthird.so.1.11 libmupdf-1.11_4 +libmuthreads.so.1.11 libmupdf-1.11_4 diff --git a/srcpkgs/libmupdf b/srcpkgs/libmupdf new file mode 120000 index 0000000000..401e9a9881 --- /dev/null +++ b/srcpkgs/libmupdf @@ -0,0 +1 @@ +mupdf \ No newline at end of file diff --git a/srcpkgs/mupdf/patches/0002-mupdf-shared-libs.patch b/srcpkgs/mupdf/patches/0002-mupdf-shared-libs.patch new file mode 100644 index 0000000000..c8b7294c44 --- /dev/null +++ b/srcpkgs/mupdf/patches/0002-mupdf-shared-libs.patch @@ -0,0 +1,50 @@ +Submitted By: Pierre Labastie +Date: 2016-11-27 +Initial Package Version: 1.10 +Upstream Status: N/A +Origin: Armin K and Gentoo +Description: Generate shared libraries for mupdf, instead of static ones. This + allows to have the font information (around 35 MB) at one place + only, instead of in all the executables. +Update: Bruce Dubbs 2017/07/15. Changes to include new threads library. + +diff -Naur mupdf-1.11-source.orig/Makefile mupdf-1.11-source/Makefile +--- Makefile 2017-04-05 06:02:21.000000000 -0500 ++++ Makefile 2017-04-15 18:26:46.286239623 -0500 +@@ -14,7 +14,7 @@ + # Do not specify CFLAGS or LIBS on the make invocation line - specify + # 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 -Igenerated ++CFLAGS += $(XCFLAGS) -Iinclude -Igenerated -fPIC + LIBS += $(XLIBS) -lm + + LIBS += $(FREETYPE_LIBS) +@@ -300,19 +300,22 @@ + + # --- Library --- + +-MUPDF_LIB = $(OUT)/libmupdf.a +-THIRD_LIB = $(OUT)/libmupdfthird.a +-THREAD_LIB = $(OUT)/libmuthreads.a ++MUPDF_LIB = $(OUT)/libmupdf.so.$(VOID_VERSION) ++THIRD_LIB = $(OUT)/libmupdfthird.so.$(VOID_VERSION) ++THREAD_LIB = $(OUT)/libmuthreads.so.$(VOID_VERSION) + + MUPDF_OBJ := $(FITZ_OBJ) $(FONT_OBJ) $(PDF_OBJ) $(XPS_OBJ) $(SVG_OBJ) $(CBZ_OBJ) $(HTML_OBJ) $(GPRF_OBJ) + THIRD_OBJ := $(FREETYPE_OBJ) $(HARFBUZZ_OBJ) $(JBIG2DEC_OBJ) $(LIBJPEG_OBJ) $(JPEGXR_OBJ) $(LURATECH_OBJ) $(MUJS_OBJ) $(OPENJPEG_OBJ) $(ZLIB_OBJ) + THREAD_OBJ := $(THREAD_OBJ) + +-$(MUPDF_LIB) : $(MUPDF_OBJ) ++$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf.so.$(VOID_VERSION) -Wl,--no-undefined + $(THIRD_LIB) : $(THIRD_OBJ) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdfthird.so.$(VOID_VERSION) -Wl,--no-undefined + $(THREAD_LIB) : $(THREAD_OBJ) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmuthreads.so.$(VOID_VERSION) -Wl,--no-undefined -lpthread + +-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) ++INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) + + # --- Tools and Apps --- + diff --git a/srcpkgs/mupdf/template b/srcpkgs/mupdf/template index 9a1cfa590c..4fd48e426d 100644 --- a/srcpkgs/mupdf/template +++ b/srcpkgs/mupdf/template @@ -1,7 +1,7 @@ # Template file for 'mupdf' pkgname=mupdf version=1.11 -revision=3 +revision=4 wrksrc="${pkgname}-${version}-source" hostmakedepends="pkg-config zlib-devel libcurl-devel freetype-devel libjpeg-turbo-devel jbig2dec-devel libXext-devel libXcursor-devel @@ -15,10 +15,12 @@ license="AGPL-3" homepage="http://mupdf.com" distfiles="http://mupdf.com/downloads/archive/${pkgname}-${version}-source.tar.gz" checksum=209474a80c56a035ce3f4958a63373a96fad75c927c7b1acdc553fc85855f00a +export VOID_VERSION="${version}" pre_configure() { rm -rf thirdparty/{curl,freetype,harfbuzz,libjpeg,zlib,jbig2dec,openjpeg} } + do_configure() { if [ "$CROSS_BUILD" ]; then export CFLAGS="-fPIC" @@ -26,38 +28,54 @@ do_configure() { make CC=cc LD=ld AR=ar build=release generate fi } + do_build() { CFLAGS+=" -fPIC" CFLAGS+=" $(pkg-config --cflags libopenjp2)" if [ "$CROSS_BUILD" ]; then - make CROSSCOMPILE=yes CURL_LIBS='-lcurl -lpthread' build=release - make CROSSCOMPILE=yes CFLAGS="$CFLAGS" build=release -C thirdparty/mujs + make CURL_LIBS='-lcurl -lpthread' build=release CROSSCOMPILE=yes + make CFLAGS="$CFLAGS" build=release -C thirdparty/mujs CROSSCOMPILE=yes else make CURL_LIBS='-lcurl -lpthread' build=release - make build=release CFLAGS="$CFLAGS" -C thirdparty/mujs + make CFLAGS="$CFLAGS" build=release -C thirdparty/mujs fi } + do_install() { make build=release prefix=${DESTDIR}/usr install - mv ${DESTDIR}/usr/bin/mupdf-x11-curl ${DESTDIR}/usr/bin/mupdf - rm ${DESTDIR}/usr/bin/mupdf-x11 + ln -s mupdf-x11-curl ${DESTDIR}/usr/bin/mupdf - vinstall build/release/libmupdf.a 644 usr/lib + vinstall build/release/libmupdf.so.${version} 644 usr/lib + vinstall build/release/libmupdfthird.so.${version} 644 usr/lib + vinstall build/release/libmuthreads.so.${version} 644 usr/lib vinstall thirdparty/mujs/build/libmujs.a 644 usr/lib vinstall ${FILESDIR}/mupdf.xpm 644 usr/share/pixmaps vinstall ${FILESDIR}/mupdf.desktop 644 usr/share/applications } -mupdf-devel_package() { - short_desc+=" - development files" - depends="libjpeg-turbo-devel jbig2dec-devel libopenjpeg2-devel" +libmupdf_package() { + short_desc+=" - shared libraries" pkg_install() { - vmove usr/include - vmove usr/lib + vmove usr/lib/libmupdf.so.${version} + vmove usr/lib/libmupdfthird.so.${version} + vmove usr/lib/libmuthreads.so.${version} } } + +mupdf-devel_package() { + short_desc+=" - development files" + depends="libmupdf libjpeg-turbo-devel jbig2dec-devel libopenjpeg2-devel" + pkg_install() { + vmove usr/include + vmove usr/lib/libmujs.a + ln -s libmupdf.so.${version} ${PKGDESTDIR}/usr/lib/libmupdf.so + ln -s libmupdfthird.so.${version} ${PKGDESTDIR}/usr/lib/libmupdfthird.so + ln -s libmuthreads.so.${version} ${PKGDESTDIR}/usr/lib/libmuthreads.so + } +} + mupdf-tools_package() { short_desc+=" - tools" pkg_install() {