8 releases

Uses old Rust 2015

0.22.5 Oct 10, 2024
0.21.4 Aug 30, 2024
0.21.3 Mar 16, 2022
0.21.2 Jul 21, 2021
0.19.8 May 23, 2018

#70 in Internationalization (i18n)

Download history 17394/week @ 2024-07-08 19488/week @ 2024-07-15 21570/week @ 2024-07-22 18012/week @ 2024-07-29 19442/week @ 2024-08-05 17609/week @ 2024-08-12 17784/week @ 2024-08-19 19366/week @ 2024-08-26 22024/week @ 2024-09-02 20550/week @ 2024-09-09 29572/week @ 2024-09-16 31089/week @ 2024-09-23 24573/week @ 2024-09-30 24742/week @ 2024-10-07 23366/week @ 2024-10-14 17599/week @ 2024-10-21

95,057 downloads per month
Used in 31 crates (2 directly)

MIT license

10MB
301 lines

gettext-sys

Raw FFI bindings for gettext. Please see documentation for details.

Licensing

On platforms that don't have a native gettext implementation, this crate compiles GNU gettext, which is licensed under LGPL. This means you have to abide by LGPL. If you don't want or can't do that, there are two ways out:

  1. in a GNU environment, enable gettext-system feature (see below);
  2. dynamically link to GNU gettext library you obtained by some other means, like a package manager. See environment variables below.

Features

  • gettext-system: if enabled, asks the crate to use the gettext implementation that's part of glibc or musl libc. This only works on:

    • Linux with glibc or musl libc;

    • Windows + GNU (e.g. MSYS2) with gettext-devel installed e.g. using:

      pacman --noconfirm -S base-devel mingw-w64-x86_64-gcc libxml2-devel tar
      
    • FreeBSD with GNU gettext installed as a package or port;

    If none of those conditions hold, the crate will proceed to building and statically linking its own copy of GNU gettext!

Environment variables

  • GETTEXT_SYSTEM: same as enabling gettext-system feature (see above).

  • GETTEXT_DIR: if specified, a directory that will be used to find gettext installation. It's expected that under this directory, the include folder has header files, the bin folder has gettext binary, and a lib folder has the runtime libraries.

  • GETTEXT_LIB_DIR: if specified, a directory that will be used to find gettext libraries. Overrides the lib folder implied by GETTEXT_DIR (if specified).

  • GETTEXT_INCLUDE_DIR: if specified, a directory that will be used to find gettext header files. Overrides the include folder implied by GETTEXT_DIR (if specified).

  • GETTEXT_BIN_DIR: if specified, a directory that will be used to find gettext binaries. Overrides the bin folder implied by GETTEXT_DIR (if specified).

  • GETTEXT_STATIC: if specified, gettext libraries will be statically rather than dynamically linked. This only affects GETTEXT_DIR and GETTEXT_*_DIR scenarios; the default behaviour and GETTEXT_SYSTEM still use static and dynamic linking respectively.

  • NUM_JOBS: sets the number of parallel build jobs.

  • TMPDIR (on Unix), TMP, TEMP, USERPROFILE (on Windows): set the parent directory for the temporary build directory.

    GNU gettext uses autotools, which don't allow some characters in paths, notably a space character. To get around that, this crate performs the build in a temporary directory which usually resides somewhere under /tmp or C:\Temp. The aforementioned env vars allow you to move the build directory elsewhere.

For target-specific configuration, each of these environment variables can be prefixed by an upper-cased target, for example, X86_64_UNKNOWN_LINUX_GNU_GETTEXT_DIR. This can be useful in cross compilation contexts.

This doesn't work on AppVeyor ATM. Use SET GETTEXT_SYSTEM=true instead.

Dependencies