this repo has no description
1#!/usr/bin/perl
2#
3# Main authors:
4# Christian Schulte <schulte@gecode.org>
5#
6# Copyright:
7# Christian Schulte, 2010
8#
9# This file is part of Gecode, the generic constraint
10# development environment:
11# http://www.gecode.org
12#
13# Permission is hereby granted, free of charge, to any person obtaining
14# a copy of this software and associated documentation files (the
15# "Software"), to deal in the Software without restriction, including
16# without limitation the rights to use, copy, modify, merge, publish,
17# distribute, sublicense, and/or sell copies of the Software, and to
18# permit persons to whom the Software is furnished to do so, subject to
19# the following conditions:
20#
21# The above copyright notice and this permission notice shall be
22# included in all copies or substantial portions of the Software.
23#
24# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31#
32#
33
34
35$dlldescription{"Kernel"} = "kernel";
36$dlldescription{"Search"} = "search engines";
37$dlldescription{"Int"} = "finite domain integers";
38$dlldescription{"Set"} = "finite integer sets";
39$dlldescription{"Float"} = "floats";
40$dlldescription{"Minimodel"} = "minimal modeling support";
41$dlldescription{"Driver"} = "script commandline driver";
42$dlldescription{"FlatZinc"} = "FlatZinc interpreter library";
43$dlldescription{"Gist"} = "Gist";
44$dlldescription{"Support"} = "support algorithms and datastructures";
45
46$i = 0;
47
48# Includes Gecode version and more
49$dllsuffix = $ARGV[$i++];
50
51if ($dllsuffix =~ /-([0-9]+)-([0-9]+)-([0-9]+)-([rd])-x[0-9]+\.dll/) {
52 $revx = $1; $revy = $2; $revz = $3;
53 $mode = $4;
54}
55
56# Directory where source files reside
57$dir = $ARGV[$i++];
58
59# File for which a resource template is to be generated
60$file = $ARGV[$i++];
61
62# Source files follows from folloeing argument positions
63$n_srcfiles = 0;
64while ($arg = $ARGV[$i]) {
65 $srcfile[$n_srcfiles] = "$dir/$arg";
66 $n_srcfiles++; $i++;
67}
68
69print <<EOF
70/*
71 * CAUTION:
72 * This file has been automatically generated. Do not edit,
73 * edit the following files instead:
74 * - $dir/misc/genrc.perl
75EOF
76;
77
78for ($f=0; $f<$n_srcfiles; $f++) {
79 print " * - $srcfile[$f]\n";
80}
81
82print <<EOF
83 *
84 * This file contains generated code fragments which are
85 * copyrighted as follows:
86 *
87 * Main author:
88 * Christian Schulte <schulte\@gecode.org>
89 *
90 * Copyright:
91 * Christian Schulte, 2010
92 *
93 * The generated code fragments are part of Gecode, the generic
94 * constraint development environment:
95 * http://www.gecode.org
96 *
97 * Permission is hereby granted, free of charge, to any person obtaining
98 * a copy of this software and associated documentation files (the
99 * "Software"), to deal in the Software without restriction, including
100 * without limitation the rights to use, copy, modify, merge, publish,
101 * distribute, sublicense, and/or sell copies of the Software, and to
102 * permit persons to whom the Software is furnished to do so, subject to
103 * the following conditions:
104 *
105 * The above copyright notice and this permission notice shall be
106 * included in all copies or substantial portions of the Software.
107 *
108 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
109 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
110 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
111 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
112 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
113 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
114 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
115 *
116 */
117
118EOF
119;
120
121# Find authors for copyright from srcfiles
122for ($f=0; $f<$n_srcfiles; $f++) {
123 open SRCFILE, $srcfile[$f];
124 $incopyright = 0;
125 while ($l = <SRCFILE>) {
126 if ($incopyright) {
127 if ($l =~ /\*.*part of Gecode, the/) {
128 $incopyright = 0;
129 } elsif ($l =~ /\*\s*([^,]*)(, [0-9]+)+/) {
130 $authors{$1} = 1;
131 }
132 } elsif ($l =~ /\*.*Copyright:/) {
133 $incopyright = 1;
134 }
135 }
136 close SRCFILE;
137}
138$copyright = "";
139foreach $a (sort(keys(%authors))) {
140 $copyright = $copyright . ", " . $a;
141}
142$copyright =~ s|^, ||o;
143
144if ($file =~ /Gecode(.*)-([0-9]+-[0-9]+-[0-9]+-[rd]-.+)\.dll$/) {
145 $filename = $file;
146 $filetype = "VFT_DLL";
147 $icon = 0;
148 $basename = "Gecode$1-$2";
149 $description = "Gecode " . $dlldescription{$1};
150} else {
151 $filetype = "VFT_APP";
152 $icon = 1;
153 if ($file =~ /fzn-gecode\.exe/) {
154 $filename = "fzn-gecode.exe";
155 $basename = "fzn-gecode";
156 $description = "Gecode FlatZinc interpreter";
157 } elsif ($file =~ /test\.exe/) {
158 $filename = "test.exe";
159 $basename = "test";
160 $description = "Gecode systematic tests";
161 } elsif ($file =~ /examples\/(.+)\.exe/) {
162 $filename = "$1.exe";
163 $basename = "$1";
164 open SRCFILE, $srcfile[0];
165 $example = "";
166 while ($l = <SRCFILE>) {
167 if ($l =~ /\\brief.*Example: (.*)/) {
168 $example = $1;
169 }
170 }
171 $example =~ s|\%||og;
172 close SRCFILE;
173 $description = "Gecode example: $example";
174 } else {
175 die "Illegal file";
176 }
177}
178
179if ($mode =~ /r/) {
180 $debug = 0;
181} else {
182 $debug = "VS_FF_DEBUG";
183}
184
185
186print <<EOF
187
188#include <windows.h>
189
190EOF
191;
192
193if ($icon) {
194 print "0 ICON \"misc/gecode-logo.ico\"\n";
195}
196
197print <<EOF
198
199VS_VERSION_INFO VERSIONINFO
200FILEVERSION $revx,$revy,$revz,0
201PRODUCTVERSION $revx,$revy,$revz,0
202FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
203FILEFLAGS $debug
204FILEOS VOS_UNKNOWN
205FILETYPE $filetype
206FILESUBTYPE VFT2_UNKNOWN
207BEGIN
208 BLOCK "StringFileInfo"
209 BEGIN
210 BLOCK "040904E4"
211 BEGIN
212 VALUE "CompanyName", "Gecode team"
213 VALUE "FileDescription", "$description"
214 VALUE "FileVersion", "$revx.$revy.$revz"
215 VALUE "InternalName", "$basename"
216 VALUE "LegalCopyright", "$copyright (license information available from www.gecode.org)"
217 VALUE "OriginalFilename", "$filename"
218 VALUE "ProductName", "Gecode"
219 VALUE "ProductVersion", "$revx.$revy.$revz"
220 END
221 END
222
223 BLOCK "VarFileInfo"
224 BEGIN
225 VALUE "Translation", 0x409, 1252
226 END
227END
228
229EOF
230;
231