mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Backing out bug 298670, attachment 187193 and changes to xptlink.pl since.
This commit is contained in:
parent
854aed594d
commit
e353f7bdc2
@ -61,25 +61,6 @@ MOZ_APP_DISPLAYNAME = DeerPark
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
MOZ_PKG_MANIFEST_P = $(srcdir)/windows/packages-static
|
||||
else
|
||||
ifneq (,$(filter-out OS2 Darwin,$(OS_ARCH)))
|
||||
MOZ_PKG_MANIFEST_P = $(srcdir)/unix/packages-static
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFINES += -DAB_CD=$(AB_CD)
|
||||
|
||||
ifdef MOZ_PKG_MANIFEST_P
|
||||
MOZ_PKG_MANIFEST = packages-static
|
||||
|
||||
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P)
|
||||
$(PERL) $(topsrcdir)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $< > $@
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
|
||||
|
||||
installer:
|
||||
|
@ -187,25 +187,12 @@ STRIP_FLAGS =
|
||||
PLATFORM_EXCLUDE_LIST = ! -name "*.ico"
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
|
||||
PKGCP_OS = dos
|
||||
else
|
||||
PKGCP_OS = unix
|
||||
endif
|
||||
|
||||
$(PACKAGE): $(MOZILLA_BIN) $(MOZ_PKG_MANIFEST)
|
||||
$(PACKAGE): $(MOZILLA_BIN)
|
||||
@rm -rf $(DIST)/$(MOZ_PKG_APPNAME) $(DIST)/$(PKG_BASENAME).tar $(DIST)/$(PKG_BASENAME).dmg $@ $(EXCLUDE_LIST)
|
||||
# NOTE: this must be a tar now that dist links into the tree so that we
|
||||
# do not strip the binaries actually in the tree.
|
||||
@echo "Creating package directory..."
|
||||
@mkdir $(DIST)/$(MOZ_PKG_APPNAME)
|
||||
ifdef MOZ_PKG_MANIFEST
|
||||
$(RM) -rf $(DIST)/xpt
|
||||
$(PERL) -I$(topsrcdir)/xpinstall/packager -e 'use Packager; \
|
||||
Packager::Copy("$(DIST)", "$(DIST)/$(MOZ_PKG_APPNAME)", \
|
||||
"$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 0);'
|
||||
$(PERL) $(topsrcdir)/xpinstall/packager/xptlink.pl -s $(DIST) -d $(DIST)/xpt -f $(DIST)/$(MOZ_PKG_APPNAME)/components -v -o $(PKGCP_OS)
|
||||
else # !MOZ_PKG_MANIFEST
|
||||
ifeq ($(MOZ_PKG_FORMAT),DMG)
|
||||
@cd $(DIST) && rsync -auvL $(_APPNAME) $(MOZ_PKG_APPNAME)
|
||||
else
|
||||
@ -218,7 +205,6 @@ ifndef EXCLUDE_NSPR_LIBS
|
||||
endif
|
||||
endif
|
||||
endif # DMG
|
||||
endif # MOZ_PKG_MANIFEST
|
||||
@echo "Stripping package directory..."
|
||||
@cd $(DIST)/$(MOZ_PKG_APPNAME); find . ! -type d \
|
||||
! -name "*.js" \
|
||||
|
@ -230,16 +230,7 @@ sub do_copyfile
|
||||
|
||||
# set the destination path, if alternate destination given, use it.
|
||||
if ($flat) {
|
||||
if ($srcsuffix eq ".xpt" && $srcpath =~ m|bin/components/$|) {
|
||||
if ($component eq "") {
|
||||
die ("XPT file was not part of a component.");
|
||||
}
|
||||
|
||||
$destpathcomp = "$srcdir/xpt/$component";
|
||||
}
|
||||
else {
|
||||
$destpathcomp = "$destdir";
|
||||
}
|
||||
$destpathcomp = "$destdir";
|
||||
} else {
|
||||
# double-check that we have a valid component before appending the path
|
||||
# delimiter. If $component is empty, we'd end up placing an extra : at
|
||||
@ -290,10 +281,6 @@ sub do_copyfile
|
||||
}
|
||||
}
|
||||
|
||||
if ($flat) {
|
||||
$destpath =~ s|bin[/\\]||;
|
||||
}
|
||||
|
||||
# create the destination path if it doesn't exist
|
||||
if (! -d "$destpath" ) {
|
||||
($debug >= 5) && print " mkpath($destpath)\n";
|
||||
|
@ -45,12 +45,22 @@
|
||||
# a single .xpt file to improve startup performance.
|
||||
#
|
||||
|
||||
# load modules
|
||||
use Cwd;
|
||||
#use File::Basename;
|
||||
#use File::Copy;
|
||||
#use File::Find;
|
||||
#use File::Path;
|
||||
#use File::stat;
|
||||
use Getopt::Long;
|
||||
|
||||
# initialize variables
|
||||
$saved_cwd = cwd();
|
||||
$component = ""; # current component being copied
|
||||
$PD = ""; # file Path Delimiter ( /, \, or :)
|
||||
$bindir = ""; # directory for xpt files ("bin" or "viewer")
|
||||
$srcdir = ""; # root directory being copied from
|
||||
$destdir = ""; # root directory being copied to
|
||||
$finaldir = ""; # where to put the final linked XPT
|
||||
$os = ""; # os type (MSDOS, Unix)
|
||||
$verbose = 0; # shorthand for --debug 1
|
||||
$debug = 0; # controls amount of debug output
|
||||
@ -59,7 +69,6 @@ $help = 0; # flag: if set, print usage
|
||||
# get command line options
|
||||
$return = GetOptions( "source|s=s", \$srcdir,
|
||||
"destination|d=s", \$destdir,
|
||||
"final|f=s", \$finaldir,
|
||||
"os|o=s", \$os,
|
||||
"help|h", \$help,
|
||||
"debug=i", \$debug,
|
||||
@ -67,16 +76,6 @@ $return = GetOptions( "source|s=s", \$srcdir,
|
||||
"<>", \&do_badargument
|
||||
);
|
||||
|
||||
if ($finaldir ne "") {
|
||||
$bindir = "";
|
||||
}
|
||||
else {
|
||||
$bindir = "bin/";
|
||||
}
|
||||
|
||||
# remove extra slashes from $destdir
|
||||
$destdir =~ s:/+:/:g;
|
||||
|
||||
# set debug level
|
||||
if ($verbose && !($debug)) {
|
||||
$debug = 1;
|
||||
@ -94,6 +93,11 @@ if (! $return)
|
||||
}
|
||||
|
||||
$xptdirs = (); # directories in the destination directory
|
||||
$xptfiles = (); # list of xpt files found in current directory
|
||||
$file = ""; # file from file list
|
||||
$files = (); # file list for removing .xpt files
|
||||
$cmdline = ""; # command line passed to system() call
|
||||
$i = 0; # generic counter var
|
||||
|
||||
($debug >= 1) && print "\nLinking .xpt files...\n";
|
||||
($debug >= 2) && print "do_xptlink():\n";
|
||||
@ -105,66 +109,77 @@ opendir (DESTDIR, "$destdir") ||
|
||||
($debug >= 4) && print "xptdirs: @xptdirs\n";
|
||||
closedir (DESTDIR);
|
||||
|
||||
foreach my $component (@xptdirs) {
|
||||
foreach $component (@xptdirs) {
|
||||
($debug >= 1) && print "[$component]\n";
|
||||
|
||||
print ("Checking for '$destdir/$component/$bindir"."components'\n") if $debug >= 3;
|
||||
|
||||
if (-d "$destdir/$component/$bindir"."components") {
|
||||
warn "File '$destdir/$component/$bindir"."components/$component.xpt' already exists."
|
||||
if -f "$destdir/$component/$bindir"."components/$component.xpt";
|
||||
|
||||
chdir ("$destdir$PD$component");
|
||||
if (( $os eq "MacOS" && -d "$PD$bindir$PD"."components") || ( -d "$bindir$PD"."components")) {
|
||||
if ( $os eq "MacOS" ) {
|
||||
chdir (":$bindir$PD"."components") ;
|
||||
} else {
|
||||
chdir ("$bindir$PD"."components") ;
|
||||
}
|
||||
if (( -f "$component".".xpt" ) || ( -f ":$component".".xpt" )) {
|
||||
warn "Warning: file ".$component.".xpt already exists.\n";
|
||||
}
|
||||
|
||||
# create list of .xpt files in cwd
|
||||
my @xptfiles;
|
||||
|
||||
($debug >= 4) && print "opendir: $destdir/$component/$bindir"."components\n";
|
||||
opendir (COMPDIR, "$destdir/$component/$bindir"."components") ||
|
||||
die "Error: cannot open $destdir/$component/$bindir"."components. Exiting...\n";
|
||||
($debug >= 4) && print "opendir: $destdir$PD$component$PD$bindir$PD"."components\n";
|
||||
opendir (COMPDIR, "$destdir$PD$component$PD$bindir$PD"."components") ||
|
||||
die "Error: cannot open $destdir$PD$component$PD$bindir$PD"."components. Exiting...\n";
|
||||
($debug >= 3) && print "Creating list of .xpt files...\n";
|
||||
my @files = sort ( grep (!/^\./, readdir (COMPDIR)));
|
||||
foreach my $file (@files) {
|
||||
@files = sort ( grep (!/^\./, readdir (COMPDIR)));
|
||||
foreach $file (@files) {
|
||||
($debug >= 6) && print "$file\n";
|
||||
if ( $file =~ /\.xpt$/ ) {
|
||||
push @xptfiles, "$destdir/$component/$bindir"."components/$file";
|
||||
$xptfiles[$i] = $file;
|
||||
$i++;
|
||||
($debug >= 8) && print "xptfiles:\t@xptfiles\n";
|
||||
}
|
||||
}
|
||||
closedir (COMPDIR);
|
||||
|
||||
# merge .xpt files into one if we found any in the dir
|
||||
if ( $#xptfiles ) {
|
||||
my ($merged, $fmerged);
|
||||
if ($finaldir ne "") {
|
||||
$merged = "$finaldir/$component.xpt";
|
||||
}
|
||||
else {
|
||||
$fmerged = "$destdir/$component/$bindir"."components/$component.xpt";
|
||||
$merged = $fmerged.".new";
|
||||
}
|
||||
|
||||
my $cmdline = "$srcdir/bin/xpt_link $merged @xptfiles";
|
||||
if ( $#xptfiles >=1 ) {
|
||||
if ( $os eq "MacOS" ) {
|
||||
$cmdline = "'$srcdir$PD"."xpt_link' $component".".xpt.new"." @xptfiles";
|
||||
} else {
|
||||
$cmdline = "$srcdir$PD$bindir$PD"."xpt_link $component".".xpt.new"." @xptfiles";
|
||||
}
|
||||
($debug >= 4) && print "$cmdline\n";
|
||||
system($cmdline) == 0 || die ("'$cmdline' failed");
|
||||
system($cmdline);
|
||||
|
||||
if ($finaldir eq "") {
|
||||
# remove old .xpt files in the component directory.
|
||||
($debug >= 2) && print "Deleting individual xpt files.\n";
|
||||
for my $file (@xptfiles) {
|
||||
($debug >= 4) && print "\t$file";
|
||||
unlink ($file) ||
|
||||
die "Couldn't unlink file $file.\n";
|
||||
($debug >= 4) && print "\t\tdeleted\n\n";
|
||||
}
|
||||
|
||||
($debug >= 2) && print "Renaming $merged as $fmerged\n";
|
||||
rename ($merged, $fmerged) ||
|
||||
die "Rename of '$merged' to '$fmerged' failed.\n";
|
||||
# remove old .xpt files in the component directory if xpt_link succeeded
|
||||
if (( -f "$component".".xpt.new" ) ||
|
||||
(( -f "$PD$component".".xpt.new" ) && ( $os eq "MacOS" ))) {
|
||||
($debug >= 2) && print "Deleting individual xpt files.\n";
|
||||
foreach $file (@xptfiles) {
|
||||
($debug >= 4) && print "\t$file";
|
||||
unlink ("$destdir$PD$component$PD$bindir$PD"."components"."$PD$file") ||
|
||||
warn "Warning: couldn't unlink file $file.\n";
|
||||
($debug >= 4) && print "\t\tdeleted\n";
|
||||
}
|
||||
($debug >= 4) && print "\n";
|
||||
} else {
|
||||
die "Error: xpt_link failed. Exiting...\n";
|
||||
}
|
||||
($debug >= 2) && print "Renaming $component".".xpt.new as $component".".xpt.\n";
|
||||
if ( $os eq "MacOS" ) {
|
||||
rename (":$component".".xpt.new", ":$component".".xpt") ||
|
||||
warn "Warning: rename of $component".".xpt.new as ".$component.".xpt failed.\n";
|
||||
} else {
|
||||
rename ("$component".".xpt.new", "$component".".xpt") ||
|
||||
warn "Warning: rename of $component".".xpt.new as ".$component.".xpt failed.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
# reinitialize vars for next component
|
||||
@xptfiles = ();
|
||||
$i = 0;
|
||||
}
|
||||
($debug >= 1) && print "Linking .xpt files completed.\n";
|
||||
|
||||
chdir ($saved_cwd);
|
||||
|
||||
exit (0);
|
||||
|
||||
|
||||
@ -202,15 +217,24 @@ sub check_arguments
|
||||
$exitval += 2;
|
||||
}
|
||||
|
||||
# check OS == {unix|dos}
|
||||
# check OS == {mac|unix|dos}
|
||||
if ($os eq "") {
|
||||
print "Error: OS type (--os) not specified.\n";
|
||||
$exitval += 8;
|
||||
} elsif ( $os =~ /mac/i ) {
|
||||
$os = "MacOS";
|
||||
$PD = ":";
|
||||
$bindir = "viewer";
|
||||
($debug >= 4) && print " OS: $os\n";
|
||||
} elsif ( $os =~ /dos/i ) {
|
||||
$os = "MSDOS";
|
||||
$PD = "/";
|
||||
$bindir = "bin";
|
||||
($debug >= 4) && print " OS: $os\n";
|
||||
} elsif ( $os =~ /unix/i ) {
|
||||
$os = "Unix"; # can be anything but MacOS, MSDOS, or VMS
|
||||
$PD = "/";
|
||||
$bindir = "bin";
|
||||
($debug >= 4) && print " OS: Unix\n";
|
||||
} else {
|
||||
print "Error: OS type \"$os\" unknown.\n";
|
||||
|
Loading…
Reference in New Issue
Block a user