Skip to content

Commit

Permalink
Update thirdparty dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Oct 14, 2020
1 parent cfd248c commit d973c82
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 41 deletions.
7 changes: 4 additions & 3 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM rust:1.43-buster
RUN apt-get update && apt-get install -y libtool \
pkg-config \
jq \
libgumbo-dev \
libdjvulibre-dev \
libharfbuzz-dev \
libsdl2-dev \
Expand All @@ -11,11 +12,11 @@ RUN apt-get update && apt-get install -y libtool \
patch
# end mupdf dependencies

# TODO:: Remove when mupdf 1.17.0 is available
# TODO:: Remove when mupdf 1.18.0 is available
# https://packages.debian.org/source/testing/mupdf
RUN cd /tmp \
&& wget -q "https://mupdf.com/downloads/archive/mupdf-1.17.0-source.tar.xz" -O - | tar -xJ \
&& cd /tmp/mupdf-1.17.0-source \
&& wget -q "https://mupdf.com/downloads/archive/mupdf-1.18.0-source.tar.xz" -O - | tar -xJ \
&& cd /tmp/mupdf-1.18.0-source \
&& make build=release libs apps \
&& make build=release prefix=usr install \
&& find usr/include usr/share usr/lib -type f -exec chmod 0644 {} + \
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn main() {
println!("cargo:rustc-link-lib=bz2");
println!("cargo:rustc-link-lib=jpeg");
println!("cargo:rustc-link-lib=png16");
println!("cargo:rustc-link-lib=gumbo");
println!("cargo:rustc-link-lib=openjp2");
println!("cargo:rustc-link-lib=jbig2dec");
}
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ case "$method" in
ln -s libfreetype.so.6 libfreetype.so
ln -s libharfbuzz.so.0 libharfbuzz.so

ln -s libgumbo.so.1 libgumbo.so
ln -s libdjvulibre.so.21 libdjvulibre.so

cd ../thirdparty
Expand Down Expand Up @@ -49,6 +50,7 @@ case "$method" in
cp thirdparty/freetype2/objs/.libs/libfreetype.so libs
cp thirdparty/harfbuzz/src/.libs/libharfbuzz.so libs

cp thirdparty/gumbo/.libs/libgumbo.so libs
cp thirdparty/djvulibre/libdjvu/.libs/libdjvulibre.so libs
cp thirdparty/mupdf/build/release/libmupdf.so libs
;;
Expand Down
1 change: 1 addition & 0 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ cp libs/libjbig2dec.so dist/libs/libjbig2dec.so.0
cp libs/libfreetype.so dist/libs/libfreetype.so.6
cp libs/libharfbuzz.so dist/libs/libharfbuzz.so.0

cp libs/libgumbo.so dist/libs/libgumbo.so.1
cp libs/libdjvulibre.so dist/libs/libdjvulibre.so.21
cp libs/libmupdf.so dist/libs

Expand Down
2 changes: 1 addition & 1 deletion doc/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ rustup target add arm-unknown-linux-gnueabihf

## Developer Tools

Install the required dependencies: *MuPDF 1.17.0*, *DjVuLibre*, *HarfBuzz*, *OpenJPEG*, *jpeg*, *jbig2dec*, *zlib*.
Install the required dependencies: *MuPDF 1.18.0*, *DjVuLibre*, *HarfBuzz*, *Gumbo*, *OpenJPEG*, *jpeg*, *jbig2dec*, *zlib*.

### Emulator

Expand Down
2 changes: 1 addition & 1 deletion src/document/mupdf_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::mem;

pub const FZ_MAX_COLORS: usize = 32;
pub const FZ_VERSION: &str = "1.17.0";
pub const FZ_VERSION: &str = "1.18.0";

pub const FZ_META_INFO_AUTHOR: &str = "info:Author";
pub const FZ_META_INFO_TITLE: &str = "info:Title";
Expand Down
7 changes: 4 additions & 3 deletions thirdparty/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ declare -A urls=(
["openjpeg"]="https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz"
["jbig2dec"]="https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs952/jbig2dec-0.18.tar.gz"
# Fonts
["freetype2"]="https://download.savannah.gnu.org/releases/freetype/freetype-2.10.2.tar.gz"
["harfbuzz"]="https://github.com/harfbuzz/harfbuzz/archive/2.6.8.tar.gz"
["freetype2"]="https://download.savannah.gnu.org/releases/freetype/freetype-2.10.3.tar.gz"
["harfbuzz"]="https://github.com/harfbuzz/harfbuzz/archive/2.7.2.tar.gz"
# Documents
["gumbo"]="https://github.com/google/gumbo-parser/archive/v0.10.1.tar.gz"
["djvulibre"]="http:https://downloads.sourceforge.net/djvu/djvulibre-3.5.27.tar.gz"
["mupdf"]="https://mupdf.com/downloads/archive/mupdf-1.17.0-source.tar.gz"
["mupdf"]="https://mupdf.com/downloads/archive/mupdf-1.18.0-source.tar.gz"
)

for name in "${@:-${!urls[@]}}" ; do
Expand Down
6 changes: 6 additions & 0 deletions thirdparty/gumbo/build-kobo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/sh

export TRIPLE=arm-linux-gnueabihf

[ -x configure ] || ./autogen.sh
./configure --host="$TRIPLE" && make
2 changes: 1 addition & 1 deletion thirdparty/mupdf/build-kobo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ BUILD_KIND=${1:-release}
make verbose=yes generate
make verbose=yes USE_SYSTEM_LIBS=yes OS=kobo "$BUILD_KIND"

arm-linux-gnueabihf-gcc -Wl,--gc-sections -o build/"$BUILD_KIND"/libmupdf.so $(find build/"$BUILD_KIND" -name '*.o' | grep -Ev '(SourceHanSerif-Regular|DroidSansFallbackFull|NotoSerifTangut|color-lcms)') -lm -L../freetype2/objs/.libs -lfreetype -L../harfbuzz/src/.libs -lharfbuzz -L../jbig2dec/.libs -ljbig2dec -L../libjpeg/.libs -ljpeg -L../openjpeg/build/bin -lopenjp2 -L../zlib -lz -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined
arm-linux-gnueabihf-gcc -Wl,--gc-sections -o build/"$BUILD_KIND"/libmupdf.so $(find build/"$BUILD_KIND" -name '*.o' | grep -Ev '(SourceHanSerif-Regular|DroidSansFallbackFull|NotoSerifTangut|color-lcms)') -lm -L../freetype2/objs/.libs -lfreetype -L../harfbuzz/src/.libs -lgumbo -L../gumbo/.libs -lharfbuzz -L../jbig2dec/.libs -ljbig2dec -L../libjpeg/.libs -ljpeg -L../openjpeg/build/bin -lopenjp2 -L../zlib -lz -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined
65 changes: 33 additions & 32 deletions thirdparty/mupdf/kobo.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -ru a/Makefile b/Makefile
--- a/Makefile 2020-05-10 12:02:22.000000000 +0200
+++ b/Makefile 2020-05-10 12:02:33.000000000 +0200
@@ -199,7 +199,7 @@
--- a/Makefile 2020-10-14 20:42:42.000000000 +0200
+++ b/Makefile 2020-10-14 20:44:31.000000000 +0200
@@ -230,7 +230,7 @@
$(THREAD_LIB) : $(THREAD_OBJ)
$(PKCS7_LIB) : $(PKCS7_OBJ)

Expand All @@ -10,7 +10,7 @@ diff -ru a/Makefile b/Makefile

# --- Main tools and viewers ---

@@ -374,7 +374,7 @@
@@ -408,7 +408,7 @@
cscope.out: cscope.files
cscope -b

Expand All @@ -20,38 +20,39 @@ diff -ru a/Makefile b/Makefile
clean:
rm -rf $(OUT)
diff -ru a/Makerules b/Makerules
--- a/Makerules 2020-05-10 12:02:22.000000000 +0200
+++ b/Makerules 2020-05-10 12:02:33.000000000 +0200
@@ -191,6 +191,34 @@
--- a/Makerules 2020-10-14 20:42:42.000000000 +0200
+++ b/Makerules 2020-10-14 20:48:40.000000000 +0200
@@ -231,6 +231,35 @@
HAVE_WIN32=yes
endif

+ifeq "$(OS)" "kobo"
+CC = arm-linux-gnueabihf-gcc
+CXX = arm-linux-gnueabihf-gcc++
+LD = arm-linux-gnueabihf-ld
+AR = arm-linux-gnueabihf-ar
+AS = arm-linux-gnueabihf-as
+CFLAGS += -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon -DTOFU_CJK_LANG -DTOFU_CJK_EXT -DFZ_ENABLE_ICC=0 -DFZ_ENABLE_JS=0
+CROSSCOMPILE=yes
+HAVE_PTHREAD := yes
+HAVE_LIBCRYPTO := no
+HAVE_X11 := no
+HAVE_GLFW := no
+SYS_PTHREAD_CFLAGS :=
+SYS_PTHREAD_LIBS := -lpthread
+SYS_FREETYPE_CFLAGS := -I../freetype2/include
+SYS_FREETYPE_LIBS := -L../freetype2/objs/.libs -lfreetype
+SYS_HARFBUZZ_CFLAGS := -I../harfbuzz/src
+SYS_HARFBUZZ_LIBS := -L../harfbuzz/src/.libs -lharfbuzz
+SYS_OPENJPEG_CFLAGS := -I../openjpeg/src/lib/openjp2
+SYS_OPENJPEG_LIBS := -L../openjpeg/build/bin -lopenjpeg
+SYS_JBIG2DEC_CFLAGS := -I../jbig2dec
+SYS_JBIG2DEC_LIBS := -L../jbig2dec/.libs -ljbig2dec
+SYS_LIBJPEG_CFLAGS := -I../libjpeg
+SYS_LIBJPEG_LIBS := -L../libjpeg/.libs -ljpeg
+SYS_ZLIB_CFLAGS := -I../zlib
+SYS_ZLIB_LIBS := -L../zlib -lz
+ CC = arm-linux-gnueabihf-gcc
+ CXX = arm-linux-gnueabihf-g++
+ LD = arm-linux-gnueabihf-ld
+ AR = arm-linux-gnueabihf-ar
+ AS = arm-linux-gnueabihf-as
+ CFLAGS += -O2 -fPIC -mcpu=cortex-a9 -mfpu=neon -DTOFU_CJK_LANG -DTOFU_CJK_EXT -DFZ_ENABLE_ICC=0 -DFZ_ENABLE_JS=0
+ HAVE_PTHREAD := yes
+ HAVE_LIBCRYPTO := no
+ HAVE_X11 := no
+ HAVE_GLFW := no
+ SYS_PTHREAD_CFLAGS :=
+ SYS_PTHREAD_LIBS := -lpthread
+ SYS_FREETYPE_CFLAGS := -I../freetype2/include
+ SYS_FREETYPE_LIBS := -L../freetype2/objs/.libs -lfreetype
+ SYS_GUMBO_CFLAGS := -I../gumbo/src
+ SYS_GUMBO_LIBS := -L../gumbo/.libs -lgumbo
+ SYS_HARFBUZZ_CFLAGS := -I../harfbuzz/src
+ SYS_HARFBUZZ_LIBS := -L../harfbuzz/src/.libs -lharfbuzz
+ SYS_OPENJPEG_CFLAGS := -I../openjpeg/src/lib/openjp2
+ SYS_OPENJPEG_LIBS := -L../openjpeg/build/bin -lopenjpeg
+ SYS_JBIG2DEC_CFLAGS := -I../jbig2dec
+ SYS_JBIG2DEC_LIBS := -L../jbig2dec/.libs -ljbig2dec
+ SYS_LIBJPEG_CFLAGS := -I../libjpeg
+ SYS_LIBJPEG_LIBS := -L../libjpeg/.libs -ljpeg
+ SYS_ZLIB_CFLAGS := -I../zlib
+ SYS_ZLIB_LIBS := -L../zlib -lz
+endif
+
# Most variables when building for iOS are set up in ios/build_libs.sh,
Expand Down

0 comments on commit d973c82

Please sign in to comment.