5 releases

Uses old Rust 2015

0.2.2 Jun 9, 2019
0.2.1 Jun 2, 2019
0.2.0 Feb 19, 2019
0.1.1 Jan 14, 2019
0.1.0 Jan 13, 2019

#1184 in Encoding

Download history 89/week @ 2023-11-29 83/week @ 2023-12-06 82/week @ 2023-12-13 88/week @ 2023-12-20 119/week @ 2023-12-27 127/week @ 2024-01-03 118/week @ 2024-01-10 148/week @ 2024-01-17 50/week @ 2024-01-24 54/week @ 2024-01-31 163/week @ 2024-02-07 117/week @ 2024-02-14 122/week @ 2024-02-21 135/week @ 2024-02-28 144/week @ 2024-03-06 71/week @ 2024-03-13

490 downloads per month
Used in 10 crates (3 directly)

Apache-2.0/MIT

750KB
21K SLoC

C 17K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments Happy 882 SLoC jq 301 SLoC // 0.1% comments Liquid 237 SLoC // 0.0% comments M4 178 SLoC // 0.4% comments Automake 141 SLoC // 0.1% comments Shell 70 SLoC // 0.2% comments RPM Specfile 52 SLoC // 0.1% comments JavaScript 50 SLoC // 0.0% comments Python 20 SLoC // 0.1% comments

jq-sys

crates.io crates.io docs.rs

Generated bindings for jq 1.6.

The bindings were generated with bindgen, which is available via cargo install.

Example:

$ git submodule update --init
$ bindgen modules/jq/src/jq.h -o src/bindings.rs

Building

Using the bundled feature

When the bundled feature is enabled it will add a dependency on jq-src, which will attempt to build and link to the library. This may cover simple cases, but for anything exotic (such as cross-building), you will want to install or build libjq yourself.

Note: when using the bundled feature libjq is provided by the jq-src crate, which requires gcc, autoreconf, make, etc in your PATH to build.

Without the bundled feature

When not using the bundled feature, you'd either have to compile libjq yourself, or use libs furnished by your system package manager.

For example on debian systems, you might install libjq1 libjq-dev libonig4 libonig-dev.

The following env vars can be used to provide hints to the build script.

Name Purpose Notes
JQ_LIB_DIR Path to the location of the library.
JQ_LIB_STATIC Use static linking instead of shared.
JQ_NO_ONIG Disable linking to oniguruma for regex support.
ONIG_LIB_DIR Path to the location of the library. Defaults to JQ_LIB_DIR, ignored if JQ_NO_ONIG is set.
ONIG_LIB_STATIC Use static linking instead of shared. Ignored if JQ_NO_ONIG is set.

Note that if you are using the pkg-config feature and it is unable to locate libjq, can specify the location explicitly by setting JQ_LIB_DIR.

This may be required on debian based distros (including ubuntu) since, at the time of writing, the distro packages for jq do not include the .pc files required for pkg-config to locate the files.

Changelog

0.2.2 (2019-06-09)

0.2.1 (2019-06-01)

  • re-generated src/bindings.rs with bindgen v0.49.2.
  • Updated dependency on jq-src to v0.3.
  • Updated build.rs to avoid rebuilding jq from source more often than needed when using bundled feature (#2).

0.2.0 (2019-02-18)

Additions:

  • New env vars added to allow linkage to libjq and libonig to be customized.
  • Adds pkg-config feature (on by default) to help configure linkage, as a fallback when env vars are not set.

Breaking changes:

  • bundled feature is no longer enabled by default.

0.1.1 (2019-01-13)

Added bundled feature (on by default) to allow dependents to opt in or out from using the jq-src crate for linkage.

0.1.0 (2019-01-13)

Initial release.

Dependencies