Commit 9e9fed46 authored by Kan-Ru Chen's avatar Kan-Ru Chen

Imported Upstream version 1.9a+ds1

parent 4adcddcf
......@@ -9,6 +9,8 @@ Make* tabs
*.[chm] tabs
*.java tabs
*.xml tabs
build.xml spaces
memento.* spaces
*.vcxproj* spaces
jmem* spaces
*.gradle spaces
# Generated files:
build
generated
include/mupdf/pdf/name-table.h
source/pdf/pdf-name-table.h
tags
cscope.*
# Editor and file browser turds:
*~
.*.swp
.DS_Store
# Editor settings:
.vimrc
build
DerivedData
generated
cscope.*
*.epub
.gradle
*.xcworkspace
*.xcuserdatad
# Test files:
*.pdf
*.pnm
*.xps
*.epub
*.html
*.xhtml
tags
TAGS
*.xcworkspace
*.xcuserdatad
*.css
*.svg
# Temporary and build files:
*.class
*.jar
*.o
*.so
DerivedData
platform/win32/*.user
platform/win32/*.ncb
platform/win32/*.suo
......@@ -25,15 +43,13 @@ platform/win32/Release
platform/win32/ReleaseOpenssl
platform/win32/Memento
platform/win32/x64
thirdparty/v8-3.9
thirdparty/openssl
platform/android/obj
platform/android/bin
platform/android/libs
platform/android/gen
platform/android/jni/andprof
platform/android/local.properties
platform/android/.classpath
platform/android/.project
platform/android/.settings
docs/browse
platform/android/*/obj
platform/android/*/bin
platform/android/*/libs
platform/android/*/gen
platform/android/*/jni/andprof
platform/android/*/local.properties
platform/android/*/.classpath
platform/android/*/.project
platform/android/*/.settings
......@@ -7,6 +7,9 @@
[submodule "thirdparty/freetype"]
path = thirdparty/freetype
url = git://git.ghostscript.com/thirdparty/freetype.git
[submodule "thirdparty/harfbuzz"]
path = thirdparty/harfbuzz
url = git://git.ghostscript.com/thirdparty/harfbuzz.git
[submodule "thirdparty/jpeg"]
path = thirdparty/jpeg
url = git://git.ghostscript.com/thirdparty/jpeg.git
......@@ -16,6 +19,9 @@
[submodule "thirdparty/zlib"]
path = thirdparty/zlib
url = git://git.ghostscript.com/thirdparty/zlib.git
[submodule "thirdparty/glfw"]
path = thirdparty/glfw
url = git://git.ghostscript.com/thirdparty/glfw.git
[submodule "thirdparty/curl"]
path = thirdparty/curl
url = git://git.ghostscript.com/thirdparty/curl.git
List of changes in MuPDF 1.9
* Headline changes:
* New command line tools: create and run.
* New low-level Java interface for desktop and android.
* Bidirectional layout for Arabic and Hebrew scripts.
* Shaping complex scripts for EPUB text layout.
* Noto fallback fonts for EPUB layout.
* mutool create
Create new PDF files from scratch.
Read an annotated content stream in a text file and write a PDF file,
automatically embedding font and image resources.
* mutool run
Run javascript scripts with MuPDF bindings.
The interface is similar to the new Java interface.
* mutool draw
Optional multi-threaded operation (Windows and pthreads).
Optional low memory mode (primarily for testing).
List of changes in MuPDF 1.8
* Headline changes:
* New OpenGL-based barebones desktop viewer.
* New URW fonts with greek and cyrillic.
* 64-bit file support.
* Ghostscript proofing mode (source only; not in shipped binaries).
* EPUB improvements:
* User style sheets.
* GIF images (also for CBZ).
* Table of contents.
* CJK text.
* Page margins.
* Many bug fixes.
* Bug fixes:
* Updated FreeType to version 2.6.1.
* Various font substitution bug fixes.
* Fix setjmp/longjmp behaviour which could cause optimizing compilers to misbehave.
List of changes in MuPDF 1.7a
* Bugfixes
......
This diff is collapsed.
......@@ -5,15 +5,21 @@ OS := $(OS:MINGW%=MINGW)
OS := $(OS:Windows_NT=MINGW)
OS := $(OS:Darwin=MACOS)
HAVE_LIBDL ?= yes
CFLAGS += -Wall
ifeq "$(build)" "debug"
CFLAGS += -pipe -g -DDEBUG
LDFLAGS += -g
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -DDEBUG -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
else ifeq "$(build)" "profile"
CFLAGS += -pipe -O2 -DNDEBUG -pg
LDFLAGS += -pg
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
else ifeq "$(build)" "coverage"
CFLAGS += -pipe -g -DDEBUG -pg -fprofile-arcs -ftest-coverage
LIBS += -lgcov
......@@ -21,28 +27,49 @@ else ifeq "$(build)" "native"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -march=native -mfpmath=sse
else ifeq "$(build)" "memento"
CFLAGS += -pipe -g -DMEMENTO -DDEBUG
LDFLAGS += -g -d -rdynamic
ifeq "$(HAVE_LIBDL)" "yes"
CFLAGS += -DHAVE_LIBDL
LIBS += -ldl
endif
else ifeq "$(build)" "gperf"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -DGPERF
LIBS += -lprofiler
else
$(error unknown build setting: '$(build)')
endif
ifeq "$(largefile)" "yes"
CFLAGS += -DFZ_LARGEFILE
endif
# Windows (MINGW) build doesn't use system libraries.
ifeq "$(OS)" "MINGW"
HAVE_X11 ?= no
# Mac OS X doesn't have pkg-config so we hard code paths.
else ifeq "$(OS)" "MACOS"
HAVE_X11 ?= yes
HAVE_PTHREADS ?= yes
# Mac OS X deprecated openssl, so the default is to not include it.
HAVE_OPENSSL ?= no
SYS_OPENSSL_CFLAGS =
SYS_OPENSSL_LIBS =
ifeq "$(HAVE_OPENSSL)" "yes"
SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL
SYS_OPENSSL_LIBS = -lcrypto
endif
SYS_CURL_DEPS = -lpthread
SYS_X11_CFLAGS = -I/usr/X11R6/include
SYS_X11_LIBS = -L/usr/X11R6/lib -lX11 -lXext
SYS_FREETYPE_CFLAGS = -I/usr/X11R6/include/freetype2
SYS_FREETYPE_LIBS = -lfreetype
SYS_FREETYPE_CFLAGS = $(shell freetype-config --cflags)
SYS_FREETYPE_LIBS = $(shell freetype-config --libs)
SYS_OPENJPEG_LIBS = -lopenjpeg
SYS_JBIG2DEC_LIBS = -ljbig2dec
SYS_JPEG_LIBS = -ljpeg
......@@ -57,6 +84,7 @@ RANLIB_CMD = xcrun ranlib $@
else ifeq "$(OS)" "Linux"
HAVE_X11 ?= yes
HAVE_PTHREADS ?= yes
ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes"
SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL $(shell pkg-config --cflags libcrypto)
......@@ -73,6 +101,8 @@ SYS_CURL_DEPS = -lpthread -lrt
SYS_X11_CFLAGS = $(shell pkg-config --cflags x11 xext)
SYS_X11_LIBS = $(shell pkg-config --libs x11 xext)
SYS_HARFBUZZ_CFLAGS = $(shell pkg-config --cflags harfbuzz)
SYS_HARFBUZZ_LIBS = $(shell pkg-config --libs harfbuzz)
SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
......@@ -102,6 +132,7 @@ LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mfpu=neon -mcpu=cortex-a8 -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
CROSSCOMPILE=yes
HAVE_PTHREADS ?= yes
endif
ifeq "$(OS)" "webos-pre-cross"
......@@ -134,6 +165,26 @@ AR = x86_64-w64-mingw32-ar
CROSSCOMPILE=yes
endif
ifeq "$(OS)" "pnacl-cross"
VALID_TOOLCHAINS := pnacl
TARGET = mupdf
include $(NACL_SDK_ROOT)/tools/common.mk
CC = $(PNACL_CC)
CXX = $(PNACL_CXX)
LD = $(PNACL_LD)
AR = $(PNACL_LIB)
CFLAGS += -D__NACL__
CROSSCOMPILE=yes
# Don't install libjpeg, libz, or libfreetype, since these are already
# provided by naclports and the versions compiled here cause problems
# with nacl.
install-nacl-libs: $(OUT)/libmupdf.a $(OUT)/libmujs.a $(OUT)/libjbig2dec.a $(OUT)/libopenjpeg.a
install -d $(LIBDIR)/$(TOOLCHAIN)/$(CONFIG)/
install $(OUT)/libmupdf.a $(OUT)/libmujs.a $(OUT)/libjbig2dec.a $(OUT)/libopenjpeg.a $(LIBDIR)/$(TOOLCHAIN)/$(CONFIG)/
endif
# Most variables when building for iOS are set up in ios/build_libs.sh,
# which is called from the Xcode project as a "Run Script" build step.
# The following section works for both device and simulator builds.
......@@ -173,4 +224,10 @@ endif
# TODO: If crosscompiling, why not just call "make libs" instead of this exception?
ifeq "$(CROSSCOMPILE)" "yes"
HAVE_X11 ?= no
HAVE_GLFW ?= no
endif
ifeq "$(HAVE_PTHREADS)" "yes"
CFLAGS += -DHAVE_PTHREADS
LIBS += -lpthread
endif
......@@ -7,54 +7,27 @@
# out the thirdparty libraries from git.
FREETYPE_DIR := thirdparty/freetype
HARFBUZZ_DIR := thirdparty/harfbuzz
JBIG2DEC_DIR := thirdparty/jbig2dec
JPEG_DIR := thirdparty/jpeg
MUJS_DIR := thirdparty/mujs
OPENJPEG_DIR := thirdparty/openjpeg/libopenjpeg
OPENSSL_DIR := thirdparty/openssl
ZLIB_DIR := thirdparty/zlib
CURL_DIR := thirdparty/curl
# --- V8 ---
#
# V8 is too big to be used as a submodule.
#
V8_DIR := $(wildcard thirdparty/v8*)
ifneq "$(V8_DIR)" ""
ifeq "$(build)" "release"
V8_LIB_CHOICE := release
else ifeq "$(build)" "profile"
V8_LIB_CHOICE := release
else
V8_LIB_CHOICE := debug
endif
V8_ARCH ?= x64
# If you are building for 32bit linux use V8_ARCH=ia32
ifeq "$(OS)" "Darwin"
V8_LIBS := -L$(V8_DIR)/out-mac/$(V8_ARCH).$(V8_LIB_CHOICE)/ -lv8_base -lv8_snapshot -lstdc++
else
V8_LIBS := -L$(V8_DIR)/out/$(V8_ARCH).$(V8_LIB_CHOICE)/obj.target/tools/gyp -lv8_base -lv8_snapshot -lpthread -ldl -lstdc++
endif
V8_CFLAGS := -I$(V8_DIR)/include
HAVE_V8 := yes
endif
CURL_DIR := thirdparty/curl
GLFW_DIR := thirdparty/glfw
# --- MuJS ---
ifneq "$(wildcard $(MUJS_DIR)/README)" ""
MUJS_LIB := $(OUT)/libmujs.a
MUJS_OUT := $(OUT)/mujs
MUJS_SRC := one.c
$(MUJS_LIB): $(addprefix $(MUJS_OUT)/, $(MUJS_SRC:%.c=%.o))
MUJS_OBJ := $(addprefix $(MUJS_OUT)/, $(MUJS_SRC:%.c=%.o))
$(MUJS_OUT)/one.o: $(wildcard $(MUJS_DIR)/js*.c $(MUJS_DIR)/utf*.c $(MUJS_DIR)/regex.c $(MUJS_DIR)/*.h)
$(MUJS_OUT):
$(MKDIR_CMD)
$(MUJS_OUT)/%.o: $(MUJS_DIR)/%.c | $(MUJS_OUT)
......@@ -69,13 +42,13 @@ endif
ifneq "$(wildcard $(FREETYPE_DIR)/README)" ""
FREETYPE_LIB := $(OUT)/libfreetype.a
FREETYPE_OUT := $(OUT)/freetype
FREETYPE_SRC := \
ftbase.c \
ftbbox.c \
ftbitmap.c \
ftdebug.c \
ftfntfmt.c \
ftgasp.c \
ftglyph.c \
ftinit.c \
......@@ -83,7 +56,6 @@ FREETYPE_SRC := \
ftsynth.c \
ftsystem.c \
fttype1.c \
ftxf86.c \
cff.c \
psaux.c \
pshinter.c \
......@@ -95,8 +67,7 @@ FREETYPE_SRC := \
type1.c \
type1cid.c \
$(FREETYPE_LIB): $(addprefix $(FREETYPE_OUT)/, $(FREETYPE_SRC:%.c=%.o))
FREETYPE_OBJ := $(addprefix $(FREETYPE_OUT)/, $(FREETYPE_SRC:%.c=%.o))
$(FREETYPE_OUT):
$(MKDIR_CMD)
......@@ -134,11 +105,74 @@ FREETYPE_CFLAGS := $(SYS_FREETYPE_CFLAGS)
FREETYPE_LIBS := $(SYS_FREETYPE_LIBS)
endif
# --- HarfBuzz ---
ifneq "$(wildcard $(HARFBUZZ_DIR)/README)" ""
HARFBUZZ_OUT := $(OUT)/harfbuzz
HARFBUZZ_SRC := \
hb-blob.cc \
hb-buffer.cc \
hb-buffer-serialize.cc \
hb-common.cc \
hb-face.cc \
hb-fallback-shape.cc \
hb-font.cc \
hb-ft.cc \
hb-ot-font.cc \
hb-ot-layout.cc \
hb-ot-map.cc \
hb-ot-shape-complex-arabic.cc \
hb-ot-shape-complex-default.cc \
hb-ot-shape-complex-hangul.cc \
hb-ot-shape-complex-hebrew.cc \
hb-ot-shape-complex-indic-table.cc \
hb-ot-shape-complex-indic.cc \
hb-ot-shape-complex-myanmar.cc \
hb-ot-shape-complex-thai.cc \
hb-ot-shape-complex-tibetan.cc \
hb-ot-shape-complex-use-table.cc \
hb-ot-shape-complex-use.cc \
hb-ot-shape-fallback.cc \
hb-ot-shape-normalize.cc \
hb-ot-shape.cc \
hb-ot-tag.cc \
hb-set.cc \
hb-shape-plan.cc \
hb-shape.cc \
hb-shaper.cc \
hb-ucdn.cc \
hb-unicode.cc \
hb-warning.cc
# hb-coretext.cc
# hb-directwrite.cc
# hb-glib.cc
# hb-gobject-structs.cc
# hb-graphite2.cc
# hb-icu.cc
# hb-uniscribe.cc
HARFBUZZ_OBJ := $(addprefix $(HARFBUZZ_OUT)/, $(HARFBUZZ_SRC:%.cc=%.o))
$(HARFBUZZ_OUT):
$(MKDIR_CMD)
$(HARFBUZZ_OUT)/%.o: $(HARFBUZZ_DIR)/src/%.cc | $(HARFBUZZ_OUT)
$(CC_CMD) -DHAVE_OT -DHAVE_UCDN -DHB_NO_MT $(FREETYPE_CFLAGS) \
-Dhb_malloc_impl=hb_malloc -Dhb_calloc_impl=hb_calloc \
-Dhb_free_impl=hb_free -Dhb_realloc_impl=hb_realloc \
-fno-rtti -fno-exceptions -fvisibility-inlines-hidden --std=c++0x
HARFBUZZ_CFLAGS := -I$(HARFBUZZ_DIR)/src
else
HARFBUZZ_CFLAGS := $(SYS_HARFBUZZ_CFLAGS)
HARFBUZZ_LIBS := $(SYS_HARFBUZZ_LIBS)
endif
# --- JBIG2DEC ---