mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
Add openjpeg, jbig2dec, and mupdf to libports
MuPDF is a fast and versatile PDF rendering library with only a few dependencies. It depends on openjpeg (JPEG2000 codec) and jbig2dec (b/w image compression library). Therefore, this patch comprises the ports of these libraries as well. All libraries compile well in the Genode build system but are not tested yet.
This commit is contained in:
parent
e5ac9422e7
commit
326a2483f0
4
.gitignore
vendored
4
.gitignore
vendored
@ -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
|
||||
|
1
libports/lib/import/import-jbig2dec.mk
Normal file
1
libports/lib/import/import-jbig2dec.mk
Normal file
@ -0,0 +1 @@
|
||||
REP_INC_DIR += include/jbig2dec
|
1
libports/lib/import/import-mupdf.mk
Normal file
1
libports/lib/import/import-mupdf.mk
Normal file
@ -0,0 +1 @@
|
||||
REP_INC_DIR += include/mupdf
|
1
libports/lib/import/import-openjpeg.mk
Normal file
1
libports/lib/import/import-openjpeg.mk
Normal file
@ -0,0 +1 @@
|
||||
REP_INC_DIR += include/openjpeg
|
16
libports/lib/mk/jbig2dec.mk
Normal file
16
libports/lib/mk/jbig2dec.mk
Normal file
@ -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)
|
16
libports/lib/mk/mupdf.mk
Normal file
16
libports/lib/mk/mupdf.mk
Normal file
@ -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
|
44
libports/lib/mk/openjpeg.mk
Normal file
44
libports/lib/mk/openjpeg.mk
Normal file
@ -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 <stdlib.h>" > $@
|
||||
$(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
|
29
libports/ports/jbig2dec.mk
Normal file
29
libports/ports/jbig2dec.mk
Normal file
@ -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)
|
98
libports/ports/mupdf.mk
Normal file
98
libports/ports/mupdf.mk
Normal file
@ -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
|
||||
|
29
libports/ports/openjpeg.mk
Normal file
29
libports/ports/openjpeg.mk
Normal file
@ -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)
|
5
libports/src/test/libports/jbig2dec/target.mk
Normal file
5
libports/src/test/libports/jbig2dec/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = test-jbig2dec
|
||||
LIBS = cxx env jbig2dec
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
5
libports/src/test/libports/mupdf/target.mk
Normal file
5
libports/src/test/libports/mupdf/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = test-mupdf
|
||||
LIBS = cxx env mupdf
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
5
libports/src/test/libports/openjpeg/target.mk
Normal file
5
libports/src/test/libports/openjpeg/target.mk
Normal file
@ -0,0 +1,5 @@
|
||||
TARGET = test-openjpeg
|
||||
LIBS = cxx env openjpeg
|
||||
SRC_CC = main.cc
|
||||
|
||||
vpath main.cc $(PRG_DIR)/..
|
Loading…
Reference in New Issue
Block a user