File: generate-bindings

package info (click to toggle)
rust-pcre2-sys 0.2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 172 kB
  • sloc: sh: 80; makefile: 4
file content (25 lines) | stat: -rwxr-xr-x 765 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

: "${PCRE2SYS_HEADER:=/usr/include/pcre2.h}"
: "${PCRE2SYS_BINDINGS:=./src/bindings.rs}"

if ! command -V bindgen > /dev/null 2>&1; then
    echo "bindgen must be installed" >&2
    echo "to install: cargo install bindgen" >&2
    exit 1
fi
if ! [ -f "$PCRE2SYS_HEADER" ]; then
    echo "PCRE2 header file at $PCRE2SYS_HEADER does not exist" >&2
    echo "Use the PCRE2SYS_HEADER environment variable to override path" >&2
    exit 1
fi

bindgen \
    "$PCRE2SYS_HEADER" \
    --ctypes-prefix '::libc' \
    --allowlist-function '^pcre2_.*' \
    --allowlist-type '^pcre2_.*' \
    --allowlist-var '^PCRE2_.*' \
    --blocklist-function '^.*_callout_.*' \
    --blocklist-type '^.*_callout_.*' \
    -- -DPCRE2_CODE_UNIT_WIDTH=8 > "$PCRE2SYS_BINDINGS"