upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / build / win32 / win32ver.awk
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 BEGIN {
17
18   # ff bits: 1(debug), 2(prerelease), 4(patched), 8(vendor) and 32(special)
19   # debug is summed based on the /Define _DEBUG
20   # prerelease is based on the -dev extension,
21   # patched is based on a non-standard "-ver" extension, 
22   # special and vendor are toggled by their args.
23   #
24   ff = 0;
25
26   file=ARGV[1];
27   desc=ARGV[2];
28   rel_h=ARGV[3];
29
30   i = 4;
31   while (length(ARGV[i])) {
32     if (match(ARGV[i], /icon=/)) {
33       icon = substr(ARGV[i], 6);
34     }
35     if (match(ARGV[i], /vendor=/)) {
36       vendor = substr(ARGV[i], 8);
37       ff = ff + 8;
38     }
39     if (match(ARGV[i], /special=/)) {
40       special = substr(ARGV[i], 9);
41       ff = ff + 32;
42     }
43     i = i + 1
44   }
45
46   i = i - 1;
47   while (i) {
48     delete ARGV[i];
49     i = i - 1;
50   }
51
52   while ((getline < rel_h) > 0) {
53     if (match ($0, /^.*\* Copyright /)) {
54       copyright = substr($0, RLENGTH + 1);
55     }
56     if (match ($0, /^#define AP_SERVER_MAJORVERSION_NUMBER /)) {
57       ver_major = $3;
58     }
59     else if (match ($0, /^#define AP_SERVER_MINORVERSION_NUMBER /)) {
60       ver_minor = $3;
61     }
62     else if (match ($0, /^#define AP_SERVER_PATCHLEVEL_NUMBER /)) {
63       ver_patch = $3;
64     }
65     else if (match ($0, /^#define AP_SERVER_ADD_STRING +"[^"]*"/)) {
66       ver_build = substr($3, 2, length($3) - 2);
67     }
68   }
69
70   ver = ver_major "." ver_minor "." ver_patch ver_build;
71   verc = ver_major "," ver_minor "," ver_patch;
72   if (match (ver_build, /-dev/)) {
73     ff = ff + 2;
74     verc = verc "," 0;
75   } else if (!ver_build) {
76     verc = verc "," 200;
77   } else {
78     verc = verc "," 100;
79   }
80   
81   if (length(vendor)) {
82     ff = ff + 8;
83   }
84
85   if (length(icon)) {
86     print "1 ICON DISCARDABLE \"" icon "\"";
87   }
88   print "1 VERSIONINFO";
89   print " FILEVERSION " verc "";
90   print " PRODUCTVERSION " verc "";
91   print " FILEFLAGSMASK 0x3fL";
92   print "#if defined(_DEBUG)"
93   print " FILEFLAGS 0x" sprintf("%02x", ff + 1) "L";
94   print "#else"
95   print " FILEFLAGS 0x" sprintf("%02x", ff) "L";
96   print "#endif"
97   print " FILEOS 0x40004L";
98   print " FILETYPE 0x1L";
99   print " FILESUBTYPE 0x0L";
100   print "BEGIN";
101   print "  BLOCK \"StringFileInfo\"";
102   print "  BEGIN";
103   print "    BLOCK \"040904b0\"";
104   print "    BEGIN";
105   print "      VALUE \"Comments\", "\
106      "\"Licensed under the Apache License, Version 2.0 (the \"\"License\"\"); "\
107      "you may not use this file except in compliance with the License.  "\
108      "You may obtain a copy of the License at\\r\\n\\r\\n"\
109      "http://www.apache.org/licenses/LICENSE-2.0\\r\\n\\r\\n"\
110      "Unless required by applicable law or agreed to in writing, "\
111      "software distributed under the License is distributed on an "\
112      "\"\"AS IS\"\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, "\
113      "either express or implied.  See the License for the specific "\
114      "language governing permissions and limitations under the License.\\0\"";
115   print "      VALUE \"CompanyName\", \"Apache Software Foundation\\0\"";
116   print "      VALUE \"FileDescription\", \"" desc "\\0\"";
117   print "      VALUE \"FileVersion\", \"" ver "\\0\"";
118   print "      VALUE \"InternalName\", \"" file "\\0\"";
119   print "      VALUE \"LegalCopyright\", \"Copyright " copyright "\\0\"";
120   print "      VALUE \"OriginalFilename\", \"" file "\\0\"";
121   if (vendor) {
122     print "      VALUE \"PrivateBuild\", \"" vendor "\\0\"";
123   }
124   if (special) {
125     print "      VALUE \"SpecialBuild\", \"" vendor "\\0\"";
126   }
127   print "      VALUE \"ProductName\", \"Apache HTTP Server\\0\"";
128   print "      VALUE \"ProductVersion\", \"" ver "\\0\"";
129   print "    END";
130   print "  END";
131   print "  BLOCK \"VarFileInfo\"";
132   print "  BEGIN";
133   print "    VALUE \"Translation\", 0x409, 1200";
134   print "  END";
135   print "END";
136 }