Subject: [alpine-aports] [PATCH] main/mupdf: upgrade to 1.13.0

From: Daniel Sabogal <[email-masked]>
Date: Thu, 3 May 2018 16:13:50 -0400

---
 main/mupdf/APKBUILD           | 22 +++++++++++++---------
 main/mupdf/openjpeg-2.1.patch | 14 --------------
 main/mupdf/shared-lib.patch   | 27 ++++++++++++++++++++-------
 3 files changed, 33 insertions(+), 30 deletions(-)
 delete mode 100644 main/mupdf/openjpeg-2.1.patch

diff --git a/main/mupdf/APKBUILD b/main/mupdf/APKBUILD
index c472980d8f..d150edfad7 100644
--- a/main/mupdf/APKBUILD
+++ b/main/mupdf/APKBUILD
@@ -2,7 +2,7 @@
 # Contributor: Michael Zhou <[email-masked]>
 # Maintainer: Daniel Sabogal <[email-masked]>
 pkgname=mupdf
-pkgver=1.12.0
+pkgver=1.13.0
 pkgrel=0
 pkgdesc="A lightweight PDF and XPS viewer"
 url="http://mupdf.com"
@@ -14,9 +14,8 @@ makedepends="freetype-dev jpeg-dev jbig2dec-dev libx11-dev libxext-dev
 subpackages="$pkgname-doc $pkgname-dev $pkgname-x11:_x11
 	$pkgname-gl:_gl $pkgname-tools:_tools"
 options="!check"
-source="http://mupdf.com/downloads/archive/$pkgname-$pkgver-source.tar.xz
+source="http://mupdf.com/downloads/archive/$pkgname-$pkgver-source.tar.gz
 	shared-lib.patch
-	openjpeg-2.1.patch
 	"
 
 # secfixes:
@@ -38,12 +37,18 @@ prepare() {
 }
 
 build() {
-	make prefix=/usr -C "$builddir"
+	cd "$builddir"
+	make prefix=/usr verbose=yes all extra-apps
 }
 
 package() {
-	make prefix=/usr DESTDIR="$pkgdir" \
-		-C "$builddir" install
+	cd "$builddir"
+	make prefix=/usr DESTDIR="$pkgdir" install
+
+	install -m755 build/release/mujstest \
+		build/release/muraster \
+		build/release/mjsgen \
+		"$pkgdir"/usr/bin
 
 	ln -s libmupdf.so.0 "$pkgdir"/usr/lib/libmupdf.so
 	ln -s libmupdfthird.so.0 "$pkgdir"/usr/lib/libmupdfthird.so
@@ -80,6 +85,5 @@ _tools() {
 		"$subpkgdir"/usr/bin/
 }
 
-sha512sums="4c9ce81e7b0e2d77e017776fd9f700bc2f695f34b7fd97be7ba113ec1b340e7046c9db7d396abf19a98b1d0c7d72f01ecc1b44fadd250d2d6c6ffdcd9799bc16  mupdf-1.12.0-source.tar.xz
-8d3f22908060351e8bb171c7c8248662dd6ac3fb5c765ad0ce33f33c418f6bcfb1982ea8e97b4fefee067c675cac03f76e8b715640dfd3689e8d7738384b6536  shared-lib.patch
-3034e7d3248d904cc23e033a6331fc7a48d8f14e85deaa7b7b7bc37d8a3bc6c788e2fd0a866873a69c5f416d8de5b3a5b9efde4747fa50c2ea3c4b8d170aa549  openjpeg-2.1.patch"
+sha512sums="d7fca7292e612959893a728d35964cf7b4e607385bdd72e81b8ca1de6ab642f999b734afbbf32d75400cd29b7e178ec360e65c91d7b1e1a53c2a04ff0adbd707  mupdf-1.13.0-source.tar.gz
+4b8afc681f44ccd63c5f0edc574c62b025d5f9421a1277f838b1a9c2f8bd630a4df39c20ef9d6e7a9b453f074ece8e64053f8d14e85c5d0cab5a105365bed9b5  shared-lib.patch"
diff --git a/main/mupdf/openjpeg-2.1.patch b/main/mupdf/openjpeg-2.1.patch
deleted file mode 100644
index 437e114cb9..0000000000
--- a/main/mupdf/openjpeg-2.1.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- mupdf-1.12.0-source/source/fitz/load-jpx.c.orig
-+++ mupdf-1.12.0-source/source/fitz/load-jpx.c
-@@ -445,11 +445,6 @@
- 
- #else /* HAVE_LURATECH */
- 
--#define OPJ_STATIC
--#define OPJ_HAVE_INTTYPES_H
--#if !defined(_MSC_VER) || _MSC_VER >= 1600
--#define OPJ_HAVE_STDINT_H
--#endif
- #define USE_JPIP
- 
- #include <openjpeg.h>
diff --git a/main/mupdf/shared-lib.patch b/main/mupdf/shared-lib.patch
index a3d039a575..b471bba1d7 100644
--- a/main/mupdf/shared-lib.patch
+++ b/main/mupdf/shared-lib.patch
@@ -1,5 +1,5 @@
---- mupdf-1.12.0-source/Makefile.orig
-+++ mupdf-1.12.0-source/Makefile
+--- mupdf-1.13.0-source/Makefile.orig
++++ mupdf-1.13.0-source/Makefile
 @@ -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
@@ -9,15 +9,15 @@
  LIBS += $(XLIBS) -lm
  
  LIBS += $(FREETYPE_LIBS)
-@@ -75,6 +75,7 @@
- CXX_CMD = $(QUIET_CXX) $(CXX) $(CFLAGS) -o $@ -c $<
+@@ -76,6 +76,7 @@
+ CXX_CMD = $(QUIET_CXX) $(CXX) $(filter-out -Wdeclaration-after-statement,$(CFLAGS)) -o $@ -c $<
  AR_CMD = $(QUIET_AR) $(AR) cr $@ $^
  LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 +LINK_SHARED_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -shared -Wl,-soname,$(notdir $@) -o $@ $^ $(LIBS)
  MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
  RM_CMD = $(QUIET_RM) rm -f $@
  TAGS_CMD = $(QUIET_TAGS) ctags $^
-@@ -90,6 +91,9 @@
+@@ -91,6 +92,9 @@
  	$(AR_CMD)
  	$(RANLIB_CMD)
  
@@ -27,14 +27,27 @@
  $(OUT)/%.exe: $(OUT)/%.o | $(ALL_DIR)
  	$(LINK_CMD)
  
-@@ -312,8 +316,8 @@
+@@ -325,10 +329,10 @@
  
  # --- Library ---
  
 -MUPDF_LIB = $(OUT)/libmupdf.a
 -THIRD_LIB = $(OUT)/libmupdfthird.a
+-THREAD_LIB = $(OUT)/libmuthreads.a
+-PKCS7_LIB = $(OUT)/libmupkcs7.a
 +MUPDF_LIB = $(OUT)/libmupdf.so.0
 +THIRD_LIB = $(OUT)/libmupdfthird.so.0
- THREAD_LIB = $(OUT)/libmuthreads.a
++THREAD_LIB = $(OUT)/libmuthreads.so.0
++PKCS7_LIB = $(OUT)/libmupkcs7.so.0
  
  MUPDF_OBJ := \
+ 	$(FITZ_OBJ) \
+@@ -360,7 +364,7 @@
+ $(THREAD_LIB) : $(THREAD_OBJ)
+ $(PKCS7_LIB) : $(PKCS7_OBJ)
+ 
+-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
++INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
+ 
+ # --- Tools and Apps ---
+ 
-- 
2.17.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Daniel Sabogal <[email-masked]>
Date: Thu, 3 May 2018 16:13:51 -0400

Add subpackages for new/missing targets

The milkymist platform for the lm32 target depends on libX11 when
opengl support is enabled (default), but the configure script
only emits X11_LIBS if SDL or GTK support enabled (they are not)
---
 ...ix-configure-for-s390-qemu-on-alpine.patch | 56 -------------------
 main/qemu/APKBUILD                            | 19 +++++--
 main/qemu/lm32-need-x11.patch                 | 11 ++++
 3 files changed, 25 insertions(+), 61 deletions(-)
 delete mode 100644 main/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch
 create mode 100644 main/qemu/lm32-need-x11.patch

diff --git a/main/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch b/main/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch
deleted file mode 100644
index 38b32da2ac..0000000000
--- a/main/qemu/12-12-Fix-configure-for-s390-qemu-on-alpine.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From patchwork Fri Jan 19 16:42:59 2018
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-Subject: [12/12] Fix configure for s390 qemu on alpine
-X-Patchwork-Submitter: Christian Borntraeger <[email-masked]>
-X-Patchwork-Id: 863654
-Message-Id: <[email-masked]>
-To: [email-masked], [email-masked],
- Peter Maydell <[email-masked]>,
- Paolo Bonzini <[email-masked]>
-Cc: Christian Borntraeger <[email-masked]>,
- Alice Frosi <[email-masked]>,
- Alice Frosi <[email-masked]>
-Date: Fri, 19 Jan 2018 17:42:59 +0100
-From: Christian Borntraeger <[email-masked]>
-List-Id: <qemu-devel.nongnu.org>
-
-From: Alice Frosi <[email-masked]>
-
-In alpine docker image the qemu-system-s390x build is broken and
-it throws this error:
-qemu-system-s390x: Initialization of device s390-ipl failed: could not
-load bootloader 's390-ccw.img'
-
-The grep command of busybox uses regex. This fails on binary data
-(e.g. stops on every \0), so it does not identify the string 
-BiGeNdIaN in the test case big/little. Therefore, it assumes 
-that the architecture is little endian.
-
-This fix solves the grep problem by printing the content of
-TMPO with strings
-
-Signed-off-by: Alice Frosi <[email-masked]>
-Signed-off-by: Christian Borntraeger <[email-masked]>
-[some changes to patch description, add -a option to strings]
----
- configure | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure b/configure
-index 6d8c996..383b14e 100755
---- a/configure
-+++ b/configure
-@@ -1906,9 +1906,9 @@ int main(int argc, char *argv[]) {
- EOF
- 
- if compile_object ; then
--    if grep -q BiGeNdIaN $TMPO ; then
-+    if strings -a $TMPO | grep -q BiGeNdIaN ; then
-         bigendian="yes"
--    elif grep -q LiTtLeEnDiAn $TMPO ; then
-+    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
-         bigendian="no"
-     else
-         echo big/little test failed
diff --git a/main/qemu/APKBUILD b/main/qemu/APKBUILD
index a66ed43c8c..884e64bd69 100644
--- a/main/qemu/APKBUILD
+++ b/main/qemu/APKBUILD
@@ -3,7 +3,7 @@
 # Contributor: Jakub Jirutka <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=qemu
-pkgver=2.11.1
+pkgver=2.12.0
 pkgrel=0
 pkgdesc="QEMU is a generic machine emulator and virtualizer"
 url="http://qemu.org/"
@@ -49,6 +49,7 @@ subpackages="$pkgname-doc $pkgname-lang $pkgname-guest-agent:guest"
 
 _subsystems="
 	aarch64
+	aarch64_be
 	alpha
 	arm
 	armeb
@@ -64,11 +65,14 @@ _subsystems="
 	mipsel
 	mipsn32
 	mipsn32el
+	nios2
 	or1k
 	ppc
 	ppc64
 	ppc64abi32
 	ppc64le
+	riscv32
+	riscv64
 	s390x
 	sh4
 	sh4eb
@@ -79,6 +83,7 @@ _subsystems="
 	system-alpha
 	system-arm
 	system-cris
+	system-hppa
 	system-i386
 	system-lm32
 	system-m68k
@@ -94,6 +99,8 @@ _subsystems="
 	system-ppc
 	system-ppc64
 	system-ppcemb
+	system-riscv32
+	system-riscv64
 	system-s390x
 	system-sh4
 	system-sh4eb
@@ -106,6 +113,8 @@ _subsystems="
 	system-xtensaeb
 	tilegx
 	x86_64
+	xtensa
+	xtensaeb
 	"
 for _sub in $_subsystems; do
 	subpackages="$subpackages $pkgname-$_sub:_subsys"
@@ -123,7 +132,7 @@ fi
 
 subpackages="$subpackages $pkgname-img"  # -img must be declared the last
 
-source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.bz2
+source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.xz
 	0001-elfload-load-PIE-executables-to-right-address.patch
 	0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
 	0001-linux-user-fix-build-with-musl-on-aarch64.patch
@@ -135,7 +144,7 @@ source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.bz2
 	0001-linux-user-fix-build-with-musl-on-ppc64le.patch
 	fix-sockios-header.patch
 	test-crypto-ivgen-skip-essiv.patch
-	12-12-Fix-configure-for-s390-qemu-on-alpine.patch
+	lm32-need-x11.patch
 
 	$pkgname-guest-agent.confd
 	$pkgname-guest-agent.initd
@@ -338,7 +347,7 @@ guest() {
 		"$subpkgdir"/etc/conf.d/$pkgname-guest-agent
 }
 
-sha512sums="1b692bbdfc3dc785738c7192aa2a3f9cf53d9f5bf3b3f49fa8692050dc50f7056c8a4d1b527d48ffb2a674a0fd3a46d87addd1eaaa758f35eec1ab5adfe32354  qemu-2.11.1.tar.bz2
+sha512sums="dda057c52cf5fe460b029448049266ace061d21fb5f1cf71a6a37f67b3b7fc3350f6712bf22803fc38fa91f0bd438896ba01b5817b3b94ba9b6925aeaae053b7  qemu-2.12.0.tar.xz
 405008589cad1c8b609eca004d520bf944366e8525f85a19fc6e283c95b84b6c2429822ba064675823ab69f1406a57377266a65021623d1cd581e7db000134fd  0001-elfload-load-PIE-executables-to-right-address.patch
 ec84b27648c01c6e58781295dcd0c2ff8e5a635f9836ef50c1da5d0ed125db1afc4cb5b01cb97606d6dd8f417acba93e1560d9a32ca29161a4bb730b302440ea  0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch
 1ac043312864309e19f839a699ab2485bca51bbf3d5fdb39f1a87b87e3cbdd8cbda1a56e6b5c9ffccd65a8ac2f600da9ceb8713f4dbba26f245bc52bcd8a1c56  0001-linux-user-fix-build-with-musl-on-aarch64.patch
@@ -350,7 +359,7 @@ fd178f2913639a0c33199b3880cb17536961f2b3ff171c12b27f4be6bca032d6b88fd16302d09c69
 d8933df9484158c2b4888254e62117d78f8ed7c18527b249419f39c2b2ab1afa148010884b40661f8965f1ef3105580fceffdfddbb2c9221dc1c62066722ba65  0001-linux-user-fix-build-with-musl-on-ppc64le.patch
 39590476a4ebd7c1e79a4f0451b24c75b1817a2a83abaa1f71bb60b225d772152f0af8f3e51ff65645e378c536ffa6ff551dade52884d03a14b7c6a19c5c97d4  fix-sockios-header.patch
 8b8db136f78bd26b5da171effa9e11016ec2bc3e2fc8107228b5543b47aa370978ed883794aa4f917f334e284a5b49e82070e1da2d31d49301195b6713a48eff  test-crypto-ivgen-skip-essiv.patch
-272272efbf380a6c070c267864c96aa6747c446394b650c9e40633f905e3b6240faa12202e38e9dede5fce02df3fc1bf5b0d6c7ce96826488e752ce339588117  12-12-Fix-configure-for-s390-qemu-on-alpine.patch
+2c42571c51d14cdb67d238d2290e0fc9ce07413aa2b09a20ac86b94ee9f437deacc70d7f7c38cb4893ecb30f9e3ee53b207c6b6efbe72c427efec90f61739810  lm32-need-x11.patch
 d90c034cae3f9097466854ed1a9f32ab4b02089fcdf7320e8f4da13b2b1ff65067233f48809911485e4431d7ec1a22448b934121bc9522a2dc489009e87e2b1f  qemu-guest-agent.confd
 1cd24c2444c5935a763c501af2b0da31635aad9cf62e55416d6477fcec153cddbe7de205d99616def11b085e0dd366ba22463d2270f831d884edbc307c7864a6  qemu-guest-agent.initd
 9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2  80-kvm.rules
diff --git a/main/qemu/lm32-need-x11.patch b/main/qemu/lm32-need-x11.patch
new file mode 100644
index 0000000000..456843c60b
--- /dev/null
+++ b/main/qemu/lm32-need-x11.patch
@@ -0,0 +1,11 @@
+--- qemu-2.12.0/configure.orig
++++ qemu-2.12.0/configure
+@@ -6086,7 +6086,7 @@
+   echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
+   echo "CONFIG_MODULES=y" >> $config_host_mak
+ fi
+-if test "$have_x11" = "yes" -a "$need_x11" = "yes"; then
++if test "$have_x11" = "yes"; then
+   echo "CONFIG_X11=y" >> $config_host_mak
+   echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
+   echo "X11_LIBS=$x11_libs" >> $config_host_mak
-- 
2.17.0

---

---

From: Natanael Copa <[email-masked]>
Date: Wed, 16 May 2018 17:43:12 +0200

Hi!

I saw that recent qemu can add gtk and sdl support as plugins which
means that we may not need to build qemu twice. I think we should look
into refactor the APKBUILD.

I will apply this anyway, so we take it from there.

Thanks!

-nc

On Thu,  3 May 2018 16:13:51 -0400

---

---

From: Leonardo Arena <[email-masked]>
Date: Wed, 30 May 2018 11:05:41 +0200

Hi,
sorry for the late review.

It fails here with:

gcc -Wl,--as-needed -Wl,--gc-sections -Wl,-s -o
build/release/mupdf-x11-curl build/release/platform/x11/curl/x11_main.o
build/release/platform/x11/curl/x11_image.o
build/release/platform/x11/curl/pdfapp.o
build/release/platform/x11/curl/curl_stream.o build/release/libmupdf.so.0
build/release/libmupdfthird.so.0 build/release/libmupkcs7.so.0  -lm
-lfreetype  -lharfbuzz  -ljbig2dec   -lcrypto  -ljpeg   -lopenjp2  -lz
-lX11 -lXext  -lcurl  -lssl -lcrypto  -lpthread -lrt
build/release/libmupkcs7.so.0: undefined reference to
`PKCS12_SAFEBAG_get0_safes'
build/release/libmupkcs7.so.0: undefined reference to
`PKCS12_SAFEBAG_get0_p8inf'
collect2: error: ld returned 1 exit status
make: *** [Makefile:402: build/release/mupdf-x11] Error 1
make: *** Waiting for unfinished jobs....
build/release/libmupkcs7.so.0: undefined reference to
`PKCS12_SAFEBAG_get0_safes'
build/release/libmupkcs7.so.0: undefined reference to
`PKCS12_SAFEBAG_get0_p8inf'
collect2: error: ld returned 1 exit status
make: *** [Makefile:377: build/release/mutool] Error 1

On Thu, May 3, 2018 at 10:13 PM, Daniel Sabogal <[email-masked]>
wrote:

> -sha512sums="4c9ce81e7b0e2d77e017776fd9f700bc2f695f34b7fd97be7ba113ec1b34
> 0e7046c9db7d396abf19a98b1d0c7d72f01ecc1b44fadd250d2d6c6ffdcd9799bc16
> mupdf-1.12.0-source.tar.xz
> -8d3f22908060351e8bb171c7c8248662dd6ac3fb5c765ad0ce33f33c418f
> 6bcfb1982ea8e97b4fefee067c675cac03f76e8b715640dfd3689e8d7738384b6536
> shared-lib.patch
> -3034e7d3248d904cc23e033a6331fc7a48d8f14e85deaa7b7b7bc37d8a3b
> c6c788e2fd0a866873a69c5f416d8de5b3a5b9efde4747fa50c2ea3c4b8d170aa549
> openjpeg-2.1.patch"
> +sha512sums="d7fca7292e612959893a728d35964cf7b4e607385bdd72e81b8ca1de6ab6
> 42f999b734afbbf32d75400cd29b7e178ec360e65c91d7b1e1a53c2a04ff0adbd707
> mupdf-1.13.0-source.tar.gz
> +4b8afc681f44ccd63c5f0edc574c62b025d5f9421a1277f838b1a9c2f8bd
> 630a4df39c20ef9d6e7a9b453f074ece8e64053f8d14e85c5d0cab5a105365bed9b5
> shared-lib.patch"
>  +LINK_SHARED_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -shared
> -Wl,-soname,$(notdir $@) -o $@ $^ $(LIBS)