add generalized expression handler (Tom Dyas<tdyas@remus.rutgers.edu>)
[platform/upstream/rpm.git] / build / rpmspec.h
1 #ifndef _H_SPEC_
2 #define _H_SPEC_
3
4 typedef struct SpecStruct *Spec;
5 #include "rpmmacro.h"
6
7 #if 0
8 struct ReqProvTrigger {
9     int flags;
10     char *name;
11     char *version;
12     int index;      /* Only used for triggers */
13     struct ReqProvTrigger *next;
14 };
15 #endif
16
17 struct TriggerFileEntry {
18     int index;
19     char *fileName;
20     char *script;
21     char *prog;
22     struct TriggerFileEntry *next;
23 };
24
25 #define RPMBUILD_ISSOURCE     1
26 #define RPMBUILD_ISPATCH     (1 << 1)
27 #define RPMBUILD_ISICON      (1 << 2)
28 #define RPMBUILD_ISNO        (1 << 3)
29
30 #define RPMBUILD_DEFAULT_LANG "C"
31
32 struct Source {
33     char *fullSource;
34     char *source;     /* Pointer into fullSource */
35     int flags;
36     int num;
37     struct Source *next;
38 };
39
40 struct ReadLevelEntry {
41     int reading;
42     struct ReadLevelEntry *next;
43 };
44
45 struct OpenFileInfo {
46     char *fileName;
47     FILE *file;
48     int lineNum;
49     char readBuf[BUFSIZ];
50     char *readPtr;
51     struct OpenFileInfo *next;
52 };
53
54 struct SpecStruct {
55     char *specFile;
56     char *sourceRpmName;
57
58     struct OpenFileInfo *fileStack;
59     char line[BUFSIZ];
60     int lineNum;
61
62     struct ReadLevelEntry *readStack;
63
64     Header buildRestrictions;
65     struct SpecStruct **buildArchitectureSpecs;
66     char ** buildArchitectures;
67     int buildArchitectureCount;
68     int inBuildArchitectures;
69
70     int gotBuildRoot;
71     char *buildRoot;
72     char *buildSubdir;
73
74     char *passPhrase;
75     int timeCheck;
76     char *cookie;
77
78     struct Source *sources;
79     int numSources;
80     int noSource;
81
82     Header sourceHeader;
83     int sourceCpioCount;
84     struct cpioFileMapping *sourceCpioList;
85
86     struct MacroContext *macros;
87
88     int autoReq;
89     int autoProv;
90
91     StringBuf prep;
92     StringBuf build;
93     StringBuf install;
94     StringBuf clean;
95
96     struct PackageStruct *packages;
97 };
98
99 struct PackageStruct {
100     Header header;
101
102     int cpioCount;
103     struct cpioFileMapping *cpioList;
104
105     struct Source *icon;
106
107     int autoReqProv;
108
109     char *preInFile;
110     char *postInFile;
111     char *preUnFile;
112     char *postUnFile;
113     char *verifyFile;
114
115     StringBuf specialDoc;
116
117 #if 0
118     struct ReqProvTrigger *triggers;
119     char *triggerScripts;
120 #endif
121
122     struct TriggerFileEntry *triggerFiles;
123
124     char *fileFile;
125     StringBuf fileList; /* If NULL, package will not be written */
126
127     struct PackageStruct *next;
128 };
129
130 typedef struct PackageStruct *Package;
131
132 #ifdef __cplusplus
133 extern "C" {
134 #endif
135
136 Spec newSpec(void);
137 void freeSpec(Spec spec);
138
139 struct OpenFileInfo * newOpenFileInfo(void);
140
141 int addSource(Spec spec, Package pkg, char *field, int tag);
142 int parseNoSource(Spec spec, char *field, int tag);
143
144 #ifdef __cplusplus
145 }
146 #endif
147
148 #endif /* _H_SPEC_ */