4 if ($ARGV[0] eq '-6') {
7 elsif ($ARGV[0] eq '-5') {
10 elsif ($ARGV[0] eq '-2005') {
11 find(\&tovc2005, '.');
13 elsif ($ARGV[0] eq '-w3') {
16 elsif ($ARGV[0] eq '-w4') {
19 elsif ($ARGV[0] eq '-ia64') {
22 elsif ($ARGV[0] eq '-d') {
23 find(\&todebugpools, '.');
25 elsif ($ARGV[0] eq '-b') {
26 find(\&tobrowse, '.');
28 elsif ($ARGV[0] eq '-mt') {
31 elsif ($ARGV[0] eq '-m') {
32 ## 0 - conapp, 1 - dll lib, 2 - static lib
38 print "Specify -5 or -6 for Visual Studio 5 or 6 (98) .dsp format\n";
39 print "Specify -w3 or -w4 for .dsp build with warning level 3 or 4 (strict)\n\n";
40 print "Specify -ia64 for build targeted at Itanium (req's psdk tools)\n\n";
41 print "Specify -p for extreme pool debugging\n\n";
42 print "Specify -mt to add .manifest embedding\n\n";
43 die "Missing argument";
47 my $outpath, $outtype;
53 $srcfl = new IO::File $oname, "r" || die;
54 $dstfl = new IO::File $tname, "w" || die;
55 while ($src = <$srcfl>) {
56 if ($src =~ m|^# TARGTYPE .+ Application|) {
59 if ($src =~ m|^# TARGTYPE .+ Dynamic-Link|) {
62 if ($src =~ m|^# PROP Output_Dir "(.+)"|) {
65 $outpath =~ s|\.dsp||;
66 $outpath = ".\\" . $outdir . "\\" . $outpath . $outtype;
68 if ($src =~ m|^# ADD (BASE )?LINK32 .+ /out:"([^"]+)"|) {
71 $outpath = ".\\" . $outpath if (!($outpath =~ m|^\.|));
72 $src =~ s|/out:"([^"]+)"|/out:"$outpath"|;
74 if (defined($outpath) && ($src =~ m|^# Begin Special Build Tool|)) {
77 if (defined($outpath) && defined($outtype) && ($src =~ m|^\s*$|)) {
78 print $dstfl '# Begin Special Build Tool' . "\n";
79 print $dstfl 'TargetPath=' . $outpath . "\n";
80 print $dstfl 'SOURCE="$(InputPath)"' . "\n";
81 print $dstfl 'PostBuild_Desc=Embed .manifest' . "\n";
82 print $dstfl 'PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);2' . "\n";
83 print $dstfl '# End Special Build Tool' . "\n";
89 undef $outtype if (defined($outtype));
90 undef $outpath if (defined($outpath));
95 rename $tname, $oname || die;
96 print "Added manifest to " . $oname . " in " . $File::Find::dir . "\n";
109 $srcfl = new IO::File $oname, "r" || die;
110 $dstfl = new IO::File $tname, "w" || die;
111 while ($src = <$srcfl>) {
112 if ($src =~ s|Format Version 6\.00|Format Version 5\.00|) {
115 if ($src =~ s|^(# ADD CPP .*)/ZI (.*)|$1/Zi $2|) {
118 if ($src =~ s|^(# ADD BASE CPP .*)/ZI (.*)|$1/Zi $2|) {
121 if ($src =~ s|^(# ADD CPP .*)/EHsc (.*)|$1/GX $2|) {
124 if ($src =~ s|^(# ADD BASE CPP .*)/EHsc (.*)|$1/GX $2|) {
127 while ($src =~ s|^(# ADD RSC .*)/d "([^ ="]+)=([^"]+)"|$1/d $2="$3"|) {
130 if ($src !~ m|^# PROP AllowPerConfigDependencies|) {
139 unlink $oname || die;
140 rename $tname, $oname || die;
141 print "Converted VC6 project " . $oname . " to VC5 in " . $File::Find::dir . "\n";
155 $srcfl = new IO::File $_, "r" || die;
156 $dstfl = new IO::File $tname, "w" || die;
157 while ($src = <$srcfl>) {
158 if ($src =~ s|Format Version 5\.00|Format Version 6\.00|) {
161 if ($src =~ s|^(!MESSAGE .*)\\\n|$1|) {
166 if ($src =~ s|^(# ADD CPP .*)/GX (.*)|$1/EHsc $2|) {
169 if ($src =~ s|^(# ADD BASE CPP .*)/GX (.*)|$1/EHsc $2|) {
172 while ($src =~ s|^(# ADD RSC .*)/d "([^ ="]+)=([^"]+)"|$1/d $2="$3"|) {
176 if ($verchg && $src =~ m|^# Begin Project|) {
177 print $dstfl "# PROP AllowPerConfigDependencies 0\n";
183 unlink $oname || die;
184 rename $tname, $oname || die;
185 print "Converted VC5 project " . $oname . " to VC6 in " . $File::Find::dir . "\n";
195 if (m|\.dsp$| || m|\.mak$|) {
199 $srcfl = new IO::File $_, "r" || die;
200 $dstfl = new IO::File $tname, "w" || die;
201 while ($src = <$srcfl>) {
202 if ($src =~ s|(\bCPP.*) /GX(.*)|$1 /EHsc$2|) {
205 if ($src =~ s|(\bLINK32.*) /machine:I386(.*)|$1$2|) {
208 while ($src =~ s|^(# ADD RSC .*)/d ([^ ="]+)="([^"]+)"|$1/d "$2=$3"|) {
216 unlink $oname || die;
217 rename $tname, $oname || die;
218 print "Converted project " . $oname . " to 2005 in " . $File::Find::dir . "\n";
228 if (m|\.dsp$| || m|\.mak$|) {
232 $srcfl = new IO::File $_, "r" || die;
233 $dstfl = new IO::File $tname, "w" || die;
234 while ($src = <$srcfl>) {
235 while ($src =~ m|\\\n$|) {
236 $src = $src . <$srcfl>
238 if ($src =~ s|(\bCPP.*) /W4(.*)|$1 /W3$2|) {
246 unlink $oname || die;
247 rename $tname, $oname || die;
248 print "Converted project " . $oname . " to warn:3 in " . $File::Find::dir . "\n";
258 if (m|\.dsp$| || m|\.mak$|) {
262 $srcfl = new IO::File $_, "r" || die;
263 $dstfl = new IO::File $tname, "w" || die;
264 while ($src = <$srcfl>) {
265 while ($src =~ m|\\\n$|) {
266 $src = $src . <$srcfl>
268 if ($src =~ s|(\bCPP.*) /W3(.*)|$1 /W4$2|) {
276 unlink $oname || die;
277 rename $tname, $oname || die;
278 print "Converted project " . $oname . " to warn:4 " . $File::Find::dir . "\n";
288 if (m|\.dsp$| || m|\.mak$|) {
292 $srcfl = new IO::File $_, "r" || die;
293 $dstfl = new IO::File $tname, "w" || die;
294 while ($src = <$srcfl>) {
295 while ($src =~ m|\\\n$|) {
296 $src = $src . <$srcfl>
298 if ($src =~ s|Win32 \(x86\) (Release)|Win32 (IA64) $1|s) {
301 if ($src =~ s|Win32 \(x86\) (Debug)|Win32 (IA64) $1|s) {
304 if ($src =~ s| - Win32 (Release)| - Win32 (IA64) $1|s) {
307 if ($src =~ s| - Win32 (Debug)| - Win32 (IA64) $1|s) {
310 # Cross compilation exceptions
311 if (!(m|gen[^/]*$| || m|dftables[^/]*$|)) {
312 if ($src =~ s|(\bCPP.* /W3)(.*) /FD(.*)|$1 /As64 /Wp64$2$3|s) {
315 if ($src =~ s|(\bLINK.*/machine):I386(.*)|$1:IA64$2|s) {
320 if ($src =~ s|(\bCPP.* /W3)(.*) /FD(.*)|$1 /As32 /Wp64$2$3|s) {
329 unlink $oname || die;
330 rename $tname, $oname || die;
331 print "Converted build file " . $oname . " to Win64 in " . $File::Find::dir . "\n";
345 $srcfl = new IO::File $oname, "r" || die;
346 $dstfl = new IO::File $tname, "w" || die;
347 while ($src = <$srcfl>) {
348 if ($src =~ s|^(# ADD CPP .* /D "_DEBUG" )|$1/D "APR_POOL_DEBUG" |) {
350 if ($oname =~ /apr\.dsp$/) {
351 $src =~ s|^(# ADD CPP .* /D "_DEBUG" )|$1/D "POOL_DEBUG" |;
359 unlink $oname || die;
360 rename $tname, $oname || die;
361 print "Converted project " . $oname . " to debug pools in " . $File::Find::dir . "\n";
369 sub tobrowsesources {
375 $srcfl = new IO::File $oname, "r" || die;
376 $dstfl = new IO::File $tname, "w" || die;
377 while ($src = <$srcfl>) {
378 if ($src =~ s|^(# ADD CPP .*)( /Fd)|$1 /Fr "/httpd-2.0/srclib/apr"$2|) {
386 unlink $oname || die;
387 rename $tname, $oname || die;
388 print "Converted project " . $oname . " to browse sources in " . $File::Find::dir . "\n";
401 $_ =~ s/\.mak\.in/.dsp/;
403 $srcfl = new IO::File $oname, "r" || die;
404 $dstfl = new IO::File $tname, "w" || die;
405 while ($src = <$srcfl>) {
406 if ($src =~ s|^(# ADD CPP .*)( /Fd)|$1 /Fr "/httpd-2.0/srclib/apr"$2|) {
414 unlink $oname || die;
415 rename $tname, $oname || die;
416 print "Converted project " . $oname . " to browse sources in " . $File::Find::dir . "\n";
428 $cdefs = qq{/D "WIN32" /D "_CONSOLE"};
429 $lmodel = qq{/subsystem:console};
430 $targname = "Win32 (x86) Console Application";
432 $debpath = "Debug"; $relpath = "Release";
433 } elsif ($dsptype == 1) {
434 $cdefs = qq{/D "WIN32" /D "_WINDOWS"};
435 $lmodel = qq{/subsystem:windows /dll};
436 $targname = "Win32 (x86) Dynamic-Link Library";
438 $debpath = "Debug"; $relpath = "Release";
439 } elsif($dsptype == 2) {
440 $cdefs = qq{/D "WIN32" /D "_CONSOLE"};
441 $lmodel = qq{/subsystem:console};
442 $targname = "Win32 (x86) Static Library";
444 $debpath = "LibD"; $relpath = "LibR";
453 $debugdef = "NDEBUG";
454 $cflags = "/MD /W3 /O2";
455 $cincl = qq{/I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include"};
457 $file .= dsponemodel();
462 $debugdef = "_DEBUG";
463 $cflags = "/MDd /W3 /GX /Zi /Od";
464 $cincl = qq{/I "./include" /I "./os/win32" /I "./srclib/apr/include" /I "./srclib/apr-util/include"};
465 $lflags = qq{/incremental:no /debug};
466 $file .= dsponemodel();
473 # Name "$name - Win32 Release"
474 # Name "$name - Win32 Debug"
479 #HERE IS OUR FOREACH!
480 $file .= qq{# Begin Source File
482 SOURCE=./server/main.c
488 $icon="$toroot/build/win32/apache.ico";
489 $file .= qq{# Begin Source File
494 $icon = "icon=" . $icon . " ";
496 if ($dsptype == 0 || $dsptype == 1) {
504 SOURCE=$toroot/include/ap_release.h
505 # PROP Ignore_Default_Tool 1
506 # Begin Custom Build - Creating Version Resource
507 InputPath=$toroot/include/ap_release.h $toroot/build/win32/win32ver.awk
509 "./$name.rc" : \$(SOURCE) "\$(INTDIR)" "\$(OUTDIR)"
510 awk -f $toroot/build/win32/win32ver.awk $name "Apache HTTP Server" $toroot/include/ap_release.h $icon> ./Apache.rc
525 $midl = "MTL=midl.exe\n";
529 qq{# Microsoft Developer Studio Project File - Name="$name" - Package Owner=<4>
530 # Microsoft Developer Studio Generated Build File, Format Version 6.00
533 # TARGTYPE "$targname" $targid
535 CFG=$name - Win32 Release
536 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
537 !MESSAGE use the Export Makefile command and run
539 !MESSAGE NMAKE /f "$name.mak".
541 !MESSAGE You can specify a configuration when running NMAKE
542 !MESSAGE by defining the macro CFG on the command line. For example:
544 !MESSAGE NMAKE /f "$name.mak" CFG="$name - Win32 Release"
546 !MESSAGE Possible choices for configuration are:
548 !MESSAGE "$name - Win32 Release" (based on "$targname")
549 !MESSAGE "$name - Win32 Debug" (based on "$targname")
553 # PROP AllowPerConfigDependencies 0
554 # PROP Scc_ProjName ""
555 # PROP Scc_LocalPath ""
561 if ($model eq "Release") {
562 $targpath = $relpath;
564 $targpath = $debpath;
568 qq{# ADD BASE MTL /nologo /D "$debugdef" /win32
569 # ADD MTL /nologo /D "$debugdef" /mktyplib203 /win32
572 $linkop = qq{LIB32=link.exe -lib
573 # ADD BASE LIB32 /nologo
577 $linkop = qq{LINK32=link.exe
578 # ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo $lmodel $lflags /machine:I386
579 # ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib mswsock.lib /nologo $lmodel $lflags /machine:I386
584 !${second}IF "\$(CFG)" == "$name - Win32 $model"
586 # PROP BASE Use_MFC 0
587 # PROP BASE Use_Debug_Libraries $usedebuglib
588 # PROP BASE Output_Dir "$targpath"
589 # PROP BASE Intermediate_Dir "$targpath"
590 # PROP BASE Target_Dir ""
592 # PROP Use_Debug_Libraries $usedebuglib
593 # PROP Output_Dir "$targpath"
594 # PROP Intermediate_Dir "$targpath"
595 # PROP Ignore_Export_Lib 0
597 # ADD BASE CPP /nologo $cflags $cincl /D "$debugdef" $cdefs /FD /c
598 # ADD CPP /nologo $cflags $cincl /D "$debugdef" $cdefs /Fd"$targpath/$name" /FD /c
599 ${midl}# ADD BASE RSC /l 0x409 /d "$debugdef"
600 # ADD RSC /l 0x409 /d "$debugdef"
602 # ADD BASE BSC32 /nologo