Compiling the GMime libraries

Compiling the GMime Libraries — How to compile GMime itself

Dependencies

GMime 4 uses Meson 1.3.0 or newer and Ninja. A C compiler, pkg-config, GLib, GObject, GIO, and GThread 2.70.2 or newer, zlib, and iconv are required. On systems without iconv in the C library, install GNU libiconv.

GPGME 1.6.0 or newer and libgpg-error provide optional OpenPGP and S/MIME support. Libidn2 2.0.0 or newer provides optional IDN conversion; GLib is used when libidn2 is disabled or unavailable. GObject introspection and vapigen provide optional language bindings. The API reference requires gtk-doc and DocBook tools.

Building and testing GMime

Builds use a separate build directory. The same commands work for a Git checkout or an unpacked source archive:

meson setup _build --prefix=/usr/local
meson compile -C _build
meson test -C _build --print-errorlogs
meson install -C _build
    

Installation may require elevated permissions when the prefix is a system directory. Packagers can stage installation with meson install -C _build --destdir DESTDIR. Verify the installed package with pkg-config --modversion gmime-4.0.

Use meson configure _build to inspect options. Configuration diagnostics are in _build/meson-logs/meson-log.txt, and test output is in _build/meson-logs/testlog.txt. Crypto tests additionally need GnuPG and the supplied test keys. Preserve the repository line endings in test fixtures.

Configuration options

The crypto, libidn, introspection, and vapi options accept auto (the default), enabled, or disabled. Enabled features require their dependencies; auto features are built when their dependencies are available. Vala bindings require introspection, which requires a shared library.

meson setup _build -Dcrypto=enabled -Dlibidn=enabled
meson configure _build -Dgtk_doc=true
meson compile -C _build gmime-doc
    

Disable test programs with -Dtests=false and examples with -Dexamples=false. Enable runtime warnings about malformed MIME with -Dmime_warnings=true. Meson's standard options support static builds (-Ddefault_library=static), coverage (-Db_coverage=true), and sanitizers (-Db_sanitize=address,undefined).

When cross-compiling without an executable wrapper, the iconv detector cannot run and the built-in platform charset aliases are used instead.