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
|
void reqzip(int compress, string dest, string src)
{
list files;
int idx;
string file;
files = strtok(src, " ");
for (idx = sizeof(files); idx--; )
{
file = element(idx, files);
if (compress)
run("gzip -9 < " + file + " > " + dest + file + ".gz");
else
run("cp " + file + " " + dest + file);
}
}
#define COMPRESS 1
void install(int compress, string root)
{
if (root != "")
{
md(root);
root = chdir(root);
}
chdir(g_cwd);
md(root + DOC);
md(root + MAN + "/man7");
reqzip(COMPRESS, root + DOC + "/",
"README README.papersize COPYING README.legalese changelog");
chdir("tmp/man");
reqzip(COMPRESS, root + MAN + "/man7/", "c++-annotations.7");
chdir("../../tmp/docs/txt");
reqzip(compress, root + DOC + "/", "cplusplus.txt");
chdir(g_cwd);
if (compress)
{
chdir("tmp/docs");
run("zip -r " + root + DOC + "/cplusplus.html.zip html");
run("zip " + root + DOC + "/cplusplus.ps.zip latex/cplusplus*.ps");
run("zip " + root + DOC + "/cplusplus.pdf.zip latex/cplusplus*.pdf");
run("zip -r " + root + DOC + "/cplusplus.latex.zip latex/*"
" -x cplusplus\*.pdf -x cplusplus\*ps");
}
else
{
chdir(g_cwd);
run("cp -r tmp/docs/html " + root + DOC);
run("cp -r tmp/docs/latex " + root + DOC);
chdir(root + DOC);
md("ps pdf");
run("mv latex/*.ps ps");
run("mv latex/*.pdf pdf");
}
chdir(g_cwd);
md(root + DOC + "/contrib");
run("cp contributions/*.zip " + root + DOC + "/contrib");
chdir("contributions");
reqzip(COMPRESS, root + DOC + "/contrib/", "GGD.algorithm");
reqzip(compress, root + DOC + "/contrib/",
"chist.html chist.pdf chist.ps java_cpp_keywords.html");
printf("\n Installation completed\n");
exit(0);
}
|