@@ -3,6 +3,7 @@ require Exporter;
3
3
4
4
use strict;
5
5
use vars qw( $VERSION) ;
6
+ use Digest::SHA qw( sha256_hex) ;
6
7
7
8
our $VERSION = ' 1.00' ;
8
9
our (@ISA , @EXPORT , @EXPORT_OK , @AVAILABLE );
@@ -12,59 +13,12 @@ BEGIN {
12
13
push @EXPORT_OK , qw( generate) ;
13
14
}
14
15
15
- my $guid_index = 0;
16
- my @GUIDS = (
17
- " {E07B9989-2BF7-4F21-8918-BE22BA467AC3}" ,
18
- " {278FFB51-0296-4A44-A81A-22B87B7C3592}" ,
19
- " {7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}" ,
20
- " {67F421AC-EB34-4D49-820B-3196807B423F}" ,
21
- " {385DCFE1-CC8C-4211-A451-80FCFC31CA51}" ,
22
- " {97CC46C5-D2CC-4D26-B634-E75792B79916}" ,
23
- " {C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}" ,
24
- " {51575134-3FDF-42D1-BABD-3FB12669C6C9}" ,
25
- " {0AE195E4-9823-4B87-8E6F-20C5614AF2FF}" ,
26
- " {4B918255-67CA-43BB-A46C-26704B666E6B}" ,
27
- " {18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}" ,
28
- " {5D5D90FA-01B7-4973-AFE5-CA88C53AC197}" ,
29
- " {1F054320-036D-49E1-B384-FB5DF0BC8AC0}" ,
30
- " {7CED65EE-F2D9-4171-825B-C7D561FE5786}" ,
31
- " {8D341679-0F07-4664-9A56-3BA0DE88B9BC}" ,
32
- " {C189FEDC-2957-4BD7-9FA4-7622241EA145}" ,
33
- " {66844203-1B9F-4C53-9274-164FFF95B847}" ,
34
- " {E4FEA145-DECC-440D-AEEA-598CF381FD43}" ,
35
- " {73300A8E-C8AC-41B0-B555-4F596B681BA7}" ,
36
- " {873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}" ,
37
- " {7922C8BE-76C5-4AC6-8BF7-885C0F93B782}" ,
38
- " {E245D370-308B-4A49-BFC1-1E527827975F}" ,
39
- " {F6FA957B-66FC-4ED7-B260-E59BBE4FE813}" ,
40
- " {E6055070-0198-431A-BC49-8DB6CEE770AE}" ,
41
- " {54159234-C3EB-43DA-906B-CE5DA5C74654}" ,
42
- " {594CFC35-0B60-46F6-B8EF-9983ACC1187D}" ,
43
- " {D93FCAB7-1F01-48D2-B832-F761B83231A5}" ,
44
- " {DBA5E6AC-E7BE-42D3-8703-4E787141526E}" ,
45
- " {6171953F-DD26-44C7-A3BE-CC45F86FC11F}" ,
46
- " {9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}" ,
47
- " {AE81A615-99E3-4885-9CE0-D9CAA193E867}" ,
48
- " {FBF4067E-1855-4F6C-8BCD-4D62E801A04D}" ,
49
- " {17007948-6593-4AEB-8106-F7884B4F2C19}" ,
50
- " {199D4C8D-8639-4DA6-82EF-08668C35DEE0}" ,
51
- " {E085E50E-C140-4CF3-BE4B-094B14F0DDD6}" ,
52
- " {00785268-A9CC-4E40-AC29-BAC0019159CE}" ,
53
- " {4C06F56A-DCDB-46A6-B67C-02339935CF12}" ,
54
- " {3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}" ,
55
- " {3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}" ,
56
- " {9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}" ,
57
- " {2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}" ,
58
- " {86E216C3-43CE-481A-BCB2-BE5E62850635}" ,
59
- " {FB631291-7923-4B91-9A57-7B18FDBB7A42}" ,
60
- " {0A176EC9-E934-45B8-B87F-16C7F4C80039}" ,
61
- " {DF55CA80-46E8-4C53-B65B-4990A23DD444}" ,
62
- " {3A0F9895-55D2-4710-BE5E-AD7498B5BF44}" ,
63
- " {294BDC5A-F448-48B6-8110-DD0A81820F8C}" ,
64
- " {4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}" ,
65
- " {72EA49C6-2806-48BD-B81B-D4905102E19C}" ,
66
- " {5728EB7E-8929-486C-8CD5-3238D060E768}"
67
- );
16
+ sub generate_guid ($) {
17
+ my $hex = sha256_hex($_ [0]);
18
+ $hex =~ s / ^(.{8})(.{4})(.{4})(.{4})(.{12}).*/ {$1 -$2 -$3 -$4 -$5 }/ ;
19
+ $hex =~ tr / a-z/ A-Z/ ;
20
+ return $hex ;
21
+ }
68
22
69
23
sub generate {
70
24
my ($git_dir , $out_dir , $rel_dir , %build_structure ) = @_ ;
@@ -92,9 +46,8 @@ sub createLibProject {
92
46
$target =~ s /\/ / _/ g ;
93
47
$target =~ s /\. a// ;
94
48
95
- my $uuid = $GUIDS [ $guid_index ] ;
49
+ my $uuid = generate_guid( $libname ) ;
96
50
$$build_structure {" LIBS_${target} _GUID" } = $uuid ;
97
- $guid_index += 1;
98
51
99
52
my @srcs = sort (map (" $rel_dir \\ $_ " , @{$$build_structure {" LIBS_${libname} _SOURCES" }}));
100
53
my @sources ;
@@ -106,6 +59,8 @@ sub createLibProject {
106
59
my $includes = join (" ;" , sort (map (" "$rel_dir \\ $_ "" , @{$$build_structure {" LIBS_${libname} _INCLUDES" }})));
107
60
my $cflags = join (" " , sort (@{$$build_structure {" LIBS_${libname} _CFLAGS" }}));
108
61
$cflags =~ s /\" / "/ g ;
62
+ $cflags =~ s / </ </ g ;
63
+ $cflags =~ s / >/ >/ g ;
109
64
110
65
my $cflags_debug = $cflags ;
111
66
$cflags_debug =~ s / -MT/ -MTd/ ;
@@ -127,6 +82,8 @@ sub createLibProject {
127
82
128
83
$defines =~ s / -D// g ;
129
84
$defines =~ s /\" / \\ "/ g ;
85
+ $defines =~ s / </ </ g ;
86
+ $defines =~ s / >/ >/ g ;
130
87
$defines =~ s /\' // g ;
131
88
$includes =~ s / -I// g ;
132
89
mkdir " $target " || die " Could not create the directory $target for lib project!\n " ;
@@ -162,9 +119,6 @@ sub createLibProject {
162
119
<Tool
163
120
Name="VCXMLDataGeneratorTool"
164
121
/>
165
- <Tool
166
- Name="VCWebServiceProxyGeneratorTool"
167
- />
168
122
<Tool
169
123
Name="VCMIDLTool"
170
124
/>
@@ -228,9 +182,6 @@ sub createLibProject {
228
182
<Tool
229
183
Name="VCXMLDataGeneratorTool"
230
184
/>
231
- <Tool
232
- Name="VCWebServiceProxyGeneratorTool"
233
- />
234
185
<Tool
235
186
Name="VCMIDLTool"
236
187
/>
@@ -311,9 +262,8 @@ sub createAppProject {
311
262
$target =~ s /\/ / _/ g ;
312
263
$target =~ s /\. exe// ;
313
264
314
- my $uuid = $GUIDS [ $guid_index ] ;
265
+ my $uuid = generate_guid( $appname ) ;
315
266
$$build_structure {" APPS_${target} _GUID" } = $uuid ;
316
- $guid_index += 1;
317
267
318
268
my @srcs = sort (map (" $rel_dir \\ $_ " , @{$$build_structure {" APPS_${appname} _SOURCES" }}));
319
269
my @sources ;
@@ -325,6 +275,8 @@ sub createAppProject {
325
275
my $includes = join (" ;" , sort (map (" "$rel_dir \\ $_ "" , @{$$build_structure {" APPS_${appname} _INCLUDES" }})));
326
276
my $cflags = join (" " , sort (@{$$build_structure {" APPS_${appname} _CFLAGS" }}));
327
277
$cflags =~ s /\" / "/ g ;
278
+ $cflags =~ s / </ </ g ;
279
+ $cflags =~ s / >/ >/ g ;
328
280
329
281
my $cflags_debug = $cflags ;
330
282
$cflags_debug =~ s / -MT/ -MTd/ ;
@@ -351,6 +303,8 @@ sub createAppProject {
351
303
352
304
$defines =~ s / -D// g ;
353
305
$defines =~ s /\" / \\ "/ g ;
306
+ $defines =~ s / </ </ g ;
307
+ $defines =~ s / >/ >/ g ;
354
308
$defines =~ s /\' // g ;
355
309
$defines =~ s /\\\\ / \\ / g ;
356
310
$includes =~ s / -I// g ;
@@ -387,9 +341,6 @@ sub createAppProject {
387
341
<Tool
388
342
Name="VCXMLDataGeneratorTool"
389
343
/>
390
- <Tool
391
- Name="VCWebServiceProxyGeneratorTool"
392
- />
393
344
<Tool
394
345
Name="VCMIDLTool"
395
346
/>
@@ -458,9 +409,6 @@ sub createAppProject {
458
409
<Tool
459
410
Name="VCXMLDataGeneratorTool"
460
411
/>
461
- <Tool
462
- Name="VCWebServiceProxyGeneratorTool"
463
- />
464
412
<Tool
465
413
Name="VCMIDLTool"
466
414
/>
@@ -561,20 +509,18 @@ sub createGlueProject {
561
509
foreach (@apps ) {
562
510
$_ =~ s /\/ / _/ g ;
563
511
$_ =~ s /\. exe// ;
564
- push (@tmp , $_ );
512
+ if ($_ eq " git" ) {
513
+ unshift (@tmp , $_ );
514
+ } else {
515
+ push (@tmp , $_ );
516
+ }
565
517
}
566
518
@apps = @tmp ;
567
519
568
520
open F, " >git.sln" || die " Could not open git.sln for writing!\n " ;
569
521
binmode F, " :crlf" ;
570
522
print F " $SLN_HEAD " ;
571
- foreach (@libs ) {
572
- my $libname = $_ ;
573
- my $uuid = $build_structure {" LIBS_${libname} _GUID" };
574
- print F " $SLN_PRE " ;
575
- print F " \" ${libname} \" , \" ${libname} \\ ${libname} .vcproj\" , \" ${uuid} \" " ;
576
- print F " $SLN_POST " ;
577
- }
523
+
578
524
my $uuid_libgit = $build_structure {" LIBS_libgit_GUID" };
579
525
my $uuid_xdiff_lib = $build_structure {" LIBS_xdiff_lib_GUID" };
580
526
foreach (@apps ) {
@@ -588,6 +534,13 @@ sub createGlueProject {
588
534
print F " EndProjectSection" ;
589
535
print F " $SLN_POST " ;
590
536
}
537
+ foreach (@libs ) {
538
+ my $libname = $_ ;
539
+ my $uuid = $build_structure {" LIBS_${libname} _GUID" };
540
+ print F " $SLN_PRE " ;
541
+ print F " \" ${libname} \" , \" ${libname} \\ ${libname} .vcproj\" , \" ${uuid} \" " ;
542
+ print F " $SLN_POST " ;
543
+ }
591
544
592
545
print F << "EOM" ;
593
546
Global
@@ -599,17 +552,17 @@ EOM
599
552
print F << "EOM" ;
600
553
GlobalSection(ProjectConfigurationPlatforms) = postSolution
601
554
EOM
602
- foreach (@libs ) {
603
- my $libname = $_ ;
604
- my $uuid = $build_structure {" LIBS_ ${libname } _GUID" };
555
+ foreach (@apps ) {
556
+ my $appname = $_ ;
557
+ my $uuid = $build_structure {" APPS_ ${appname } _GUID" };
605
558
print F " \t\t ${uuid} .Debug|Win32.ActiveCfg = Debug|Win32\n " ;
606
559
print F " \t\t ${uuid} .Debug|Win32.Build.0 = Debug|Win32\n " ;
607
560
print F " \t\t ${uuid} .Release|Win32.ActiveCfg = Release|Win32\n " ;
608
561
print F " \t\t ${uuid} .Release|Win32.Build.0 = Release|Win32\n " ;
609
562
}
610
- foreach (@apps ) {
611
- my $appname = $_ ;
612
- my $uuid = $build_structure {" APPS_ ${appname } _GUID" };
563
+ foreach (@libs ) {
564
+ my $libname = $_ ;
565
+ my $uuid = $build_structure {" LIBS_ ${libname } _GUID" };
613
566
print F " \t\t ${uuid} .Debug|Win32.ActiveCfg = Debug|Win32\n " ;
614
567
print F " \t\t ${uuid} .Debug|Win32.Build.0 = Debug|Win32\n " ;
615
568
print F " \t\t ${uuid} .Release|Win32.ActiveCfg = Release|Win32\n " ;
0 commit comments