summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2001-03-08 15:22:31 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2001-03-08 15:22:31 +0000
commit5cc4a0a95a64f8c878695ad3ea62b9140c8bfe39 (patch)
tree69618aaf4d35fbd0a51d9415c515576d49f0844a
parentb807f797ebcb9df467af5d0539b519f41b137f4d (diff)
downloadlibapr-5cc4a0a95a64f8c878695ad3ea62b9140c8bfe39.tar.gz
Script to fix apr-util's path for apr in the win32 .mak files... always
run whenever exporting the .mak files, and always _before_ the copy of this script in httpd-2.0/build, if this is a checkout for that project. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61350 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--build/fixwin32mak.pl53
1 files changed, 53 insertions, 0 deletions
diff --git a/build/fixwin32mak.pl b/build/fixwin32mak.pl
new file mode 100644
index 000000000..d8131fb44
--- /dev/null
+++ b/build/fixwin32mak.pl
@@ -0,0 +1,53 @@
+#
+# fixwin32mak.pl ::: Apache/Win32 maintanace program
+#
+# This program, launched from the build/ directory, replaces all nasty absoulute paths
+# in the win32 .mak files with the appropriate relative root.
+#
+# Run this program prior to committing or packaging any newly exported make files.
+
+use Cwd;
+use IO::File;
+use File::Find;
+
+chdir '..';
+$root = cwd;
+# ignore our own direcory (allowing us to move into any parallel tree)
+$root =~ s|^.:(.*)/.*?$|cd "$1|;
+$root =~ s|/|\\\\|g;
+print "Testing " . $root . "\n";
+find(\&fixcwd, '.');
+
+sub fixcwd {
+ if (m|.mak$|) {
+# note repl is broken... isn't freindly to directories with periods.
+ $repl = $File::Find::dir;
+# replace ./ with the parent (moving into any parallel tree)
+ $repl =~ s|^\./|../|;
+# replace each directory in this path with .. to get back to our root
+ $repl =~ s|[^/]+|..|g;
+ $repl =~ s|/|\\|;
+ $oname = $_;
+ $tname = '.#' . $_;
+ $verchg = 0;
+print "Processing " . $_ . "\n";
+ $srcfl = new IO::File $_, "r" || die;
+ $dstfl = new IO::File $tname, "w" || die;
+ while ($src = <$srcfl>) {
+ if ($src =~ s|^(\s*)$root|$1cd "$repl|) {
+ $verchg = -1;
+ }
+ print $dstfl $src;
+ }
+ undef $srcfl;
+ undef $dstfl;
+ if ($verchg) {
+ unlink $oname || die;
+ rename $tname, $oname || die;
+ print "Corrected absolute paths within " . $oname . " in " . $File::Find::dir . "\n";
+ }
+ else {
+ unlink $tname;
+ }
+ }
+}