diff --git a/package/mupdf/0004-Makefile-compile-hexdump.exe-with-HOSTCC.patch b/package/mupdf/0004-Makefile-compile-hexdump.exe-with-HOSTCC.patch new file mode 100644 index 0000000000..bc9debd332 --- /dev/null +++ b/package/mupdf/0004-Makefile-compile-hexdump.exe-with-HOSTCC.patch @@ -0,0 +1,40 @@ +From c0036573a995dc78d3cf60a30ff0af2b47f3680a Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sun, 14 Nov 2021 23:24:27 +0100 +Subject: [PATCH] Makefile: compile hexdump.exe with HOSTCC + +hexdump.exe must be compiled for the host or the build will fail when +cross-compiling with HAVE_OBJCOPY=no + +Signed-off-by: Fabrice Fontaine +[Upstream status: https://bugs.ghostscript.com/show_bug.cgi?id=704442] +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index 6492b1ca3..0732b358f 100644 +--- a/Makefile ++++ b/Makefile +@@ -60,6 +60,8 @@ AR_CMD = $(QUIET_AR) $(MKTGTDIR) ; $(AR) cr $@ $^ + ifdef RANLIB + RANLIB_CMD = $(QUIET_RANLIB) $(RANLIB) $@ + endif ++HOSTCC ?= $(CC) ++HOST_LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(HOSTCC) -o $@ $^ + LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + TAGS_CMD = $(QUIET_TAGS) ctags -R --c-kinds=+p --exclude=platform/python --exclude=platform/c++ + WINDRES_CMD = $(QUIET_WINDRES) $(MKTGTDIR) ; $(WINDRES) $< $@ +@@ -81,6 +83,9 @@ $(OUT)/%.a : + $(AR_CMD) + $(RANLIB_CMD) + ++$(OUT)/scripts/hexdump.exe: scripts/hexdump.c ++ $(HOST_LINK_CMD) ++ + $(OUT)/%.exe: %.c + $(LINK_CMD) + +-- +2.33.0 + diff --git a/package/mupdf/0004-Use-CC-instead-of-LD-for-OBJCOPY.patch b/package/mupdf/0004-Use-CC-instead-of-LD-for-OBJCOPY.patch deleted file mode 100644 index 0e0aadd29d..0000000000 --- a/package/mupdf/0004-Use-CC-instead-of-LD-for-OBJCOPY.patch +++ /dev/null @@ -1,43 +0,0 @@ -From da4b98447573daf77829811e95e3772e8a296934 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= -Date: Thu, 2 Sep 2021 20:17:26 +0200 -Subject: [PATCH] Use CC instead of LD for OBJCOPY -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When cross-compiling for mips targets using Buildroot, using LD for -partial linking fails in the following way: -/tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips64el-buildroot-linux-uclibc/8.4.0/../../../../mips64el-buildroot-linux-uclibc/bin/ld: build/release/libmupdf.a(Dingbats.cff.o): ABI is incompatible with that of the selected emulation -/tmp/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/mips64el-buildroot-linux-uclibc/8.4.0/../../../../mips64el-buildroot-linux-uclibc/bin/ld: failed to merge target specific data of file build/release/libmupdf.a(Dingbats.cff.o) - -To fix it, use CC instead of LD for partial linking. - -'nostdlib' has to be added, or it will try to use GCC libraries for -partial linking and fail with 'cannot find -lgcc_s'. - -Fixes: -- http://autobuild.buildroot.net/results/156fe9ee5f6dccdc98990f6c5de5562383bc2b74 - -Signed-off-by: Raphaël Mélotte -[Upstream status: https://bugs.ghostscript.com/show_bug.cgi?id=704442] ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index b0fb617e2..0a8795e0e 100644 ---- a/Makefile -+++ b/Makefile -@@ -64,7 +64,7 @@ endif - LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - 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 $@ $< -+OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(CC) -Wl,-r -Wl,-b -Wl,binary -Wl,-z -Wl,noexecstack -nostdlib -o $@ $< - - # --- Rules --- - --- -2.33.0 - diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk index c9d5b4a162..56ea7cc507 100644 --- a/package/mupdf/mupdf.mk +++ b/package/mupdf/mupdf.mk @@ -52,25 +52,28 @@ MUPDF_MAKE_ENV = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \ XLIBS="$(MUPDF_LDFLAGS)" \ USE_SYSTEM_LIBS=yes +MUPDF_MAKE_OPTS = \ + HAVE_OBJCOPY=no \ + prefix="/usr" + ifeq ($(BR2_PACKAGE_LIBFREEGLUT),y) MUPDF_DEPENDENCIES += libfreeglut else -define MUPDF_DISABLE_OPENGL - sed -i 's/HAVE_GLUT := yes/HAVE_GLUT := no/g' $(@D)/Makerules -endef -MUPDF_POST_PATCH_HOOKS = MUPDF_DISABLE_OPENGL +MUPDF_MAKE_OPTS += HAVE_GLUT=no endif define MUPDF_BUILD_CMDS - $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) all + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) all endef define MUPDF_INSTALL_STAGING_CMDS - $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(STAGING_DIR)" prefix="/usr" install_libs + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \ + DESTDIR="$(STAGING_DIR)" install_libs endef define MUPDF_INSTALL_TARGET_CMDS - $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" prefix="/usr" install + $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \ + DESTDIR="$(TARGET_DIR)" install endef $(eval $(generic-package))