Merge "Fixed incorrect writting host_os to platform/macros for uClibc" into tizen
[platform/upstream/rpm.git] / build / rpmbuild.h
1 #ifndef _H_RPMBUILD_
2 #define _H_RPMBUILD_
3
4 /** \ingroup rpmbuild
5  * \file build/rpmbuild.h
6  *  This is the *only* module users of librpmbuild should need to include.
7  */
8
9 #include <rpm/rpmcli.h>
10 #include <rpm/rpmds.h>
11 #include <rpm/rpmspec.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /** \ingroup rpmbuild
18  * Bit(s) to control rpmSpecBuild() operation.
19  */
20 enum rpmBuildFlags_e {
21     RPMBUILD_NONE       = 0,
22     RPMBUILD_PREP       = (1 <<  0),    /*!< Execute %%prep. */
23     RPMBUILD_BUILD      = (1 <<  1),    /*!< Execute %%build. */
24     RPMBUILD_INSTALL    = (1 <<  2),    /*!< Execute %%install. */
25     RPMBUILD_CHECK      = (1 <<  3),    /*!< Execute %%check. */
26     RPMBUILD_CLEAN      = (1 <<  4),    /*!< Execute %%clean. */
27     RPMBUILD_FILECHECK  = (1 <<  5),    /*!< Check %%files manifest. */
28     RPMBUILD_PACKAGESOURCE = (1 <<  6), /*!< Create source package. */
29     RPMBUILD_PACKAGEBINARY = (1 <<  7), /*!< Create binary package(s). */
30     RPMBUILD_RMSOURCE   = (1 <<  8),    /*!< Remove source(s) and patch(s). */
31     RPMBUILD_RMBUILD    = (1 <<  9),    /*!< Remove build sub-tree. */
32     RPMBUILD_STRINGBUF  = (1 << 10),    /*!< Internal use only */
33     RPMBUILD_RMSPEC     = (1 << 11),    /*!< Remove spec file. */
34
35     RPMBUILD_NOBUILD    = (1 << 31)     /*!< Don't execute or package. */
36 };
37
38 typedef rpmFlags rpmBuildFlags;
39
40 /** \ingroup rpmbuild
41  * Bit(s) to control package generation
42  */
43 enum rpmBuildPkgFlags_e {
44     RPMBUILD_PKG_NONE           = 0,
45     RPMBUILD_PKG_NODIRTOKENS    = (1 << 0), /*!< Legacy filename layout */
46 };
47
48 typedef rpmFlags rpmBuildPkgFlags;
49
50 /** \ingroup rpmbuild
51  * Describe build request.
52  */
53 struct rpmBuildArguments_s {
54     rpmBuildPkgFlags pkgFlags;  /*!< Bit(s) to control package generation. */
55     rpmBuildFlags buildAmount;  /*!< Bit(s) to control build execution. */
56     char * buildRootOverride;   /*!< from --buildroot */
57     char * cookie;              /*!< NULL for binary, ??? for source, rpm's */
58     const char * rootdir;
59 };
60
61 /** \ingroup rpmbuild
62  */
63 typedef struct rpmBuildArguments_s *    BTA_t;
64
65 /** \ingroup rpmbuild
66  * Parse spec file into spec control structure.
67  * @todo Eliminate buildRoot from here, its a build, not spec property
68  *
69  * @param specFile      path to spec file
70  * @param flags         flags to control operation
71  * @param buildRoot     buildRoot override or NULL for default
72  * @return              new spec control structure
73  */
74 rpmSpec rpmSpecParse(const char *specFile, rpmSpecFlags flags,
75                      const char *buildRoot);
76
77 /** \ingroup rpmbuild
78  * Return the headers of the SRPM that would be built from the spec file
79  * @param spec          path to spec file
80  * @return              Header
81  */
82 Header rpmSpecSourceHeader(rpmSpec spec);
83
84 /** \ingroup rpmbuild
85  * Verify build depencies of a spec against.
86  * @param ts            (empty) transaction set
87  * @param spec          parsed spec control structure
88  * @return              rpm problem set or NULL on no problems
89  */
90 rpmps rpmSpecCheckDeps(rpmts ts, rpmSpec spec);
91
92 /** \ingroup rpmbuild
93  * Retrieve build dependency set from spec.
94  * @param spec          parsed spec control structure
95  * @param tag           dependency tag
96  * @return              dependency set of tag (or NULL)
97  */
98 rpmds rpmSpecDS(rpmSpec spec, rpmTagVal tag);
99
100 /** \ingroup rpmbuild
101  * Spec build stages state machine driver.
102  * @param spec          spec file control structure
103  * @param buildArgs     build arguments
104  * @return              RPMRC_OK on success
105  */
106 rpmRC rpmSpecBuild(rpmSpec spec, BTA_t buildArgs);
107
108 #ifdef __cplusplus
109 }
110 #endif
111
112 #endif  /* _H_RPMBUILD_ */