diff --git a/.gitignore b/.gitignore index 324f2ed02f..3c8b318778 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ /libports/include/ffat /libports/include/freetype /libports/include/ft2build.h +/libports/include/jbig2dec /libports/include/libc-amd64/ /libports/include/libc-arm/ /libports/include/libc-i386/ @@ -27,6 +28,7 @@ /libports/include/libpng /libports/include/lwip/lwip /libports/include/lwip/netif +/libports/include/mupdf /libports/include/ncurses/MKterm.h.awk /libports/include/ncurses/capdefaults.c /libports/include/ncurses/curses.h @@ -45,6 +47,7 @@ /libports/include/ncurses/termcap.h /libports/include/ncurses/tic.h /libports/include/ncurses/unctrl.h +/libports/include/openjpeg /libports/include/python2.6 /libports/include/readline/keymaps.h /libports/include/readline/rlstdc.h @@ -63,6 +66,7 @@ /libports/src/lib/ncurses/names.c /libports/src/lib/ncurses/unctrl.c /libports/tool/mesa/glsl +/libports/tool/mupdf /ports-foc/contrib /ports-okl4/contrib /ports-okl4/download diff --git a/libports/lib/import/import-jbig2dec.mk b/libports/lib/import/import-jbig2dec.mk new file mode 100644 index 0000000000..cdd042f5a9 --- /dev/null +++ b/libports/lib/import/import-jbig2dec.mk @@ -0,0 +1 @@ +REP_INC_DIR += include/jbig2dec diff --git a/libports/lib/import/import-mupdf.mk b/libports/lib/import/import-mupdf.mk new file mode 100644 index 0000000000..a4ae187896 --- /dev/null +++ b/libports/lib/import/import-mupdf.mk @@ -0,0 +1 @@ +REP_INC_DIR += include/mupdf diff --git a/libports/lib/import/import-openjpeg.mk b/libports/lib/import/import-openjpeg.mk new file mode 100644 index 0000000000..e69ba1ea97 --- /dev/null +++ b/libports/lib/import/import-openjpeg.mk @@ -0,0 +1 @@ +REP_INC_DIR += include/openjpeg diff --git a/libports/lib/mk/jbig2dec.mk b/libports/lib/mk/jbig2dec.mk new file mode 100644 index 0000000000..dcf35c6336 --- /dev/null +++ b/libports/lib/mk/jbig2dec.mk @@ -0,0 +1,16 @@ +JBIG2DEC = jbig2dec-0.11 +JBIG2DEC_DIR = $(REP_DIR)/contrib/$(JBIG2DEC) +LIBS += libc libpng zlib +INC_DIR += $(JBIG2DEC_DIR) $(REP_DIR)/include/jbig2dec + +# incorporate all '*.c' files except those that are not part of the library +FILTER_OUT = jbig2dec.c snprintf.c +SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(JBIG2DEC_DIR)/*.c))) + +# definitions normally provided by a config.h file +CC_OPT += -DHAVE_STRING_H -DHAVE_STDINT_H + +# disable warning noise for contrib code +CC_WARN = -Wno-deprecated-declarations + +vpath %.c $(JBIG2DEC_DIR) diff --git a/libports/lib/mk/mupdf.mk b/libports/lib/mk/mupdf.mk new file mode 100644 index 0000000000..625fcff8dd --- /dev/null +++ b/libports/lib/mk/mupdf.mk @@ -0,0 +1,16 @@ +MUPDF = mupdf-0.9 +MUPDF_DIR = $(REP_DIR)/contrib/$(MUPDF) +LIBS += libc jpeg zlib jbig2dec openjpeg freetype +INC_DIR += $(addprefix $(MUPDF_DIR)/,fitz pdf xps) + +SRC_C = $(addprefix fitz/,$(notdir $(wildcard $(MUPDF_DIR)/fitz/*.c))) +SRC_C += $(addprefix pdf/, $(notdir $(wildcard $(MUPDF_DIR)/pdf/*.c))) +SRC_C += $(addprefix xps/, $(notdir $(wildcard $(MUPDF_DIR)/xps/*.c))) +SRC_C += $(addprefix draw/,$(notdir $(wildcard $(MUPDF_DIR)/draw/*.c))) + +# disable warning noise for contrib code +CC_WARN += -Wall -Wno-uninitialized -Wno-unused-but-set-variable + +vpath %.c $(MUPDF_DIR) + +SHARED_LIB = yes diff --git a/libports/lib/mk/openjpeg.mk b/libports/lib/mk/openjpeg.mk new file mode 100644 index 0000000000..27cc840234 --- /dev/null +++ b/libports/lib/mk/openjpeg.mk @@ -0,0 +1,44 @@ +OPENJPEG = openjpeg-1.4 +OPENJPEG_DIR = $(REP_DIR)/contrib/$(OPENJPEG)/libopenjpeg +LIBS += libc libm +INC_DIR += $(OPENJPEG_DIR) $(REP_DIR)/include/openjpeg + +# incorporate all '*.c' files except those that are not part of the library +FILTER_OUT = t1_generate_luts.c +SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(OPENJPEG_DIR)/*.c))) + +# disable warning noise for contrib code +CC_WARN = -Wno-unused-but-set-variable + +vpath %.c $(OPENJPEG_DIR) + + +# +# Provide 'opj_config.h' file normally created by the configure process +# +opj_config.h: + $(VERBOSE)echo "#define PACKAGE_VERSION \"1.4.0\"" > $@ + +$(SRC_C): opj_config.h + +clean: clean_opj_config_h + + +# +# 'malloc.h' is deprecated, yet still included by libopenjpeg, so that we have +# to provide a dummy implementation here. +# +malloc.h: + $(VERBOSE)echo "#include " > $@ + $(VERBOSE)echo "#undef HAVE_MEMALIGN" >> $@ + +$(SRC_C): malloc.h + +clean: clean_malloc_h + + +clean_malloc_h clean_opj_config_h: + $(VERBOSE)rm -f malloc.h + + +SHARED_LIB = yes diff --git a/libports/ports/jbig2dec.mk b/libports/ports/jbig2dec.mk new file mode 100644 index 0000000000..680980f471 --- /dev/null +++ b/libports/ports/jbig2dec.mk @@ -0,0 +1,29 @@ +JBIG2DEC = jbig2dec-0.11 +JBIG2DEC_TGZ = $(JBIG2DEC).tar.gz +JBIG2DEC_URL = http://ghostscript.com/~giles/jbig2/jbig2dec/$(JBIG2DEC_TGZ) + +# +# Interface to top-level prepare Makefile +# +PORTS += $(JBIG2DEC) + +prepare-jbig2dec: $(CONTRIB_DIR)/$(JBIG2DEC) include/jbig2dec/jbig2.h + +$(CONTRIB_DIR)/$(JBIG2DEC): clean-jbig2dec + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(JBIG2DEC_TGZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(JBIG2DEC_URL) && touch $@ + +$(CONTRIB_DIR)/$(JBIG2DEC): $(DOWNLOAD_DIR)/$(JBIG2DEC_TGZ) + $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ + +include/jbig2dec/jbig2.h: + $(VERBOSE)mkdir -p $(dir $@) + $(VERBOSE)ln -s ../../$(CONTRIB_DIR)/$(JBIG2DEC)/jbig2.h $@ + +clean-jbig2dec: + $(VERBOSE)rm -rf include/jbig2dec + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(JBIG2DEC) diff --git a/libports/ports/mupdf.mk b/libports/ports/mupdf.mk new file mode 100644 index 0000000000..687c3427c6 --- /dev/null +++ b/libports/ports/mupdf.mk @@ -0,0 +1,98 @@ +MUPDF := mupdf-0.9 +MUPDF_TGZ := mupdf-0.9.tar.gz +MUPDF_URL := http://mupdf.googlecode.com/files/mupdf-0.9-source.tar.gz +MUPDF_DIR := $(CONTRIB_DIR)/$(MUPDF) + +# +# Interface to top-level prepare Makefile +# +PORTS += $(MUPDF) + +prepare-mupdf: $(CONTRIB_DIR)/$(MUPDF) + +$(CONTRIB_DIR)/$(MUPDF): clean-mupdf + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(MUPDF_TGZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) -O $@ $(MUPDF_URL) && touch $@ + +$(CONTRIB_DIR)/$(MUPDF): $(DOWNLOAD_DIR)/$(MUPDF_TGZ) + $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ + +clean-mupdf: clean-mupdf_contrib +clean-mupdf_contrib: + $(VERBOSE)rm -rf $(MUPDF_DIR) + +# +# Install public headers to 'include/mupdf/' +# +MUPDF_INC_DIR := include/mupdf +MUPDF_INC_FILES := $(addprefix $(MUPDF_INC_DIR)/,mupdf.h fitz.h muxps.h) + +prepare-mupdf: $(MUPDF_INC_FILES) + +$(MUPDF_INC_FILES): $(MUPDF_INC_DIR) + +$(MUPDF_INC_DIR): + $(VERBOSE)mkdir -p $@ + +include/mupdf/mupdf.h: + $(VERBOSE)ln -s ../../$(MUPDF_DIR)/pdf/mupdf.h $@ +include/mupdf/muxps.h: + $(VERBOSE)ln -s ../../$(MUPDF_DIR)/xps/muxps.h $@ +include/mupdf/fitz.h: + $(VERBOSE)ln -s ../../$(MUPDF_DIR)/fitz/fitz.h $@ + +clean-mupdf: clean-mupdf_include +clean-mupdf_include: + $(VERBOSE)rm -rf include/mupdf + +# +# Compile tools used to create generated header files +# +MUPDF_FONTDUMP = tool/mupdf/fontdump +MUPDF_CMAPDUMP = tool/mupdf/cmapdump + +prepare-mupdf: $(MUPDF_FONTDUMP) $(MUPDF_CMAPDUMP) + +$(MUPDF_FONTDUMP) $(MUPDF_CMAPDUMP): $(MUPDF_DIR) + $(VERBOSE)mkdir -p $(dir $@) + $(VERBOSE)gcc $(addprefix -I$(MUPDF_DIR)/,fitz pdf) $(MUPDF_DIR)/scripts/$(notdir $@).c -o $@ + +clean-mupdf: clean-mupdf_tool +clean-mupdf_tool: + $(VERBOSE)rm -rf tool/mupdf + +# +# Create generated (lib-internal) header files +# +MUPDF_GEN_DIR := $(MUPDF_DIR)/generated +MUPDF_GEN_FILES := $(addprefix $(MUPDF_GEN_DIR)/,cmap_cns.h cmap_gb.h cmap_japan.h cmap_korea.h font_base14.h font_droid.h font_cjk.h) + +$(MUPDF_GEN_FILES): $(MUPDF_FONTDUMP) $(MUPDF_CMAPDUMP) +$(MUPDF_GEN_FILES): $(MUPDF_GEN_DIR) + +prepare-mupdf: $(MUPDF_GEN_FILES) + +$(MUPDF_GEN_DIR): + $(VERBOSE)mkdir -p $@ + +MUPDF_ABS_DIR = $(realpath $(MUPDF_DIR)) + +$(MUPDF_DIR)/generated/cmap_cns.h: + $(VERBOSE)$(MUPDF_CMAPDUMP) $@ $(MUPDF_ABS_DIR)/cmaps/cns/* +$(MUPDF_DIR)/generated/cmap_gb.h: + $(VERBOSE)$(MUPDF_CMAPDUMP) $@ $(MUPDF_ABS_DIR)/cmaps/gb/* +$(MUPDF_DIR)/generated/cmap_japan.h: + $(VERBOSE)$(MUPDF_CMAPDUMP) $@ $(MUPDF_ABS_DIR)/cmaps/japan/* +$(MUPDF_DIR)/generated/cmap_korea.h: + $(VERBOSE)$(MUPDF_CMAPDUMP) $@ $(MUPDF_ABS_DIR)/cmaps/korea/* +$(MUPDF_DIR)/generated/font_base14.h: + $(VERBOSE)$(MUPDF_FONTDUMP) $@ $(MUPDF_ABS_DIR)/fonts/*.cff +$(MUPDF_DIR)/generated/font_droid.h: + $(VERBOSE)$(MUPDF_FONTDUMP) $@ $(addprefix $(MUPDF_ABS_DIR)/fonts/droid/,DroidSans.ttf DroidSansMono.ttf) +$(MUPDF_DIR)/generated/font_cjk.h: + $(VERBOSE)$(MUPDF_FONTDUMP) $@ $(MUPDF_ABS_DIR)/fonts/droid/DroidSansFallback.ttf + diff --git a/libports/ports/openjpeg.mk b/libports/ports/openjpeg.mk new file mode 100644 index 0000000000..d4a02f2262 --- /dev/null +++ b/libports/ports/openjpeg.mk @@ -0,0 +1,29 @@ +OPENJPEG = openjpeg-1.4 +OPENJPEG_TGZ = openjpeg-1.4.tar.gz +OPENJPEG_URL = http://openjpeg.googlecode.com/files/openjpeg_v1_4_sources_r697.tgz + +# +# Interface to top-level prepare Makefile +# +PORTS += $(OPENJPEG) + +prepare-openjpeg: $(CONTRIB_DIR)/$(OPENJPEG) + +$(CONTRIB_DIR)/$(OPENJPEG): clean-openjpeg include/openjpeg/openjpeg.h + +# +# Port-specific local rules +# +$(DOWNLOAD_DIR)/$(OPENJPEG_TGZ): + $(VERBOSE)wget -c -P $(DOWNLOAD_DIR) -O $@ $(OPENJPEG_URL) && touch $@ + +$(CONTRIB_DIR)/$(OPENJPEG): $(DOWNLOAD_DIR)/$(OPENJPEG_TGZ) + $(VERBOSE)tar xfz $< --transform "s/openjpeg_v1_4_sources_r697/$(OPENJPEG)/" -C $(CONTRIB_DIR) && touch $@ + +include/openjpeg/openjpeg.h: + $(VERBOSE)mkdir -p $(dir $@) + $(VERBOSE)ln -s ../../$(CONTRIB_DIR)/$(OPENJPEG)/libopenjpeg/openjpeg.h $@ + +clean-openjpeg: + $(VERBOSE)rm -rf include/openjpeg + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(OPENJPEG) diff --git a/libports/src/test/libports/jbig2dec/target.mk b/libports/src/test/libports/jbig2dec/target.mk new file mode 100644 index 0000000000..d34a5d8e3e --- /dev/null +++ b/libports/src/test/libports/jbig2dec/target.mk @@ -0,0 +1,5 @@ +TARGET = test-jbig2dec +LIBS = cxx env jbig2dec +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/.. diff --git a/libports/src/test/libports/mupdf/target.mk b/libports/src/test/libports/mupdf/target.mk new file mode 100644 index 0000000000..86b0f48ec0 --- /dev/null +++ b/libports/src/test/libports/mupdf/target.mk @@ -0,0 +1,5 @@ +TARGET = test-mupdf +LIBS = cxx env mupdf +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/.. diff --git a/libports/src/test/libports/openjpeg/target.mk b/libports/src/test/libports/openjpeg/target.mk new file mode 100644 index 0000000000..5ab0e80dad --- /dev/null +++ b/libports/src/test/libports/openjpeg/target.mk @@ -0,0 +1,5 @@ +TARGET = test-openjpeg +LIBS = cxx env openjpeg +SRC_CC = main.cc + +vpath main.cc $(PRG_DIR)/..