summaryrefslogtreecommitdiff
path: root/build/fixwin32mak.pl
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2007-08-24 10:42:47 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2007-08-24 10:42:47 +0000
commit585ad02ab0c7c008bbd23f38b0f1315cad0d0af7 (patch)
tree64c5e44211f18ff88d31358ce63b5f684efe790a /build/fixwin32mak.pl
parent9799653bf436121fc0f624374a18543a2303fd21 (diff)
downloadlibapr-585ad02ab0c7c008bbd23f38b0f1315cad0d0af7.tar.gz
We needed to fix the fix of .mak files to prevent insane amounts
of recursion, because VS98 wasn't quite exporting the post-build targets appropriatly, and didn't respect the RECURSE flag. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@569339 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/fixwin32mak.pl')
-rw-r--r--build/fixwin32mak.pl60
1 files changed, 57 insertions, 3 deletions
diff --git a/build/fixwin32mak.pl b/build/fixwin32mak.pl
index 7efdc11bf..6fbe36e9c 100644
--- a/build/fixwin32mak.pl
+++ b/build/fixwin32mak.pl
@@ -19,6 +19,30 @@ $altroot =~ s| ".:| "|;
print "Stripping " . $root . " and " . $altroot . "\n";
find(\&fixcwd, '.');
+# Given this pattern that disregarded the RECURSE flag...
+#
+# !IF "$(RECURSE)" == "0"
+#
+# ALL : "$(OUTDIR)\mod_charset_lite.so"
+#
+# !ELSE
+#
+# ALL : "libhttpd - Win32 Release" "libaprutil - Win32 Release" "libapr - Win32 Release" "$(OUTDIR)\mod_charset_lite.so"
+#
+# !ENDIF
+#...
+# DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+#...
+# ALL : $(DS_POSTBUILD_DEP)
+#
+# $(DS_POSTBUILD_DEP) : "libhttpd - Win32 Release" "libaprutil - Win32 Release" "libapr - Win32 Release" "$(OUTDIR)\mod_charset_lite.so"
+#
+# we will axe the final ALL : clause,
+# strip all but the final element from $(DS_POSTBUILD_DEP) : clause
+# move the DS_POSTBUILD_DEP assignment above the IF (for true ALL : targets)
+# and in pass 2, append the $(DS_POSTBUILD_DEP) to the valid ALL : targets
+
+
sub fixcwd {
if (m|.mak$|) {
$thisroot = $File::Find::dir;
@@ -29,9 +53,22 @@ sub fixcwd {
$oname = $_;
$tname = '.#' . $_;
$verchg = 0;
+ $postdep = 0;
$srcfl = new IO::File $_, "r" || die;
$dstfl = new IO::File $tname, "w" || die;
while ($src = <$srcfl>) {
+ if ($src =~ m|^(DS_POSTBUILD_DEP=.+)$|) {
+ $postdepval = $1 . "\n\n";
+ }
+ if ($src =~ s|^ALL : \$\(DS_POSTBUILD_DEP\)||) {
+ $postdep = -1;
+ $verchg = -1;
+ $src = <$srcfl>;
+ $src = <$srcfl> if ($src =~ m|^$|);
+ }
+ if ($postdep) {
+ $src =~ s|^(\$\(DS_POSTBUILD_DEP\)) :.+(\"[^\"]+\")$|"$1" : $2|;
+ }
if ($src =~ m|^\s*($root[^\"]*)\".*$|) {
$orig = $thisroot;
} elsif ($src =~ m|^\s*($altroot[^\"]*)\".*$|) {
@@ -54,9 +91,26 @@ sub fixcwd {
undef $srcfl;
undef $dstfl;
if ($verchg) {
- unlink $oname || die;
- rename $tname, $oname || die;
- print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
+ if ($postdep) {
+ $srcfl = new IO::File $tname, "r" || die;
+ $dstfl = new IO::File $oname, "w" || die;
+ while ($src = <$srcfl>) {
+ if ($src =~ m|^\!IF "\$\(RECURSE\)" == "0".*$|) {
+ print $dstfl $postdepval;
+ }
+ $src =~ s|^(ALL : .+)$|$1 "\$\(DS_POSTBUILD_DEP\)"|;
+ print $dstfl $src;
+ }
+ undef $srcfl;
+ undef $dstfl;
+ unlink $tname || die;
+ print "Corrected post-dependency within " . $oname . " in " . $File::Find::dir . "\n";
+ }
+ else {
+ unlink $oname || die;
+ rename $tname, $oname || die;
+ print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
+ }
}
else {
unlink $tname;