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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// librpm.hpp: Wrapper for librpm header files to be passed to bindgen
//
// See "Using the RPM Library" section of "Chapter 15. Programming RPM with C"
// of the Fedora RPM Guide (Draft 0.1):
//
// https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-programming-c.html#id737996
//
// We include the header files listed in tables 16-1 and 16-2 (see
// header-specific notes in comments below).
//
// ## Why does this file have a `.hpp` extension (i.e. why a C++ binding?)
//
// This file has a `.hpp` extension to signal to bindgen to treat it (and
// the rest of the librpm header files) as C++. Though that may seem a little
// crazy, there's actually a good reason for it.
//
// Some of RPM's header files (namely `/usr/include/popt.h`, which is included
// by several important librpm headers including `rpmbuild.h`, `rpmsign.h`, and
// `rpmspec.h) define pointer typedefs for structs with the same name as the
// structs they point to, which is valid in C but not valid in C++, and
// likewise also not valid in bindgen's generated bindings for the same reason:
// they map to type aliases with the same name as the types they're aliasing.
//
// See: https://github.com/rust-lang-nursery/rust-bindgen/issues/1252
//
// By naming this file with a .hpp extension we instruct bindgen to produce a
// C++ binding instead of a C one, which triggers macro-based gating (i.e.
// `#ifdef __cplusplus`) throughout librpm's headers.
//
// Treating the headers as C++ prevents them from defining these sorts of type
// aliases and allows us to bind to more of librpm than we can using C.
//
// Additionally it resolved bindgen-generated test failures for memory
// alignment, allowing us to generate a low-level binding for all parts of
// RPM worth caring about (although FWIW that should be fixed soon in bindgen
// now that `#[repr(align(N))]` is stable.
/** RPM configuration */
/** RPM sub-system header files (from Table 16-1, omitting popt.h) */
/** RPM data object header files (from Table 16-2) */
/** On some library versions RPMTAG_NOT_FOUND is define rather than enum field,
* and bindgen can't convert it uniformly. Provide a separate constant here: */
;