From 3bfa49bca3fbfa941d27e9da24821c0809a73c8f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 20 Aug 2012 13:53:39 +0200 Subject: Add thirdparty libraries as git submodules. jbig2dec latest freetype 2.4.10 jpeg 9 openjpeg 1.5.0 zlib 1.2.7 Update MSVC projects for thirdparty libraries as submodules. Improve thirdparty library availability checks in Makethird by checking for the existence of a README file instead of just the directory, since a checkout without active git submodules has empty directories for the third party libraries. --- .gitignore | 1 - .gitmodules | 15 ++++ Makethird | 38 +++++----- thirdparty/README | 15 ++++ thirdparty/freetype | 1 + thirdparty/jbig2dec | 1 + thirdparty/jpeg | 1 + thirdparty/openjpeg | 1 + thirdparty/zlib | 1 + win32/libmupdf-v8.vcproj | 6 +- win32/libmupdf.vcproj | 6 +- win32/libthirdparty.vcproj | 176 ++++++++++++++++++++++----------------------- 12 files changed, 151 insertions(+), 111 deletions(-) create mode 100644 .gitmodules create mode 100644 thirdparty/README create mode 160000 thirdparty/freetype create mode 160000 thirdparty/jbig2dec create mode 160000 thirdparty/jpeg create mode 160000 thirdparty/openjpeg create mode 160000 thirdparty/zlib diff --git a/.gitignore b/.gitignore index e0ac9b6c..d9dff585 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ build DerivedData generated -thirdparty cscope.* tags TAGS diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..fe4637d9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "thirdparty/jbig2dec"] + path = thirdparty/jbig2dec + url = git://git.ghostscript.com/jbig2dec.git +[submodule "thirdparty/freetype"] + path = thirdparty/freetype + url = git://git.ghostscript.com/thirdparty/freetype.git +[submodule "thirdparty/jpeg"] + path = thirdparty/jpeg + url = git://git.ghostscript.com/thirdparty/jpeg.git +[submodule "thirdparty/openjpeg"] + path = thirdparty/openjpeg + url = git://git.ghostscript.com/thirdparty/openjpeg.git +[submodule "thirdparty/zlib"] + path = thirdparty/zlib + url = git://git.ghostscript.com/thirdparty/zlib.git diff --git a/Makethird b/Makethird index 1564950f..5745763c 100644 --- a/Makethird +++ b/Makethird @@ -1,17 +1,23 @@ # GNU Makefile for third party libraries used by MuPDF # # If thirdparty libraries are supplied, they will be built as -# static libraries. Download and unzip the the mupdf-thirdparty.zip -# archive in the source directory. - -FREETYPE_DIR := $(wildcard thirdparty/freetype*) -JBIG2DEC_DIR := $(wildcard thirdparty/jbig2dec*) -JPEG_DIR := $(wildcard thirdparty/jpeg*) -OPENJPEG_DIR := $(wildcard thirdparty/openjpeg*/libopenjpeg) -ZLIB_DIR := $(wildcard thirdparty/zlib*) -V8_DIR := $(wildcard thirdparty/v8*) +# static libraries. +# +# Use 'git submodule init' and 'git submodule update' to check +# out the thirdparty libraries from git. + +FREETYPE_DIR := thirdparty/freetype +JBIG2DEC_DIR := thirdparty/jbig2dec +JPEG_DIR := thirdparty/jpeg +OPENJPEG_DIR := thirdparty/openjpeg +ZLIB_DIR := thirdparty/zlib # --- V8 --- +# +# V8 is too big to be used as a submodule. +# + +V8_DIR := $(wildcard thirdparty/v8*) ifneq "$(V8_DIR)" "" @@ -41,7 +47,7 @@ endif # --- FreeType 2 --- -ifneq "$(FREETYPE_DIR)" "" +ifneq "$(wildcard $(FREETYPE_DIR)/README)" "" CFLAGS += -I$(FREETYPE_DIR)/include LIBS := $(filter-out -lfreetype, $(LIBS)) FREETYPE_LIB := $(OUT)/libfreetype.a @@ -104,7 +110,7 @@ endif # --- JBIG2DEC --- -ifneq "$(JBIG2DEC_DIR)" "" +ifneq "$(wildcard $(JBIG2DEC_DIR)/README)" "" CFLAGS += -I$(JBIG2DEC_DIR) LIBS := $(filter-out -ljbig2dec, $(LIBS)) JBIG2DEC_LIB := $(OUT)/libjbig2dec.a @@ -133,7 +139,7 @@ endif # --- JPEG library from IJG --- -ifneq "$(JPEG_DIR)" "" +ifneq "$(wildcard $(JPEG_DIR)/README)" "" CFLAGS += -I$(JPEG_DIR) LIBS := $(filter-out -ljpeg, $(LIBS)) JPEG_LIB := $(OUT)/libjpeg.a @@ -178,8 +184,8 @@ endif # --- OpenJPEG --- -ifneq "$(OPENJPEG_DIR)" "" -CFLAGS += -I$(OPENJPEG_DIR) +ifneq "$(wildcard $(OPENJPEG_DIR)/README)" "" +CFLAGS += -I$(OPENJPEG_DIR)/libopenjpeg LIBS := $(filter-out -lopenjpeg, $(LIBS)) OPENJPEG_LIB := $(OUT)/libopenjpeg.a @@ -209,13 +215,13 @@ OPENJPEG_SRC := \ tpix_manager.c \ $(OPENJPEG_LIB): $(addprefix $(OUT)/opj_, $(OPENJPEG_SRC:%.c=%.o)) -$(OUT)/opj_%.o: $(OPENJPEG_DIR)/%.c | $(OUT) +$(OUT)/opj_%.o: $(OPENJPEG_DIR)/libopenjpeg/%.c | $(OUT) $(CC_CMD) -DOPJ_STATIC endif # --- ZLIB --- -ifneq "$(ZLIB_DIR)" "" +ifneq "$(wildcard $(ZLIB_DIR)/README)" "" CFLAGS += -I$(ZLIB_DIR) -Dverbose=-1 LIBS := $(filter-out -lz, $(LIBS)) ZLIB_LIB := $(OUT)/libz.a diff --git a/thirdparty/README b/thirdparty/README new file mode 100644 index 00000000..efd375d2 --- /dev/null +++ b/thirdparty/README @@ -0,0 +1,15 @@ +This directory holds third party libraries as git submodules. + +If the directories are empty, the makefile based build will try +to use system libraries instead. + +To set up the third party modules for building from git: + + $ git submodule init + $ git submodule update + +Then after each pull (to make sure they're up to date): + + $ git submodule update + +Do NOT edit files in the submodule checkouts unless you know what you're doing. diff --git a/thirdparty/freetype b/thirdparty/freetype new file mode 160000 index 00000000..320613ee --- /dev/null +++ b/thirdparty/freetype @@ -0,0 +1 @@ +Subproject commit 320613eeb83d0cd704de3e6adfb13dce787861bb diff --git a/thirdparty/jbig2dec b/thirdparty/jbig2dec new file mode 160000 index 00000000..7a82fc0a --- /dev/null +++ b/thirdparty/jbig2dec @@ -0,0 +1 @@ +Subproject commit 7a82fc0abd135e08875ec4941ba43e832bc1b7f3 diff --git a/thirdparty/jpeg b/thirdparty/jpeg new file mode 160000 index 00000000..219d59dc --- /dev/null +++ b/thirdparty/jpeg @@ -0,0 +1 @@ +Subproject commit 219d59dcfd0e6ce8a3d8c5510e29237f0b5078ed diff --git a/thirdparty/openjpeg b/thirdparty/openjpeg new file mode 160000 index 00000000..d456e768 --- /dev/null +++ b/thirdparty/openjpeg @@ -0,0 +1 @@ +Subproject commit d456e768044bb956142342aa2a51374239e2b367 diff --git a/thirdparty/zlib b/thirdparty/zlib new file mode 160000 index 00000000..c16b1b18 --- /dev/null +++ b/thirdparty/zlib @@ -0,0 +1 @@ +Subproject commit c16b1b18ddaaf090caf321af831bccac6381a381 diff --git a/win32/libmupdf-v8.vcproj b/win32/libmupdf-v8.vcproj index 45f7f7b9..2899fe59 100644 --- a/win32/libmupdf-v8.vcproj +++ b/win32/libmupdf-v8.vcproj @@ -41,7 +41,7 @@ @@ -398,43 +398,43 @@ Name="libz" > @@ -442,95 +442,95 @@ Name="libopenjpeg" > @@ -538,90 +538,90 @@ Name="libfreetype" > -- cgit v1.2.3