From 7f6ad85c24793f897887df0a7ac89b9131ac336b Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Tue, 18 Jan 2022 16:51:22 +0900 Subject: [PATCH] mupdf: Build static libs --- packages/mupdf/Makefile.patch | 24 +++++++++++++++++++++++- packages/mupdf/Makerules.patch | 12 +++++++++++- packages/mupdf/build.sh | 8 +++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/mupdf/Makefile.patch b/packages/mupdf/Makefile.patch index 8e4a77b5c..6f57fa799 100644 --- a/packages/mupdf/Makefile.patch +++ b/packages/mupdf/Makefile.patch @@ -1,7 +1,20 @@ diff -uNr mupdf-1.18.0-source/Makefile mupdf-1.18.0-source.mod/Makefile --- mupdf-1.18.0-source/Makefile 2020-10-07 13:35:03.000000000 +0300 +++ mupdf-1.18.0-source.mod/Makefile 2021-08-05 19:47:26.364131551 +0300 -@@ -66,6 +66,14 @@ +@@ -48,6 +48,7 @@ + QUIET_CXX = @ echo " CXX $@" ; + QUIET_GEN = @ echo " GEN $@" ; + QUIET_LINK = @ echo " LINK $@" ; ++ QUIET_LINK_FOR_BUILD = @ echo " LINK_FOR_BUILD $@" ; + QUIET_RM = @ echo " RM $@" ; + QUIET_TAGS = @ echo " TAGS $@" ; + QUIET_WINDRES = @ echo " WINDRES $@" ; +@@ -62,10 +63,19 @@ + RANLIB_CMD = $(QUIET_RANLIB) $(RANLIB) $@ + endif + LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) ++LINK_FOR_BUILD_CMD = $(QUIET_LINK_FOR_BUILD) $(MKTGTDIR) ; $(CC_FOR_BUILD) -o $@ $^ + TAGS_CMD = $(QUIET_TAGS) ctags -R --c-kinds=+p WINDRES_CMD = $(QUIET_WINDRES) $(MKTGTDIR) ; $(WINDRES) $< $@ OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(LD) -r -b binary -z noexecstack -o $@ $< @@ -16,6 +29,15 @@ diff -uNr mupdf-1.18.0-source/Makefile mupdf-1.18.0-source.mod/Makefile # --- Rules --- $(OUT)/%.a : +@@ -73,7 +81,7 @@ + $(RANLIB_CMD) + + $(OUT)/%.exe: %.c +- $(LINK_CMD) ++ $(LINK_FOR_BUILD_CMD) + + $(OUT)/%.$(SO): + $(LINK_CMD) $(LIB_LDFLAGS) $(THIRD_LIBS) $(LIBCRYPTO_LIBS) @@ -321,7 +329,7 @@ $(OUT)/example: docs/examples/example.c $(MUPDF_LIB) $(THIRD_LIB) $(LINK_CMD) $(CFLAGS) $(THIRD_LIBS) diff --git a/packages/mupdf/Makerules.patch b/packages/mupdf/Makerules.patch index 0c3a644e8..c42e41e7d 100644 --- a/packages/mupdf/Makerules.patch +++ b/packages/mupdf/Makerules.patch @@ -1,7 +1,17 @@ diff -uNr mupdf-1.15.0-source/Makerules mupdf-1.15.0-source.mod/Makerules --- mupdf-1.15.0-source/Makerules 2019-05-06 14:53:09.000000000 +0300 +++ mupdf-1.15.0-source.mod/Makerules 2019-07-01 02:08:28.604522907 +0300 -@@ -134,7 +134,7 @@ +@@ -116,7 +116,8 @@ + RANLIB = xcrun ranlib + + else ifeq ($(OS),Linux) +- HAVE_OBJCOPY := yes ++ #HAVE_OBJCOPY := yes ++ HAVE_OBJCOPY := no + + ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes) + SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2) +@@ -186,7 +187,7 @@ HAVE_PTHREAD := yes ifeq ($(HAVE_PTHREAD),yes) PTHREAD_CFLAGS := diff --git a/packages/mupdf/build.sh b/packages/mupdf/build.sh index 76877bbff..fe0290a2a 100644 --- a/packages/mupdf/build.sh +++ b/packages/mupdf/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Lightweight PDF and XPS viewer (library)" TERMUX_PKG_LICENSE="AGPL-V3" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=1.18.0 -TERMUX_PKG_REVISION=4 +TERMUX_PKG_REVISION=5 TERMUX_PKG_SRCURL=https://mupdf.com/downloads/archive/mupdf-${TERMUX_PKG_VERSION}-source.tar.xz TERMUX_PKG_SHA256=592d4f6c0fba41bb954eb1a41616661b62b134d5b383e33bd45a081af5d4a59a TERMUX_PKG_DEPENDS="freetype, gumbo-parser, harfbuzz, jbig2dec, libjpeg-turbo, openjpeg, zlib" @@ -15,3 +15,9 @@ termux_step_pre_configure() { export USE_SYSTEM_LIBS=yes LDFLAGS+=" -llog" } + +termux_step_post_make_install() { + TERMUX_PKG_EXTRA_MAKE_ARGS="${TERMUX_PKG_EXTRA_MAKE_ARGS/shared=yes/}" + termux_step_make + install -Dm600 -t $TERMUX_PREFIX/lib build/release/libmupdf{-third,}.a +}