tce-load -wi compiletc glu-dev Xorg-7.7-lib-dev libjpeg-turbo-dev openjpeg-dev https://www.mupdf.com/downloads/archive/mupdf-1.23.3-source.tar.gz https://www.linuxfromscratch.org/blfs/view/svn/pst/mupdf.html cd mupdf-1.23.3-source -> Add this to top of ./include/mupdf/fitz/config.h to disable non-essential fonts: #define TOFU #define TOFU_CJK #define TOFU_EMOJI #define TOFU_HISTORIC #define TOFU_SYMBOL #define TOFU_SIL -> Despite several fonts being disabled by the above #defines, the build process will still include them in libmupdf.so unless -> they are deleted from source before compilation! (ref: https://bugs.ghostscript.com/show_bug.cgi?id=697763): for font in droid han noto sil; do rm -rf ./resources/fonts/$font done cp build-mupdf.sh ./ chmod a+x build-mupdf.sh ./build-mupdf.sh ##### the rest of this file is build-mupdf.sh ##### #!/bin/sh sed -i '/MU.*_EXE. :/{ s/\(.(MUPDF_LIB)\)\(.*\)$/\2 | \1/ N s/$/ -lmupdf -L$(OUT)/ }' Makefile cat > user.make << EOF && USE_SYSTEM_FREETYPE := yes USE_SYSTEM_HARFBUZZ := yes USE_SYSTEM_JBIG2DEC := no USE_SYSTEM_JPEGXR := no # not used without HAVE_JPEGXR USE_SYSTEM_LCMS2 := no # need lcms2-art fork USE_SYSTEM_LIBJPEG := yes USE_SYSTEM_MUJS := no # build needs source anyway USE_SYSTEM_OPENJPEG := yes USE_SYSTEM_ZLIB := yes USE_SYSTEM_GLUT := no # need freeglut2-art fork USE_SYSTEM_CURL := yes USE_SYSTEM_GUMBO := no EOF export XCFLAGS="-fPIC -flto -fuse-linker-plugin -mtune=generic -Os -pipe -fno-asynchronous-unwind-tables" && make build=release shared=yes && unset XCFLAGS mkdir /tmp/destmupdf make prefix=/tmp/destmupdf/usr/local \ shared=yes \ docdir=/tmp/destmupdf/usr/local/share/doc/mupdf-1.23.3 \ install chmod 755 /tmp/destmupdf/usr/local/lib/libmupdf.so cd /tmp/destmupdf/usr/local/bin ln -s ./mupdf-x11 ./mupdf