File: build

package info (click to toggle)
bobcat 6.11.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,292 kB
  • sloc: cpp: 21,370; fortran: 6,507; makefile: 2,787; sh: 724; perl: 401; ansic: 26
file content (248 lines) | stat: -rwxr-xr-x 8,063 bytes parent folder | download | duplicates (2)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/icmake -t.

#include "INSTALL.im"

#define MULTICOMP       

    // used by default in icmake/libaries
    // #define SPCH                "-n -u xerr/xerr.ih"

#define IH                  ".ih"

#define LIBRARY             "bobcat"

list g_classes;         // list of classes/directories, listed in CLASSES

int g_echo = ON;
int g_nClasses;         // number of classes/subdirectories
int g_all = 1;          // if 0: only compile the classes not requiring
                        // additional libaries. see icmake/special
int g_test;             // run in testing mode

string
    g_logPath,
    g_cwd,              // current WD, ends in /.
    g_file,             // used to store the name of a file from a list
    g_copt,             // compiler options
    g_cxx,              // compiler used
    g_sources,          // sources to be used
    g_version,          // The library's version from the file VERSION
    g_tmpliba,          // Static Library compilation target
    g_tmplibso,         // Shared Library compilation target
    g_tmphdr,           // Class header target
    g_tmpbin,           // Binary target
    g_sharedLibReq;     // libraries required by the shared lib


#include "icmake/cuteoln"
#include "icmake/backtick"
#include "icmake/run"
#include "icmake/md"

#include "icmake/getenv"
#include "icmake/clean"
#include "icmake/addclasses"
#include "icmake/special"

#include "icmake/findall"
#include "icmake/loginstall"
#include "icmake/logrecursive"
#include "icmake/logzip"

#include "icmake/uninstall"

#include "icmake/man"
#include "icmake/man1"

#include "icmake/gitlab"
#include "icmake/library"
#include "icmake/libraries"
#include "icmake/install"


void main(int argc, list argv)
{
    string option;
    string all;
    string strip;
    int keepPch = 0;
    int idx;

    for (idx = listlen(argv); idx--; )
    {
        if (argv[idx] == "-q")
        {
            g_echo = OFF;
            argv -= (list)"-q";
        }
        else if (argv[idx] == "-P")
        {
            g_gch = 0;
            argv -= (list)"-P";
        }
        else if (argv[idx] == "-p")
        {
            keepPch = 1;
            argv -= (list)"-p";
        }
        else if (strfind(argv[idx], "LOG:") == 0)
        {
            g_logPath = argv[idx];
            argv -= (list)g_logPath;
            g_logPath = substr(g_logPath, 4, strlen(g_logPath));
        }
    }

    echo(g_echo);

    g_cwd = chdir(".");

    g_tmpliba   = "tmp/liba";
    g_tmplibso  = "tmp/libso";
    g_tmphdr    = "tmp/" LIBRARY "/";
    g_tmpbin    = "tmp/bin";

    g_cxx =  setOpt(CXX, "CXX");
    g_copt = setOpt(CXXFLAGS, "CXXFLAGS");

    option = argv[1];

    if (option == "test")
        g_test = 1;

    if (option == "clean" || option == "distclean")
        clean();

    if (option == "light" || g_test)
    {
        option = "libraries";
        g_all   = 0;
        libraries(keepPch, "bobcat", 1, argv[2] == "strip", 0, 0);
    }

    if (option == "select")
    {
        if (!exists("CLASSES.bak"))
            exec("cp CLASSES CLASSES.bak");

        string subset;
        idx = 2;
        if (argv[2] == "strip")
            ++idx;

        for (int elem = listlen(argv); elem-- != idx; )
            (subset += argv[elem]) += ' ';
        system("icmake/subset.sh " + subset + "> CLASSES");
        libraries(keepPch, "bobcat", 0, idx == 3, 1, 0);
    }


        // 'all': all libraries unconditionally
        // not 'all': ask for the inclusion of additional libraries
        // g_light: do not consider the additional libraries
    if (option == "libraries")
    {
        all = argv[2];          // maybe 'all' or 'strip' or empty

        if (all == "all")       // all -> specify strip from [3]
            strip = argv[3];
        else                    // not all: defines 'strip'
            strip = all;

        libraries(keepPch, "bobcat", all == "all", strip == "strip", 0, 0);
    }

    if (option == "l")
    {
        system(P_NOCHECK, "tput clear");
        libraries(keepPch, "bobcat", 1, 0, 0, 0);
    }

    if (option == "headers")
    {
        system(P_NOCHECK, "tput clear");
        libraries(keepPch, "bobcat", 1, 0, 0, 1);
        exit(0);
    }

    if (option == "mantest")
    {
        g_test = 1;
        option = "man";
    }

    if (option == "man")
        man();

    if (option == "man1")
        man1(argv[2]);

    if (option == "gitlab")
        gitlab();

    if (option == "install")
        install(argv[2], argv[3]);

    if (option == "uninstall")
        uninstall(argv[2]);

    if (option == "dep")
    {
        system("dependencies/store");
        exit(0);
    }

    printf("Usage: build [-h -q -p -P] what\n"
        "Where\n"
        "   [-q]:   run quietly, do not show executed commands\n"
        "   [-p]:   used with build light, build libraries and build l\n"
        "           when specified, the precompiled headers are kept after\n"
        "           constructing the libraries\n"
        "   [-P]:   do not use precompiled headers\n"
        "`what' is one of:\n"
        "   clean               - clean up remnants of previous compilations\n"
        "   distclean           - same as clean\n"
        "   man                 - build the manual page (requires Yodl)\n"
        "   light [strip]       - build the bobcat(-dev) libraries without\n"
        "                         the classes requiring the Milter, X11, SSL "
                                                                    "and\n"
        "                         Readline libraries\n"
        "   libraries [all] [strip] - build the bobcat(-dev) libraries\n"
        "                         (optionally add optional classes,\n"
        "                         optionally strip the libraries)\n"
        "   l                   - same as 'libraries all', but clearing the\n"
        "                         screen before starting the compilation\n"
        "   select [strip] class ... - build libbobcat for the class(es)\n"
        "                         listed at 'class ...'. The original "
                                                                "CLASSES\n"
        "                         file is saved as CLASSES.bak\n"
        "   install [LOG:path] selection [base] -\n"
        "                         to install the software in the locations "
                                                                "defined \n"
        "                         in the INSTALL.im file, optionally below "
                                                                "base.\n"
        "                         LOG:path is optional: if specified `path' "
                                                                "is the\n"
        "                         logfile on which the installation log is "
                                                                "written.\n"
        "                         selection can be\n"
        "                               x, to install all components,\n"
        "                         or a combination of:\n"
        "                               d (documentation),\n"
        "                               h (header files),\n"
        "                               l (libraries),\n"
        "                               m (man-pages)\n"
        "   uninstall logfile   - remove files and empty directories listed\n"
        "                         in the file 'logfile'\n"
        "\n"
        "internal use only:\n"
        "   dep                 - refresh the class-dependencies overview\n"
        "   gitlab              - prepare gitlab's web-pages update\n"
        "   headers             - only create the headers in .../tmp/bobcat\n"
        "   man1 .yo-file       - build one man-page file (in /tmp)\n"
        "   mantest             - build a small subset of man-pages for\n"
        "                         testing purposes\n"
        "   test                - build one class (align) for testing\n"
        "                         purposes\n"
    );
}