From 9173f0a5498afca2f195aa11fda8bcb108065626 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:25:15 +0200 Subject: [PATCH 01/20] Don't require a cross-tc for cleanthirdparty (still confuzzled about why luajit needs CFLAGS for a clean target, but, hey!). Fixes #357 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 877b73d1e..2e1f28105 100644 --- a/Makefile +++ b/Makefile @@ -184,7 +184,7 @@ clean: rm -f *.o kpdfview slider_watcher cleanthirdparty: - $(MAKE) -C $(LUADIR) CC="$(HOSTCC)" HOST_CC="$(HOSTCC) -m32" CROSS="$(CHOST)-" clean + $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS=$(BASE_CFLAGS) clean $(MAKE) -C $(MUPDFDIR) build="release" clean $(MAKE) -C $(CRENGINEDIR)/thirdparty/antiword clean test -d $(CRENGINEDIR)/thirdparty/chmlib && $(MAKE) -C $(CRENGINEDIR)/thirdparty/chmlib clean || echo warn: chmlib folder not found From 51345c6f080da9eeb918bf10e1fa0e91e966b9f3 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:27:48 +0200 Subject: [PATCH 02/20] Let's do a distclean, actually. Less noise in git status that way. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2e1f28105..ebda06394 100644 --- a/Makefile +++ b/Makefile @@ -184,7 +184,7 @@ clean: rm -f *.o kpdfview slider_watcher cleanthirdparty: - $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS=$(BASE_CFLAGS) clean + $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS=$(BASE_CFLAGS) distclean $(MAKE) -C $(MUPDFDIR) build="release" clean $(MAKE) -C $(CRENGINEDIR)/thirdparty/antiword clean test -d $(CRENGINEDIR)/thirdparty/chmlib && $(MAKE) -C $(CRENGINEDIR)/thirdparty/chmlib clean || echo warn: chmlib folder not found From b5134ee4f2abe7fbd76cc258aa45c6bc359ec76d Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:35:49 +0200 Subject: [PATCH 03/20] Honor toplevel settings re: CC/FLAGS when building libdjvu. Define _GNU_SOURCE to fix build with CS/MG TC. Fixes #341 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ebda06394..10a3802e7 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ HOSTCXX:=g++ HOSTAR:=ar # Base CFLAGS, without arch. We'll need it for luajit, because its Makefiles do some tricky stuff to differentiate HOST/TARGET -BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE +BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE # Use this for debugging: #BASE_CFLAGS:=-O0 -g ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp @@ -213,9 +213,9 @@ $(MUPDFLIBS) $(THIRDPARTYLIBS): $(MUPDFDIR)/cmapdump.host $(MUPDFDIR)/fontdump.h $(DJVULIBS): mkdir -p $(DJVUDIR)/build ifdef EMULATE_READER - cd $(DJVUDIR)/build && ../configure --disable-desktopfiles --disable-shared --enable-static --disable-xmltools --disable-largefile + cd $(DJVUDIR)/build && CC="$(HOSTCC)" CXX="$(HOSTCXX)" CFLAGS="$(HOSTCFLAGS)" CXXFLAGS="$(HOSTCFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure --disable-desktopfiles --disable-shared --enable-static --disable-xmltools --disable-largefile else - cd $(DJVUDIR)/build && ../configure --disable-desktopfiles --disable-shared --enable-static --host=$(CHOST) --disable-xmltools --disable-largefile + cd $(DJVUDIR)/build && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure --disable-desktopfiles --disable-shared --enable-static --host=$(CHOST) --disable-xmltools --disable-largefile endif $(MAKE) -C $(DJVUDIR)/build From 679fce3df47f0c05ef2d6a95ed2e7e1dc1dd7cc1 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:37:36 +0200 Subject: [PATCH 04/20] Make sure we're building for the softfp float ABI, and not in Thumb. Might fix #359 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 10a3802e7..a386ea8d0 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ HOSTAR:=ar BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE # Use this for debugging: #BASE_CFLAGS:=-O0 -g -ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp +ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm HOST_ARCH:=-march=native HOSTCFLAGS:=$(HOST_ARCH) $(BASE_CFLAGS) CFLAGS:=$(BASE_CFLAGS) From e29052dbbca9305eea67356520c0a1e41799d6fa Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:40:53 +0200 Subject: [PATCH 05/20] Mention open_noshell in the README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ca2e4952..ee48f0504 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Follow these steps: * install libDjvuLibre sources into subfolder "djvulibre" * install CREngine sources into subfolder "kpvcrlib/crengine" * install LuaJit sources into subfolder "luajit-2.0" + * install popen_noshell sources into subfolder "popen-noshell" * automatically fetch thirdparty sources with Makefile: * make sure you have wget, unzip, git and svn installed @@ -58,7 +59,7 @@ Device emulation The code also features a device emulation. You need SDL headers and library for this. It allows to develop on a standard PC and saves precious development time. It might also compose the most unfriendly desktop PDF reader, depending -on your view. +on your view. If you are using Ubuntu, simply install `libsdl-dev1.2` package. From 5a2e4dec99f4004aeeeb4042da2e901da4fedce6 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 13:56:36 +0200 Subject: [PATCH 06/20] Fix the luajit clean fix (forgot to quote *_*). Let ld do its job when linking, don't pass the static libs as object files (we end up with a smaller native binary). --- Makefile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a386ea8d0..474ed55b0 100644 --- a/Makefile +++ b/Makefile @@ -112,21 +112,32 @@ kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o input.o $(POPENNS blitbuffer.o \ drawcontext.o \ input.o \ - $(POPENNSLIB) \ util.o \ ft.o \ lfs.o \ mupdfimg.o \ - $(MUPDFLIBS) \ - $(THIRDPARTYLIBS) \ - $(LUALIB) \ djvu.o \ - $(DJVULIBS) \ cre.o \ - $(CRENGINELIBS) \ $(STATICLIBSTDCPP) \ $(LDFLAGS) \ - -o $@ -lm -ldl -lpthread $(EMU_LDFLAGS) $(DYNAMICLIBSTDCPP) + -L$(POPENNSDIR) \ + -L$(MUPDFLIBDIR) \ + -L$(DJVUDIR)/build/libdjvu/.libs \ + -L$(LUADIR)/src \ + -L$(CRENGINEDIR)/crengine \ + -L$(CRENGINEDIR)/thirdparty/chmlib \ + -L$(CRENGINEDIR)/thirdparty/libpng \ + -L$(CRENGINEDIR)/thirdparty/antiword \ + -L$(MUPDFLIBDIR) \ + -o $@ \ + -lm -ldl -lpthread \ + -lpopen_noshell \ + -lfitz -lfreetype -lopenjpeg -ljbig2dec -ljpeg -lz \ + -lluajit \ + -ldjvulibre \ + -lcrengine -lchmlib -lpng -lantiword \ + $(EMU_LDFLAGS) \ + $(DYNAMICLIBSTDCPP) slider_watcher.o: %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ @@ -184,7 +195,7 @@ clean: rm -f *.o kpdfview slider_watcher cleanthirdparty: - $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS=$(BASE_CFLAGS) distclean + $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS="$(BASE_CFLAGS)" distclean $(MAKE) -C $(MUPDFDIR) build="release" clean $(MAKE) -C $(CRENGINEDIR)/thirdparty/antiword clean test -d $(CRENGINEDIR)/thirdparty/chmlib && $(MAKE) -C $(CRENGINEDIR)/thirdparty/chmlib clean || echo warn: chmlib folder not found From 9169ac75418120d8d10b9a33ee563d07a0663008 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 14:19:32 +0200 Subject: [PATCH 07/20] Make sure we're always building luajit statically, so ld doesn't pick a shared version. Of course that explained the size difference :D. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 474ed55b0..647573fba 100644 --- a/Makefile +++ b/Makefile @@ -130,10 +130,10 @@ kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o input.o $(POPENNS -L$(CRENGINEDIR)/thirdparty/antiword \ -L$(MUPDFLIBDIR) \ -o $@ \ - -lm -ldl -lpthread \ + -lm -lpthread \ -lpopen_noshell \ -lfitz -lfreetype -lopenjpeg -ljbig2dec -ljpeg -lz \ - -lluajit \ + -lluajit -ldl \ -ldjvulibre \ -lcrengine -lchmlib -lpng -lantiword \ $(EMU_LDFLAGS) \ @@ -237,10 +237,10 @@ $(CRENGINELIBS): $(LUALIB): ifdef EMULATE_READER - $(MAKE) -C $(LUADIR) + $(MAKE) -C $(LUADIR) BUILDMODE=static else # To recap: build its TARGET_CC from CROSS+CC, so we need HOSTCC in CC. Build its HOST/TARGET_CFLAGS based on CFLAGS, so we need a neutral CFLAGS without arch - $(MAKE) -C $(LUADIR) CC="$(HOSTCC)" HOST_CC="$(HOSTCC) -m32" CFLAGS="$(BASE_CFLAGS)" HOST_CFLAGS="$(HOSTCFLAGS)" TARGET_CFLAGS="$(CFLAGS)" CROSS="$(CHOST)-" TARGET_FLAGS="-DLUAJIT_NO_LOG2 -DLUAJIT_NO_EXP2" + $(MAKE) -C $(LUADIR) BUILDMODE=static CC="$(HOSTCC)" HOST_CC="$(HOSTCC) -m32" CFLAGS="$(BASE_CFLAGS)" HOST_CFLAGS="$(HOSTCFLAGS)" TARGET_CFLAGS="$(CFLAGS)" CROSS="$(CHOST)-" TARGET_FLAGS="-DLUAJIT_NO_LOG2 -DLUAJIT_NO_EXP2" endif $(POPENNSLIB): From b0f7ea5d81d4b88987de45cdb464242b9388b659 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 14:24:40 +0200 Subject: [PATCH 08/20] revert the whole 'let's use ld' thing. It's useless, and might wreak havoc on EMU builds picking up system libs instead of the bundled ones. --- Makefile | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 647573fba..6283b9345 100644 --- a/Makefile +++ b/Makefile @@ -112,30 +112,22 @@ kpdfview: kpdfview.o einkfb.o pdf.o blitbuffer.o drawcontext.o input.o $(POPENNS blitbuffer.o \ drawcontext.o \ input.o \ + $(POPENNSLIB) \ util.o \ ft.o \ lfs.o \ mupdfimg.o \ + $(MUPDFLIBS) \ + $(THIRDPARTYLIBS) \ + $(LUALIB) \ djvu.o \ + $(DJVULIBS) \ cre.o \ + $(CRENGINELIBS) \ $(STATICLIBSTDCPP) \ $(LDFLAGS) \ - -L$(POPENNSDIR) \ - -L$(MUPDFLIBDIR) \ - -L$(DJVUDIR)/build/libdjvu/.libs \ - -L$(LUADIR)/src \ - -L$(CRENGINEDIR)/crengine \ - -L$(CRENGINEDIR)/thirdparty/chmlib \ - -L$(CRENGINEDIR)/thirdparty/libpng \ - -L$(CRENGINEDIR)/thirdparty/antiword \ - -L$(MUPDFLIBDIR) \ -o $@ \ - -lm -lpthread \ - -lpopen_noshell \ - -lfitz -lfreetype -lopenjpeg -ljbig2dec -ljpeg -lz \ - -lluajit -ldl \ - -ldjvulibre \ - -lcrengine -lchmlib -lpng -lantiword \ + -lm -ldl -lpthread \ $(EMU_LDFLAGS) \ $(DYNAMICLIBSTDCPP) From 9520c9b662eb6e5db12509c28db9be9cf0be44e5 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 14:50:29 +0200 Subject: [PATCH 09/20] Add -fno-finite-math-only (after -ffast-math) to the ARM flags to avoid MG 2012.03 pulling GLIBC_2.15 symbols from libm (because -ffast-math asks for it). I didn't see this on my own TC because it's using a much older glibc version (2.9). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6283b9345..0b05e8ed3 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ HOSTAR:=ar BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE # Use this for debugging: #BASE_CFLAGS:=-O0 -g -ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm +ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm -fno-finite-math-only HOST_ARCH:=-march=native HOSTCFLAGS:=$(HOST_ARCH) $(BASE_CFLAGS) CFLAGS:=$(BASE_CFLAGS) From c35b5d2d5617fb78fa6972ebeb5168d29e1272de Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 14:54:45 +0200 Subject: [PATCH 10/20] Don't use the backward compat flags on the host. Move to a dedicated variable, with a few comments to explain ;). --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0b05e8ed3..9d3cf5b15 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,12 @@ HOSTCXX:=g++ HOSTAR:=ar # Base CFLAGS, without arch. We'll need it for luajit, because its Makefiles do some tricky stuff to differentiate HOST/TARGET -BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer -fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE +BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer # Use this for debugging: #BASE_CFLAGS:=-O0 -g -ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm -fno-finite-math-only +# Misc GCC tricks to ensure backward compatibility with the K2, even when using a fairly recent TC (Linaro/MG). +ARM_BACKWARD_COMPAT_FLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only +ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm HOST_ARCH:=-march=native HOSTCFLAGS:=$(HOST_ARCH) $(BASE_CFLAGS) CFLAGS:=$(BASE_CFLAGS) @@ -68,8 +70,8 @@ ifdef EMULATE_READER CFLAGS+= $(HOST_ARCH) CXXFLAGS+= $(HOST_ARCH) else - CFLAGS+= $(ARM_ARCH) - CXXFLAGS+= $(ARM_ARCH) + CFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_FLAGS) + CXXFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_FLAGS) endif # standard includes From d55138113f4d3da765411fce604b4c3d46247d17 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 14:56:14 +0200 Subject: [PATCH 11/20] Split the backward compat stuff between CFLAGS/CXXFLAGS --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9d3cf5b15..b0d72182e 100644 --- a/Makefile +++ b/Makefile @@ -36,12 +36,13 @@ BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer # Use this for debugging: #BASE_CFLAGS:=-O0 -g # Misc GCC tricks to ensure backward compatibility with the K2, even when using a fairly recent TC (Linaro/MG). -ARM_BACKWARD_COMPAT_FLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only +ARM_BACKWARD_COMPAT_CFLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only +ARM_BACKWARD_COMPAT_CXXFLAGS:=-fno-use-cxa-atexit ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm HOST_ARCH:=-march=native HOSTCFLAGS:=$(HOST_ARCH) $(BASE_CFLAGS) CFLAGS:=$(BASE_CFLAGS) -CXXFLAGS:=$(BASE_CFLAGS) -fno-use-cxa-atexit +CXXFLAGS:=$(BASE_CFLAGS) LDFLAGS:=-Wl,-O1 -Wl,--as-needed DYNAMICLIBSTDCPP:=-lstdc++ @@ -70,8 +71,8 @@ ifdef EMULATE_READER CFLAGS+= $(HOST_ARCH) CXXFLAGS+= $(HOST_ARCH) else - CFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_FLAGS) - CXXFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_FLAGS) + CFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_CFLAGS) + CXXFLAGS+= $(ARM_ARCH) $(ARM_BACKWARD_COMPAT_CFLAGS) $(ARM_BACKWARD_COMPAT_CXXFLAGS) endif # standard includes From c68ac9c8c82c976684bb45da4cd232141a787974 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:07:48 +0200 Subject: [PATCH 12/20] Add a note about -mno-unaligned-access (check my x-compile.sh script for more details, I'll revisit this once Linaro 2012.10 comes out). --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index b0d72182e..eef48ca5d 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer # Use this for debugging: #BASE_CFLAGS:=-O0 -g # Misc GCC tricks to ensure backward compatibility with the K2, even when using a fairly recent TC (Linaro/MG). +# NOTE: Right now, -mno-unaligned-access is not needed, but it probably will (for FW 2.x) be once MG moves to GCC 4.7. ARM_BACKWARD_COMPAT_CFLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only ARM_BACKWARD_COMPAT_CXXFLAGS:=-fno-use-cxa-atexit ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm From 0790190af58d4b2fef905940068a6b9e298b88a7 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:24:06 +0200 Subject: [PATCH 13/20] Slightly nicer fix for building mupdf's .host stuff with CFLAGS in the env. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eef48ca5d..b03d05c96 100644 --- a/Makefile +++ b/Makefile @@ -204,12 +204,12 @@ cleanthirdparty: $(MAKE) -C $(POPENNSDIR) clean $(MUPDFDIR)/fontdump.host: - $(MAKE) -C mupdf build="release" CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) -I../mupdf/fitz -I../mupdf/pdf" $(MUPDFTARGET)/fontdump + CFLAGS="$(HOSTCFLAGS)" $(MAKE) -C mupdf build="release" CC="$(HOSTCC)" $(MUPDFTARGET)/fontdump cp -a $(MUPDFLIBDIR)/fontdump $(MUPDFDIR)/fontdump.host $(MAKE) -C mupdf clean $(MUPDFDIR)/cmapdump.host: - $(MAKE) -C mupdf build="release" CC="$(HOSTCC)" CFLAGS="$(HOSTCFLAGS) -I../mupdf/fitz -I../mupdf/pdf" $(MUPDFTARGET)/cmapdump + CFLAGS="$(HOSTCFLAGS)" $(MAKE) -C mupdf build="release" CC="$(HOSTCC)" $(MUPDFTARGET)/cmapdump cp -a $(MUPDFLIBDIR)/cmapdump $(MUPDFDIR)/cmapdump.host $(MAKE) -C mupdf clean From e04cb9a66b12364155a4875b96c586ff4e530a79 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:34:59 +0200 Subject: [PATCH 14/20] We don't need those two in EMU ;). --- input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/input.c b/input.c index d781c5b10..00fe9fb41 100644 --- a/input.c +++ b/input.c @@ -43,8 +43,10 @@ #define NUM_FDS 4 int inputfds[4] = { -1, -1, -1, -1 }; +#ifndef EMULATE_READER pid_t slider_pid = -1; struct popen_noshell_pass_to_pclose pclose_arg; +#endif void slider_handler(int sig) { From 3f945b8d93936e91a00da5aac42954793607ca9b Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:36:05 +0200 Subject: [PATCH 15/20] We don't need you, either, in EMU... --- input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input.c b/input.c index 00fe9fb41..06e1ce785 100644 --- a/input.c +++ b/input.c @@ -46,7 +46,6 @@ int inputfds[4] = { -1, -1, -1, -1 }; #ifndef EMULATE_READER pid_t slider_pid = -1; struct popen_noshell_pass_to_pclose pclose_arg; -#endif void slider_handler(int sig) { @@ -56,6 +55,7 @@ void slider_handler(int sig) kill(pclose_arg.pid, SIGINT); } } +#endif int findFreeFdSlot() { int i; From 3e47fe8e01be31837d3601076f94d007e05c2fba Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:42:11 +0200 Subject: [PATCH 16/20] Quote that to avoid potential issues... --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b03d05c96..8ea8d3eb1 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ clean: rm -f *.o kpdfview slider_watcher cleanthirdparty: - $(MAKE) -C $(LUADIR) CC=$(HOSTCC) CFLAGS="$(BASE_CFLAGS)" distclean + $(MAKE) -C $(LUADIR) CC="$(HOSTCC)" CFLAGS="$(BASE_CFLAGS)" distclean $(MAKE) -C $(MUPDFDIR) build="release" clean $(MAKE) -C $(CRENGINEDIR)/thirdparty/antiword clean test -d $(CRENGINEDIR)/thirdparty/chmlib && $(MAKE) -C $(CRENGINEDIR)/thirdparty/chmlib clean || echo warn: chmlib folder not found From 24b9678dc605951b1486d01bca1b2cf7b7e87a5c Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:43:25 +0200 Subject: [PATCH 17/20] It's a spaaaaace! --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8ea8d3eb1..74ad8c224 100644 --- a/Makefile +++ b/Makefile @@ -222,7 +222,7 @@ $(DJVULIBS): ifdef EMULATE_READER cd $(DJVUDIR)/build && CC="$(HOSTCC)" CXX="$(HOSTCXX)" CFLAGS="$(HOSTCFLAGS)" CXXFLAGS="$(HOSTCFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure --disable-desktopfiles --disable-shared --enable-static --disable-xmltools --disable-largefile else - cd $(DJVUDIR)/build && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure --disable-desktopfiles --disable-shared --enable-static --host=$(CHOST) --disable-xmltools --disable-largefile + cd $(DJVUDIR)/build && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ../configure --disable-desktopfiles --disable-shared --enable-static --host=$(CHOST) --disable-xmltools --disable-largefile endif $(MAKE) -C $(DJVUDIR)/build From 42e66cc605d16b2c9302cb92837f984c7de0e8b8 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 15:57:52 +0200 Subject: [PATCH 18/20] Yep, -mno-unaligned-access is definitely needed with a GCC 4.7 ToolChain, the kernel used on FW 2.x is too old to handle unaligned accesses properly. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 74ad8c224..9a8843a89 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer # Use this for debugging: #BASE_CFLAGS:=-O0 -g # Misc GCC tricks to ensure backward compatibility with the K2, even when using a fairly recent TC (Linaro/MG). -# NOTE: Right now, -mno-unaligned-access is not needed, but it probably will (for FW 2.x) be once MG moves to GCC 4.7. +# NOTE: -mno-unaligned-access is needed for Linaro 4.6/4.7 and GCC 4.7 TC, or weird crap happens on FW 2.x. We unfortunately can't set it by default, since it's a new flag. ARM_BACKWARD_COMPAT_CFLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only ARM_BACKWARD_COMPAT_CXXFLAGS:=-fno-use-cxa-atexit ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm From d60504ef8362bea09071a766c43956e71fdb81dc Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 3 Oct 2012 16:07:03 +0200 Subject: [PATCH 19/20] More comments on the whole unaligned access mess on FW 2.x. Don't even think about setting the alignment trap to a mode that includes warn, that simply kills the performance because of the storm of faults the syslog gets... --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9a8843a89..0f27d4a1a 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,9 @@ BASE_CFLAGS:=-O2 -ffast-math -pipe -fomit-frame-pointer # Use this for debugging: #BASE_CFLAGS:=-O0 -g # Misc GCC tricks to ensure backward compatibility with the K2, even when using a fairly recent TC (Linaro/MG). -# NOTE: -mno-unaligned-access is needed for Linaro 4.6/4.7 and GCC 4.7 TC, or weird crap happens on FW 2.x. We unfortunately can't set it by default, since it's a new flag. +# NOTE: -mno-unaligned-access is needed for TC based on Linaro 4.6/4.7 or GCC 4.7, or weird crap happens on FW 2.x. We unfortunately can't set it by default, since it's a new flag. +# A possible workaround would be to set the alignment trap to fixup (echo 2 > /proc/cpu/alignment) in the launch script, but that's terribly ugly, and might severly nerf performance... +# That said, MG 2012.03 is still using GCC 4.6.3, so we're good ;). ARM_BACKWARD_COMPAT_CFLAGS:=-fno-stack-protector -U_FORTIFY_SOURCE -D_GNU_SOURCE -fno-finite-math-only ARM_BACKWARD_COMPAT_CXXFLAGS:=-fno-use-cxa-atexit ARM_ARCH:=-march=armv6j -mtune=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -marm From d551e7fb637799b2347cb7c0256ce72a8f8ab13a Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 3 Oct 2012 13:08:27 -0400 Subject: [PATCH 20/20] Cleanup crereader fonts initialization. Don't try to register the two fonts Dingbats.cff and StandardSymL.cff with crengine because it will reject them anyway. But we cannot simply remove these two fonts because they are used internally by mupdf to emulate "builtin" fonts which are mandated by Adobe PDF specification to be present in every valid implementation. --- frontend/document/credocument.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/document/credocument.lua b/frontend/document/credocument.lua index 2828ad1d4..1697fc0e8 100644 --- a/frontend/document/credocument.lua +++ b/frontend/document/credocument.lua @@ -31,9 +31,11 @@ function CreDocument:engineInit() -- we need to initialize the CRE font list local fonts = Font:getFontList() for _k, _v in ipairs(fonts) do - local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v) - if not ok then - DEBUG(err) + if _v ~= "Dingbats.cff" and _v ~= "StandardSymL.cff" then + local ok, err = pcall(cre.registerFont, Font.fontdir..'/'.._v) + if not ok then + Debug(err) + end end end