Mozjpeg selber kompilieren

Dieser Artikel erfordert mehr Erfahrung im Umgang mit Linux und ist daher nur für fortgeschrittene Benutzer gedacht.

Dieses Tutorial ist als praktischer Leitfaden gedacht und behandelt keine theoretischen Hintergründe. Diese werden in einer Vielzahl von anderen Dokumenten im Internet behandelt.

Für die Richtigkeit der Inhalte dieses Tutorials gebe ich keinerlei Garantie. Der hier gezeigte Weg ist nicht der einzige um ein solches System aufzusetzen, es ist lediglich, der, den ich bevorzuge.

Mozjpeg

Mozilla hat seine modifizierte JPEG-Bibliothek in Version 3.1 freigegeben.

Mozilla verfolgt mit der im März 2014 erstmals vorgestellten JPEG-Bibliothek mozjpeg das Ziel, die Ladezeit von Webseiten zu senken. Da JPEG das verbreitetste und kompatibelste Bildformat im Web ist und Fotos meist um ein Vielfaches größer sind als Texte, war das JPEG-Format ein lohnendes Ziel für die Entwickler.

Mozilla erhält bei der weiteren Entwicklung Unterstützung von Facebook. Facebook hat damit begonnen, mozjpeg zu testen, um Bilder stärker zu komprimieren und damit das Laden von Seiten zu beschleunigen. Die Vorteile von kürzeren Ladenzeiten und geringerem Datenaufkommen für Facebook sind offensichtlich. Das Unternehmen stellte Mozilla 60.000 US-Dollar zur Verfügung, die zur weiteren Verbesserung und mozjpeg beitragen sollen.

Download Source

Du kannst die aktuellste Version auf der offiziellen GitHub – Seite herunterladen.

wget https://github.com/mozilla/mozjpeg/archive/v3.1.tar.gz
tar -xvf v3.1.tar.gz

Anforderungen

Für das Kompilieren von mozjpeg sind folgende Programme erforderlich

  • autoconf 2.56 oder aktueller
  • automake 1.7 oder aktueller
  • libtool 1.4 oder aktueller
  • NASM 0.98 oder YASM (ich verwende YASM)
  • make

Mozjpeg kompilieren

Sobald die Quelle heruntergeladen und extrahiert wurden wird mit autoreconf die configure-Datei erstellt. Dann erstellen wir in der Quelle ein Build-Verzeichnis und navigieren wir zu ihm. Einmal im Build-Verzeichnis, führen wir configure aus, die das Makefile erzeugt, dass verwendet wird um das endgültige Programm zu installieren.

cd mozjpeg-3.1
autoreconf -fiv
mkdir build && cd build
sh ../configure
sudo make install

~/mozjpeg-3.1 # autoreconf -fiv

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:17: installing './ar-lib'
configure.ac:19: installing './compile'
configure.ac:22: installing './config.guess'
configure.ac:22: installing './config.sub'
configure.ac:8: installing './install-sh'
configure.ac:8: installing './missing'
Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'

mkdir build && cd build

Die komplette Liste der configure Optionen erhält man mittels sh ../configure -–help

~/mozjpeg-3.1/build # sh ../configure –help

`configure' configures mozjpeg 3.1 to adapt to many kinds of systems.

Usage: ../configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/opt/mozjpeg]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/opt/mozjpeg/bin', `/opt/mozjpeg/lib' etc.  You can specify
an installation prefix other than `/opt/mozjpeg' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/mozjpeg]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --disable-ld-version-script
                          Disable linker version script for mozjpeg (default
                          is to use linker version script if the linker
                          supports it)

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                          both]
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-sysroot=DIR Search for dependent libraries within DIR
                        (or the compiler's sysroot if not specified).
  --with-jpeg7            Emulate libjpeg v7 API/ABI (this makes mozjpeg
                          backward incompatible with libjpeg v6b.)
  --with-jpeg8            Emulate libjpeg v8 API/ABI (this makes mozjpeg
                          backward incompatible with libjpeg v6b.)
  --without-mem-srcdst    Do not include in-memory source/destination manager
                          functions when emulating the libjpeg v6b or v7
                          API/ABI
  --without-arith-enc     Do not include arithmetic encoding support
  --without-arith-dec     Do not include arithmetic decoding support
  --with-12bit            Encode/decode JPEG images with 12-bit samples
                          (implies --without-simd --without-turbojpeg
                          --without-arith-dec --without-arith-enc)
  --without-turbojpeg     Do not include the TurboJPEG wrapper library and
                          associated test programs
  --with-java             Build Java wrapper for the TurboJPEG library
  --with-gas-preprocessor Force using gas-preprocessor.pl on ARM.
  --without-simd          Do not include SIMD extensions

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  CCAS        assembler compiler command (defaults to CC)
  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  libpng_CFLAGS
              C compiler flags for libpng, overriding pkg-config
  libpng_LIBS linker flags for libpng, overriding pkg-config
  JPEG_LIB_VERSION
              libjpeg API version (62, 70, or 80)
  SO_MAJOR_VERSION
              Major version of the mozjpeg shared library (default is
              determined by the API version)
  SO_MINOR_VERSION
              Minor version of the mozjpeg shared library (default is
              determined by the API version)
  JAVAC       Java compiler command (default: javac)
  JAVACFLAGS  Java compiler flags
  JAR         Java archive command (default: jar)
  JAVA        Java runtime command (default: java)
  JNI_CFLAGS  C compiler flags needed to include jni.h (default:
              -I/System/Library/Frameworks/JavaVM.framework/Headers on OS X,
              '-I/usr/java/include -I/usr/java/include/solaris' on Solaris,
              and '-I/usr/java/default/include
              -I/usr/java/default/include/linux' on Linux)
  PKGNAME     distribution package name (default: mozjpeg)

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to the package provider.

~/mozjpeg-3.1/build # sh ../configure –with-jpeg7 –with-jpeg8

configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking the archiver (ar) interface... (cached) ar
checking build system type... x86_64-suse-linux-gnu
checking host system type... x86_64-suse-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/x86_64-suse-linux/bin/ld
checking if the linker (/usr/x86_64-suse-linux/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-suse-linux-gnu file names to x86_64-suse-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-suse-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-suse-linux/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/x86_64-suse-linux/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether compiler supports pointers to undefined structures... yes
checking whether __SUNPRO_C is declared... no
checking for pow in -lm... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libpng... no
checking for libpng... no
checking for ANSI C header files... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for string.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether char is unsigned... no
checking for inline... inline
checking for size_t... yes
checking for unsigned char... yes
checking for unsigned short... yes
checking if right shift is signed... yes
checking for memset... yes
checking for memcpy... yes
checking libjpeg API version... 8.0
checking libjpeg shared library version... 8.1.2
checking whether the linker supports version scripts... yes (GNU style)
checking whether to use version script when building mozjpeg... yes
checking for inline... inline __attribute__((always_inline))
checking whether to include arithmetic encoding support... yes
checking whether to include arithmetic decoding support... yes
checking whether to use 12-bit samples... no
checking whether to build TurboJPEG C wrapper... yes
checking whether to build TurboJPEG Java wrapper... no
checking if we have SIMD optimisations for cpu type... yes (x86_64)
checking for nasm... no
checking for nasmw... no
checking for yasm... yasm
checking for object file format of host system... ELF64
checking for object file format specifier (NAFLAGS) ... -felf64 -DELF -D__x86_64__
checking whether the assembler (yasm -felf64 -DELF -D__x86_64__) works... yes
checking whether the linker accepts assembler output... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating pkgscripts/mozjpeg.spec.tmpl
config.status: creating pkgscripts/makecygwinpkg.tmpl
config.status: creating pkgscripts/makedpkg.tmpl
config.status: creating pkgscripts/makemacpkg.tmpl
config.status: creating pkgscripts/uninstall.tmpl
config.status: creating tjbenchtest
config.status: creating libjpeg.map
config.status: creating Makefile
config.status: creating simd/Makefile
config.status: creating java/Makefile
config.status: creating md5/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating jconfig.h
config.status: jconfig.h is unchanged
config.status: creating jconfigint.h
config.status: jconfigint.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands


~/mozjpeg-3.1/build # sudo make install

Making install in java
make[1]: Entering directory '/usr/src/mozjpeg-3.1/build/java'
echo timestamp > classnoinst.stamp
make[2]: Entering directory '/usr/src/mozjpeg-3.1/build/java'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/usr/src/mozjpeg-3.1/build/java'
make[1]: Leaving directory '/usr/src/mozjpeg-3.1/build/java'
Making install in simd
make[1]: Entering directory '/usr/src/mozjpeg-3.1/build/simd'
  GEN      jsimdcfg.inc
make  install-am
make[2]: Entering directory '/usr/src/mozjpeg-3.1/build/simd'
  CC       libsimd_la-jsimd_x86_64.lo
  GEN      jfdctflt-sse-64.lo
  GEN      jccolor-sse2-64.lo
  GEN      jcgray-sse2-64.lo
  GEN      jcsample-sse2-64.lo
  GEN      jdcolor-sse2-64.lo
  GEN      jdmerge-sse2-64.lo
  GEN      jdsample-sse2-64.lo
  GEN      jfdctfst-sse2-64.lo
  GEN      jfdctint-sse2-64.lo
  GEN      jidctflt-sse2-64.lo
  GEN      jidctfst-sse2-64.lo
  GEN      jidctint-sse2-64.lo
  GEN      jidctred-sse2-64.lo
  GEN      jquantf-sse2-64.lo
  GEN      jquanti-sse2-64.lo
  CCLD     libsimd.la
make[3]: Entering directory '/usr/src/mozjpeg-3.1/build/simd'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/usr/src/mozjpeg-3.1/build/simd'
make[2]: Leaving directory '/usr/src/mozjpeg-3.1/build/simd'
make[1]: Leaving directory '/usr/src/mozjpeg-3.1/build/simd'
Making install in md5
make[1]: Entering directory '/usr/src/mozjpeg-3.1/build/md5'
  CC       md5cmp-md5cmp.o
  CC       md5cmp-md5.o
  CC       md5cmp-md5hl.o
  CCLD     md5cmp
make[2]: Entering directory '/usr/src/mozjpeg-3.1/build/md5'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/usr/src/mozjpeg-3.1/build/md5'
make[1]: Leaving directory '/usr/src/mozjpeg-3.1/build/md5'
make[1]: Entering directory '/usr/src/mozjpeg-3.1/build'
  CC       jcapimin.lo
  CC       jcapistd.lo
  CC       jccoefct.lo
  CC       jccolor.lo
  CC       jcdctmgr.lo
  CC       jcext.lo
  CC       jchuff.lo
  CC       jcinit.lo
  CC       jcmainct.lo
  CC       jcmarker.lo
  CC       jcmaster.lo
  CC       jcomapi.lo
  CC       jcparam.lo
  CC       jcphuff.lo
  CC       jcprepct.lo
  CC       jcsample.lo
  CC       jctrans.lo
  CC       jdapimin.lo
  CC       jdapistd.lo
  CC       jdatadst.lo
  CC       jdatasrc.lo
  CC       jdcoefct.lo
  CC       jdcolor.lo
  CC       jddctmgr.lo
  CC       jdhuff.lo
  CC       jdinput.lo
  CC       jdmainct.lo
  CC       jdmarker.lo
  CC       jdmaster.lo
  CC       jdmerge.lo
  CC       jdphuff.lo
  CC       jdpostct.lo
  CC       jdsample.lo
  CC       jdtrans.lo
  CC       jerror.lo
  CC       jfdctflt.lo
  CC       jfdctfst.lo
  CC       jfdctint.lo
  CC       jidctflt.lo
  CC       jidctfst.lo
  CC       jidctint.lo
  CC       jidctred.lo
  CC       jquant1.lo
  CC       jquant2.lo
  CC       jutils.lo
  CC       jmemmgr.lo
  CC       jmemnobs.lo
  CC       jaricom.lo
  CC       jcarith.lo
  CC       jdarith.lo
  CCLD     libjpeg.la
  CC       libturbojpeg_la-jcapimin.lo
  CC       libturbojpeg_la-jcapistd.lo
  CC       libturbojpeg_la-jccoefct.lo
  CC       libturbojpeg_la-jccolor.lo
  CC       libturbojpeg_la-jcdctmgr.lo
  CC       libturbojpeg_la-jcext.lo
  CC       libturbojpeg_la-jchuff.lo
  CC       libturbojpeg_la-jcinit.lo
  CC       libturbojpeg_la-jcmainct.lo
  CC       libturbojpeg_la-jcmarker.lo
  CC       libturbojpeg_la-jcmaster.lo
  CC       libturbojpeg_la-jcomapi.lo
  CC       libturbojpeg_la-jcparam.lo
  CC       libturbojpeg_la-jcphuff.lo
  CC       libturbojpeg_la-jcprepct.lo
  CC       libturbojpeg_la-jcsample.lo
  CC       libturbojpeg_la-jctrans.lo
  CC       libturbojpeg_la-jdapimin.lo
  CC       libturbojpeg_la-jdapistd.lo
  CC       libturbojpeg_la-jdatadst.lo
  CC       libturbojpeg_la-jdatasrc.lo
  CC       libturbojpeg_la-jdcoefct.lo
  CC       libturbojpeg_la-jdcolor.lo
  CC       libturbojpeg_la-jddctmgr.lo
  CC       libturbojpeg_la-jdhuff.lo
  CC       libturbojpeg_la-jdinput.lo
  CC       libturbojpeg_la-jdmainct.lo
  CC       libturbojpeg_la-jdmarker.lo
  CC       libturbojpeg_la-jdmaster.lo
  CC       libturbojpeg_la-jdmerge.lo
  CC       libturbojpeg_la-jdphuff.lo
  CC       libturbojpeg_la-jdpostct.lo
  CC       libturbojpeg_la-jdsample.lo
  CC       libturbojpeg_la-jdtrans.lo
  CC       libturbojpeg_la-jerror.lo
  CC       libturbojpeg_la-jfdctflt.lo
  CC       libturbojpeg_la-jfdctfst.lo
  CC       libturbojpeg_la-jfdctint.lo
  CC       libturbojpeg_la-jidctflt.lo
  CC       libturbojpeg_la-jidctfst.lo
  CC       libturbojpeg_la-jidctint.lo
  CC       libturbojpeg_la-jidctred.lo
  CC       libturbojpeg_la-jquant1.lo
  CC       libturbojpeg_la-jquant2.lo
  CC       libturbojpeg_la-jutils.lo
  CC       libturbojpeg_la-jmemmgr.lo
  CC       libturbojpeg_la-jmemnobs.lo
  CC       libturbojpeg_la-jaricom.lo
  CC       libturbojpeg_la-jcarith.lo
  CC       libturbojpeg_la-jdarith.lo
  CC       libturbojpeg_la-turbojpeg.lo
  CC       libturbojpeg_la-transupp.lo
  CC       libturbojpeg_la-jdatadst-tj.lo
  CC       libturbojpeg_la-jdatasrc-tj.lo
  CCLD     libturbojpeg.la
  CC       cjpeg-cdjpeg.o
  CC       cjpeg-cjpeg.o
  CC       cjpeg-rdgif.o
  CC       cjpeg-rdppm.o
  CC       cjpeg-rdswitch.o
  CC       cjpeg-rdjpeg.o
  CC       cjpeg-rdbmp.o
  CC       cjpeg-rdtarga.o
  CCLD     cjpeg
  CC       djpeg-cdjpeg.o
  CC       djpeg-djpeg.o
  CC       djpeg-rdcolmap.o
  CC       djpeg-rdswitch.o
  CC       djpeg-wrgif.o
  CC       djpeg-wrppm.o
  CC       djpeg-wrbmp.o
  CC       djpeg-wrtarga.o
  CCLD     djpeg
  CC       jpegtran.o
  CC       rdswitch.o
  CC       cdjpeg.o
  CC       transupp.o
  CCLD     jpegtran
  CC       rdjpgcom.o
  CCLD     rdjpgcom
  CC       wrjpgcom.o
  CCLD     wrjpgcom
  CC       tjbench-tjbench.o
  CC       tjbench-bmp.o
  CC       tjbench-tjutil.o
  CC       tjbench-rdbmp.o
  CC       tjbench-rdppm.o
  CC       tjbench-wrbmp.o
  CC       tjbench-wrppm.o
  CCLD     tjbench
  CC       jcstest.o
  CCLD     jcstest
  CC       jpegyuv.o
  CCLD     jpegyuv
  CC       yuvjpeg.o
  CCLD     yuvjpeg
  CC       tjunittest.o
  CC       tjutil.o
  CCLD     tjunittest
make[2]: Entering directory '/usr/src/mozjpeg-3.1/build'
 /usr/bin/mkdir -p '/opt/mozjpeg/lib64'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libjpeg.la libturbojpeg.la '/opt/mozjpeg/lib64'
libtool: install: /usr/bin/install -c .libs/libjpeg.so.8.1.2 /opt/mozjpeg/lib64/libjpeg.so.8.1.2
libtool: install: (cd /opt/mozjpeg/lib64 && { ln -s -f libjpeg.so.8.1.2 libjpeg.so.8 || { rm -f libjpeg.so.8 && ln -s libjpeg.so.8.1.2 libjpeg.so.8; }; })
libtool: install: (cd /opt/mozjpeg/lib64 && { ln -s -f libjpeg.so.8.1.2 libjpeg.so || { rm -f libjpeg.so && ln -s libjpeg.so.8.1.2 libjpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libjpeg.lai /opt/mozjpeg/lib64/libjpeg.la
libtool: install: /usr/bin/install -c .libs/libturbojpeg.so.0.1.0 /opt/mozjpeg/lib64/libturbojpeg.so.0.1.0
libtool: install: (cd /opt/mozjpeg/lib64 && { ln -s -f libturbojpeg.so.0.1.0 libturbojpeg.so.0 || { rm -f libturbojpeg.so.0 && ln -s libturbojpeg.so.0.1.0 libturbojpeg.so.0; }; })
libtool: install: (cd /opt/mozjpeg/lib64 && { ln -s -f libturbojpeg.so.0.1.0 libturbojpeg.so || { rm -f libturbojpeg.so && ln -s libturbojpeg.so.0.1.0 libturbojpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libturbojpeg.lai /opt/mozjpeg/lib64/libturbojpeg.la
libtool: install: /usr/bin/install -c .libs/libjpeg.a /opt/mozjpeg/lib64/libjpeg.a
libtool: install: chmod 644 /opt/mozjpeg/lib64/libjpeg.a
libtool: install: ranlib /opt/mozjpeg/lib64/libjpeg.a
libtool: install: /usr/bin/install -c .libs/libturbojpeg.a /opt/mozjpeg/lib64/libturbojpeg.a
libtool: install: chmod 644 /opt/mozjpeg/lib64/libturbojpeg.a
libtool: install: ranlib /opt/mozjpeg/lib64/libturbojpeg.a
libtool: finish: PATH="/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /opt/mozjpeg/lib64
----------------------------------------------------------------------
Libraries have been installed in:
   /opt/mozjpeg/lib64

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/opt/mozjpeg/bin'
  /bin/sh ./libtool   --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom tjbench '/opt/mozjpeg/bin'
libtool: install: /usr/bin/install -c .libs/cjpeg /opt/mozjpeg/bin/cjpeg
libtool: install: /usr/bin/install -c .libs/djpeg /opt/mozjpeg/bin/djpeg
libtool: install: /usr/bin/install -c .libs/jpegtran /opt/mozjpeg/bin/jpegtran
libtool: install: /usr/bin/install -c .libs/rdjpgcom /opt/mozjpeg/bin/rdjpgcom
libtool: install: /usr/bin/install -c .libs/wrjpgcom /opt/mozjpeg/bin/wrjpgcom
libtool: install: /usr/bin/install -c .libs/tjbench /opt/mozjpeg/bin/tjbench
 /usr/bin/mkdir -p '/opt/mozjpeg/doc'
 /usr/bin/install -c -m 644 ../README ../README-mozilla.txt ../README-turbo.txt ../libjpeg.txt ../structure.txt ../usage.txt ../wizard.txt '/opt/mozjpeg/doc'
 /usr/bin/mkdir -p '/opt/mozjpeg/doc'
 /usr/bin/install -c -m 644 ../example.c '/opt/mozjpeg/doc'
 /usr/bin/mkdir -p '/opt/mozjpeg/include'
 /usr/bin/install -c -m 644 ../jerror.h ../jmorecfg.h ../jpeglib.h ../turbojpeg.h '/opt/mozjpeg/include'
 /usr/bin/mkdir -p '/opt/mozjpeg/man/man1'
 /usr/bin/install -c -m 644 ../cjpeg.1 ../djpeg.1 ../jpegtran.1 ../rdjpgcom.1 ../wrjpgcom.1 '/opt/mozjpeg/man/man1'
 /usr/bin/mkdir -p '/opt/mozjpeg/include'
 /usr/bin/install -c -m 644 jconfig.h '/opt/mozjpeg/include'
make[2]: Leaving directory '/usr/src/mozjpeg-3.1/build'
make[1]: Leaving directory '/usr/src/mozjpeg-3.1/build'

Anwendung

Im Anschluss an die oben genannten Anweisungen wird mozjpeg nach / opt / mozjpeg installiert und kann durch den Aufruf jpegtran im bin-Verzeichnis verwendet werden:

/opt/mozjpeg/bin/jpegtran -copy none image.jpg > compressed.jpg

Allerdings finde ich es einfacher, den Befehl zu meinem lokalen Pfad hinzuzufügen, so dass ich von überall zugreiffen kann:

sudo ln -s /opt/mozjpeg/bin/jpegtran /usr/local/bin/mozjpeg

Nachdem wir den Link hinzugefügt haben, können wir mozjpeg von überall einfach und bequem nutzen:

mozjpeg -copy none image.jpg > compressed.jpg

In dem Verzeichnis stehen uns weitere Tools zur Verfügung:

~:/opt/mozjpeg/bin # ls -l

Jetzt bist du gefragt!

Hast du Anregungen, Ergänzungen, einen Fehler gefunden oder ist dieser Beitrag nicht mehr aktuell? Dann freue ich mich auf deinen Kommentar.