From fd8513369aef697a68395b4d12c014dfd49ad359 Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Wed, 6 Jun 2001 12:10:42 +0000 Subject: [PATCH] NOT PART OF BUILD. Added support for Linux to public header generator tool. --- embedding/config/mk_sdk_hdr_lst.pl | 78 +++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 11 deletions(-) diff --git a/embedding/config/mk_sdk_hdr_lst.pl b/embedding/config/mk_sdk_hdr_lst.pl index d09a38a7945..a2391de75d4 100644 --- a/embedding/config/mk_sdk_hdr_lst.pl +++ b/embedding/config/mk_sdk_hdr_lst.pl @@ -1,13 +1,44 @@ -#!/bin/perl +#!/usr/bin/perl # This script dumps out a list of all public Mozilla headers based on what the # embedding samples use. It uses dependency generator tools to find all # headers, sorts them removes duplicates and dumps them out to display. +use Getopt::Long; + +$showhelp = 0; +$verbose = 0; +$appname = "Gecko public header list generator"; # Configuration -$moz = "$ENV{'MOZ_SRC'}/mozilla"; -$makedepexe = "$moz/config/makedep.exe"; +$win32 = ($^O eq "MSWin32") ? 1 : 0; # ActiveState Perl +if ($win32) { + $moz = "$ENV{'MOZ_SRC'}/mozilla"; + $makedepexe = "$moz/config/makedep.exe"; +} +else { + $moz = "/usr/local/src/mozilla"; + $makedepexe = "makedepend"; +} + +GetOptions('verbose!' => \$verbose, + 'mozpath=s' => \$moz, + 'deptool=s' => \$makedepexe, + 'help' => \$showhelp); + +if ($showhelp) { + print STDERR "$appname\n", + "Usage:\n", + "--help Show this help\n", + "--verbose Print out more information\n", + "--mozpath Specify the path to Mozilla\n", + "--deptool Specify the dependency tool path\n"; + exit 1; +} + +print STDERR "$appname\n", + "Path to mozilla is \"$moz\"\n", + "Dependency tool is \"$makedepexe\"\n" unless !$verbose; # List of Mozilla include directories @incdirs = ( @@ -18,7 +49,7 @@ $makedepexe = "$moz/config/makedep.exe"; # List of embedding sample/wrapper app directories %embeddirs = ( "winEmbed", "$moz/embedding/tests/winEmbed", - "mfcEmbed", "$moz/embedding/tests/mfcEmbed", + "mfcEmbed", "$moz/embedding/tests/mfcembed", "gtkEmbed", "$moz/embedding/tests/gtkEmbed", "activex", "$moz/embedding/browser/activex/src/control", "powerplant", "$moz/embedding/browser/powerplant/source", @@ -38,7 +69,7 @@ $prev = 'nonesuch'; # Output the list of headers foreach $h (@out) { - $printinfo{$h} = 0; + $printinfo{$h} = 0; } foreach $i (@incdirs) { $i =~ s/\\/\//g; # Back slash to forward slash @@ -57,7 +88,7 @@ foreach $i (@incdirs) { sub makedep { my($prjname, $prjpath) = @_; - print STDERR "Analyzing dependencies for $prjname ...\n"; + print STDERR "Analyzing dependencies for $prjname ...\n" unless !$verbose; chdir $prjpath or die "Cannot change directory to \"$prjpath\""; @@ -69,15 +100,34 @@ sub makedep { closedir(THISDIR); # Construct the arguments for the dependency tool - @args = ($makedepexe); - foreach $inc (@incdirs) { - push(@args, "-I$inc"); + if ($win32) { + @args = ($makedepexe); + foreach $inc (@incdirs) { + push(@args, "-I$inc"); + } + foreach $src (@srcfiles) { + push(@args, $src); + } } - foreach $src (@srcfiles) { - push(@args, $src); + else { + @args = ($makedepexe); + push(@args, "-f-"); # To stdout + push(@args, "-w1"); # width = 1 forces one dependency per line + foreach $inc (@incdirs) { + push(@args, "-I$inc"); + } + foreach $src (@srcfiles) { + push(@args, $src); + } } + $cmd = join(' ', @args); + if (!$win32) { + open(OLDERR, ">&STDERR"); + open(STDERR, ">/dev/null"); + } + # Run the dependency tool and read the output open(DATA, "$cmd |") or die("Cannot open output from dependency tool"); @@ -89,12 +139,18 @@ sub makedep { # Remove whitespace and trailing backslash, newline chomp; s/^\s+//g; + s/^[\w]+\.\w\:\s+//g; s/\s+\\$//g; # Store in list push @deps, $_; } } } + + if (!$win32) { + close(STDERR); + open(STDERR, ">&OLDERR"); + } }