DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
# Run this on Win32 only!

################################################
# GLOBAL SETTINGS
#
# Paths'n'things. Change as appropriate!

$dir_sep = '\\';
$moz = "$ENV{'MOZ_SRC'}\\mozilla";
$moz_dist = "$moz\\dist\\Embed";
$moz_redist = "$moz\\..\\redist";
$moz_embedding_config = "$moz\\embedding\\config";
$moz =~ s/\//$dir_sep/g;
$moz_major_version=1;
$moz_minor_version=5;
$moz_version = "v$moz_major_version.$moz_minor_version";

$makensis = "C:/Program Files/NSIS/makensis.exe";
$control_nsi = "control.nsi";
$local_nsh = "local.nsh";
$files_nsh = "files.nsh";

################################################

@dirs = ();

print "Mozilla ActiveX control builder\n\n";
print "Hold onto your hats, this could be a rough trip\n";

# Copy the client-win to embedding/config
# cp client-win $moz_embedding_config

# Run the make in embedding/config to ensure a dist
#chdir $moz_embedding_config or die("Can't cd into $moz_embedding_config!");
#@make = ( "make" );
#system(@make);

# Generate local settings
print "Opening $local_nsh for writing\n";
open(NSH, ">$local_nsh") or die("Can't write local settings to $local_nsh");
print NSH "!define DISTDIR \"$moz_dist\"\n";
print NSH "!define REDISTDIR \"$moz_redist\"\n";
print NSH "!define VERSION \"$moz_version\"\n";
print NSH "!define MAJOR_VERSION \"$moz_major_version\"\n";
print NSH "!define MINOR_VERSION \"$moz_minor_version\"\n";
close(NSH);

# Generate file manifest
print "Opening $files_nsh from $moz_dist for writing\n";
open(FILES_NSH, ">$files_nsh") or die("Can't write files to $files_nsh");
push @dirs, "";
read_dir("$moz_dist", "");
foreach (@dirs)
{
	if ($_ eq "")
	{
		print FILES_NSH "\n    SetOutPath \"\$INSTDIR\"\n";
	}
	else
	{
		print FILES_NSH "\n    SetOutPath \"\$INSTDIR\\$_\"\n";
	}

	$dir = "$moz_dist\\$_";

	opendir(DIR, $dir);
	@files = readdir(DIR);
	foreach (@files)
	{
		# Everything except mfcembed / winembed / readme.html
		next if (/.*mfcembed*/i ||
				 /.*winembed*/i ||
				 /readme.html/i);

		if (! -d "$dir\\$_")
		{
			print FILES_NSH "    File $dir\\$_\n";
		}
	}
	closedir(DIR);
}
close(FILES_NSH);

# Run NSIS

print "Running makensis.exe to compile it all...\n";
@nsis = ("$makensis", "$control_nsi");
system(@nsis) == 0 or die "system @args failed: $?\n";

# TODO - Run codesigning tool - if there is a cert to sign with


print "Finished\n";

exit;

sub read_dir($$)
{
	my ($absdir,$reldir) = @_;
	my @dirList;
	opendir(DIST, "$absdir");
	@dirList = readdir(DIST);
	closedir(DIST);
	foreach (@dirList)
	{
		next if ($_ eq "." || $_ eq "..");
		$absFileName = "$absdir\\$_";
		$fileName = ($reldir eq "") ? $_ : "$reldir\\$_";

		if (-d $absFileName)
		{
			push @dirs, $fileName;
			read_dir($absFileName, $fileName);
		}
	} 
}