apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r495078 - /apr/apr/branches/1.2.x/build/cvtdsp.pl
Date Thu, 11 Jan 2007 01:19:45 GMT
Author: wrowe
Date: Wed Jan 10 17:19:44 2007
New Revision: 495078

URL: http://svn.apache.org/viewvc?view=rev&rev=495078
Log:
cvtdsp.pl -mt will add conditional manifest processing to Application
and Dynamic-Link library projects.

Modified:
    apr/apr/branches/1.2.x/build/cvtdsp.pl

Modified: apr/apr/branches/1.2.x/build/cvtdsp.pl
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/build/cvtdsp.pl?view=diff&rev=495078&r1=495077&r2=495078
==============================================================================
--- apr/apr/branches/1.2.x/build/cvtdsp.pl (original)
+++ apr/apr/branches/1.2.x/build/cvtdsp.pl Wed Jan 10 17:19:44 2007
@@ -7,6 +7,9 @@
 elsif ($ARGV[0] eq '-5') {
     find(\&tovc5, '.');
 }
+elsif ($ARGV[0] eq '-2005') {
+    find(\&tovc2005, '.');
+}
 elsif ($ARGV[0] eq '-w3') {
     find(\&tow3, '.');
 }
@@ -22,6 +25,9 @@
 elsif ($ARGV[0] eq '-b') {
     find(\&tobrowse, '.');
 }
+elsif ($ARGV[0] eq '-mt') {
+    find(\&addmt, '.');
+}
 elsif ($ARGV[0] eq '-m') {
 	## 0 - conapp, 1 - dll lib, 2 - static lib
 	$dsptype = 2;
@@ -36,6 +42,61 @@
     die "Missing argument";
 }
 
+sub addmt { 
+    my $outpath, $outtype;
+
+    if (m|\.dsp$|) {
+        $oname = $_;
+	$tname = '.#' . $_;
+        $verchg = 0;
+        $srcfl = new IO::File $oname, "r" || die;
+	$dstfl = new IO::File $tname, "w" || die;
+	while ($src = <$srcfl>) {
+	    if ($src =~ m|^# TARGTYPE .+ Application|) {
+                $outtype = ".exe"
+	    }
+	    if ($src =~ m|^# TARGTYPE .+ Dynamic-Link|) {
+                $outtype = ".dll"
+	    }
+	    if ($src =~ m|^# PROP Output_Dir "(.+)"|) {
+                $outdir = $1;
+                $outpath = $oname;
+                $outpath =~ s|\.dsp||;
+                $outpath =  "./" . $outdir . "/" . $outpath . $outtype;
+	    }
+	    if ($src =~ m|^# ADD LINK32 .+ /out:"([^"]+)"|) {
+                $outpath = $1;
+                $outpath = "./" . $outpath if (!($outpath =~ m|^\.|));
+	    }
+	    if (defined($outpath) && ($src =~ m|^# Begin Special Build Tool|)) {
+                undef $outpath;
+            }
+	    if (defined($outpath) && defined($outtype) && ($src =~ m|^\s*$|)) {
+                print $dstfl '# Begin Special Build Tool' . "\n";
+                print $dstfl 'TargetPath=' . $outpath . "\n";
+                print $dstfl 'SOURCE="$(InputPath)"' . "\n";
+                print $dstfl 'PostBuild_Desc=Embed .manifest' . "\n";
+                print $dstfl 'PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest
$(TargetPath) .manifest -outputresource:$(TargetPath);2' . "\n";
+                print $dstfl '# End Special Build Tool' . "\n";
+                $verchg = -1;
+                undef $outpath;
+            }
+            print $dstfl $src;
+	}
+        undef $outtype if (defined($outtype));
+        undef $outpath if (defined($outpath));
+	undef $srcfl;
+	undef $dstfl;
+	if ($verchg) {
+	    unlink $oname || die;
+	    rename $tname, $oname || die;
+	    print "Added manifest to " . $oname . " in " . $File::Find::dir . "\n"; 
+	}
+	else {
+	    unlink $tname;
+	}
+    }
+}
 sub tovc5 { 
 
     if (m|\.dsp$|) {
@@ -60,6 +121,9 @@
 	    if ($src =~ s|^(# ADD BASE CPP .*)/EHsc (.*)|$1/GX $2|) {
 		$verchg = -1;
 	    }
+	    while ($src =~ s|^(# ADD RSC .*)/d "([^ ="]+)=([^"]+)"|$1/d $2="$3"|) {
+		$verchg = -1;
+	    }
 	    if ($src !~ m|^# PROP AllowPerConfigDependencies|) {
 		print $dstfl $src; }
 	    else {
@@ -102,6 +166,9 @@
 	    if ($src =~ s|^(# ADD BASE CPP .*)/GX (.*)|$1/EHsc $2|) {
 		$verchg = -1;
 	    }
+	    while ($src =~ s|^(# ADD RSC .*)/d "([^ ="]+)=([^"]+)"|$1/d $2="$3"|) {
+		$verchg = -1;
+	    }
             print $dstfl $src; 
 	    if ($verchg && $src =~ m|^# Begin Project|) {
 		print $dstfl "# PROP AllowPerConfigDependencies 0\n"; 
@@ -113,6 +180,39 @@
 	    unlink $oname || die;
 	    rename $tname, $oname || die;
 	    print "Converted VC5 project " . $oname . " to VC6 in " . $File::Find::dir . "\n"; 
+	}
+	else {
+	    unlink $tname;
+	}
+    }
+}
+
+sub tovc2005 { 
+
+    if (m|\.dsp$| || m|\.mak$|) {
+        $oname = $_;
+	$tname = '.#' . $_;
+	$verchg = 0;
+	$srcfl = new IO::File $_, "r" || die;
+	$dstfl = new IO::File $tname, "w" || die;
+	while ($src = <$srcfl>) {
+	    if ($src =~ s|(\bCPP.*) /GX(.*)|$1 /EHsc$2|) {
+		$verchg = -1;
+	    }
+	    if ($src =~ s|(\bLINK32.*) /machine:I386(.*)|$1$2|) {
+		$verchg = -1;
+	    }
+	    while ($src =~ s|^(# ADD RSC .*)/d ([^ ="]+)="([^"]+)"|$1/d "$2=$3"|) {
+		$verchg = -1;
+	    }
+            print $dstfl $src; 
+	}
+	undef $srcfl;
+	undef $dstfl;
+	if ($verchg) {
+	    unlink $oname || die;
+	    rename $tname, $oname || die;
+	    print "Converted project " . $oname . " to 2005 in " . $File::Find::dir . "\n"; 
 	}
 	else {
 	    unlink $tname;



Mime
View raw message