Generalize xpinstaller/Makefile.in so that the name of the package can be changed via the env.

Add regchrome & installed-chrome.txt to unix package list.
Add --flat/-l option to pkgcp.pl so that the intermediate component directory is not created.
Added dist target to xpinstaller/Makefile which will create a tarball using the packages file for a list.
Add BZ2 package type.
Thanks to Ben Bucksch <mozilla@bucksch.org> for the patch.
Bug #53462. r=cls
This commit is contained in:
cls%seawood.org 2001-01-23 15:53:12 +00:00
parent aa337476a5
commit 9a7f3ad4f1
4 changed files with 75 additions and 27 deletions

View File

@ -35,12 +35,26 @@ include $(DEPTH)/config/autoconf.mk
ifndef MOZ_PKG_FORMAT
MOZ_PKG_FORMAT = TGZ
endif
ifndef MOZ_PKG_APPNAME
MOZ_PKG_APPNAME = mozilla
endif
MAKE_PACKAGE = echo "Sorry, don't know how to build a $(MOZ_PKG_FORMAT) file yet...."
PKG_BASENAME := $(MOZ_PKG_APPNAME)-$(shell $(topsrcdir)/build/autoconf/config.guess)
PACKAGE = $(PKG_BASENAME)$(PKG_SUFFIX)
ifeq ($(MOZ_PKG_FORMAT),TGZ)
PKG_SUFFIX = .tar.gz
MAKE_PACKAGE = tar -cvhf - $(MOZ_PKG_APPNAME) | gzip -vf9 > $(PACKAGE)
endif
ifeq ($(MOZ_PKG_FORMAT),BZ2)
PKG_SUFFIX = .tar.bz2
MAKE_PACKAGE = tar -cvhf - $(MOZ_PKG_APPNAME) | bzip2 -vf > $(PACKAGE)
endif
ifeq ($(MOZ_PKG_FORMAT),ZIP)
PKG_SUFFIX = .zip
MAKE_PACKAGE = $(ZIP) -vr9 $(PACKAGE) $(MOZ_PKG_APPNAME)
endif
ifeq ($(MOZ_PKG_FORMAT),RPM)
PKG_SUFFIX = .rpm
@ -49,9 +63,6 @@ ifeq ($(MOZ_PKG_FORMAT),DEB)
PKG_SUFFIX = .deb
endif
PKG_BASENAME := mozilla-$(shell $(topsrcdir)/build/autoconf/config.guess)
PACKAGE := $(PKG_BASENAME)$(PKG_SUFFIX)
ifdef BUILD_OFFICIAL
TARGETS = $(PACKAGE)
endif
@ -93,13 +104,13 @@ ifneq ($(NSPR_DIR),$(DIST)/bin)
@echo "Copying NSPR..."
@cp -p $(NSPR_DIR)/* $(DIST)/bin/.
endif
@rm -rf $(DIST)/package $(DIST)/$(PKG_BASENAME).tar $@ $(EXCLUDE_LIST)
@rm -rf $(DIST)/$(MOZ_PKG_APPNAME) $(DIST)/$(PKG_BASENAME).tar $@ $(EXCLUDE_LIST)
# NOTE: this must be a cp now that dist links into the tree so that we
# do not strip the binaries actually in the tree.
@echo "Creating package directory..."
@cp -rp ${DIST}/bin $(DIST)/package
@cp -rp ${DIST}/bin $(DIST)/$(MOZ_PKG_APPNAME)
@echo "Stripping package directory..."
@cd $(DIST)/package; find . ! -type d \
@cd $(DIST)/$(MOZ_PKG_APPNAME); find . ! -type d \
! -name "*.js" \
! -name "*.xpt" \
! -name "*.gif" \
@ -122,16 +133,33 @@ endif
! -name "*.reg" \
$(PLATFORM_EXCLUDE_LIST) \
-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
ifeq ($(MOZ_PKG_FORMAT),TGZ)
cd $(DIST); tar -cvhf - package | gzip -vf9 > $@
ifneq ($(MOZ_PKG_APPNAME),mozilla)
@echo "Creating start script $(MOZ_PKG_APPNAME)..."
cd $(DIST)/$(MOZ_PKG_APPNAME); cp mozilla $(MOZ_PKG_APPNAME)
endif
ifeq ($(MOZ_PKG_FORMAT),ZIP)
cd $(DIST); $(ZIP) -vr9 $@ package
@echo "Compressing..."
cd $(DIST); $(MAKE_PACKAGE)
dist: $(DIST)/bin/mozilla-bin
ifndef MOZ_PKG_DEST
@echo "Please define MOZ_PKG_DEST first. It must be an absolute path to a dir outside the source tree. It should be empty (files might get deleted without warning)."
@echo "Other options (not required):"
@echo "MOZ_PKG_NAME: Either TGZ for .tar.gz or BZ2 for .tar.bz2. Default TGZ."
@echo "MOZ_PKG_APPNAME: Application name, used for tarball filename, top-level dir in tarball and application start script. Default mozilla."
else
@if [ ! -d $(MOZ_PKG_DEST) ]; then mkdir $(MOZ_PKG_DEST); fi
@cd $(MOZ_PKG_DEST); rm -rf bin $(MOZ_PKG_APPNAME) $(PACKAGE)
@echo "Creating distribution tarball in $(MOZ_PKG_DEST)..."
$(PERL) $(srcdir)/pkgcp.pl --source $(DEPTH)/dist --destination $(MOZ_PKG_DEST) --file $(srcdir)/packages-unix --os unix --flat
@cd $(MOZ_PKG_DEST); mv bin $(MOZ_PKG_APPNAME)
ifneq ($(MOZ_PKG_APPNAME),mozilla)
@echo "Creating start script $(MOZ_PKG_APPNAME)..."
cd $(MOZ_PKG_DEST)/$(MOZ_PKG_APPNAME); cp mozilla $(MOZ_PKG_APPNAME)
endif
ifeq ($(MOZ_PKG_FORMAT),RPM)
@echo "Sorry, don't know how to build an RPM file yet...."
endif
ifeq ($(MOZ_PKG_FORMAT),DEB)
@echo "Sorry, don't know how to build a DEB file yet...."
@echo "Compressing..."
cd $(MOZ_PKG_DEST); $(MAKE_PACKAGE)
@echo "Deleting work files..."
@cd $(MOZ_PKG_DEST); rm -rf $(MOZ_PKG_APPNAME)
@echo "Done creating $(PACKAGE)."
endif

View File

@ -52,6 +52,7 @@ bin/libgkgfx.so
bin/run-mozilla.sh
bin/regExport
bin/regxpcom
bin/regchrome
bin/splash.xpm
; this is used by gtk embedding clients
bin/libgtkembedmoz.so
@ -196,6 +197,7 @@ bin/chrome/comm.jar
bin/chrome/modern.jar
bin/chrome/classic.jar
bin/chrome/embed.jar
bin/chrome/installed-chrome.txt
;-bin/chrome/comm/content/editor/EditorInitPage.html
;-bin/chrome/comm/content/editor/content/EditorInitPagePlain.html
;Include this for "debug" testing - remove for actual beta release:

View File

@ -70,6 +70,7 @@ $return = GetOptions(
"help|h", \$help,
"debug=i", \$debug,
"verbose|v", \$verbose,
"flat|l", \$flat,
"<>", \&do_badargument
);
@ -210,7 +211,11 @@ sub do_delete
my ($targetpath) = $_[0];
my ($targetcomp) = $_[1];
my ($targetfile) = $_[2];
my ($target) = "$targetpath$PD$targetcomp$PD$targetfile";
if ($flat) {
my ($target) = "$targetpath$PD$targetfile";
} else {
my ($target) = "$targetpath$PD$targetcomp$PD$targetfile";
}
($debug >= 2) && print "do_delete():\n";
($debug >= 1) && print "-$targetfile\n";
@ -243,6 +248,7 @@ sub do_delete
sub do_copyfile
{
my ($destpath) = ""; # destination directory path
my ($destpathcomp) = ""; # ditto, but possibly including component dir
my ($destname) = ""; # destination file name
my ($destsuffix) = ""; # destination file name suffix
my ($altpath) = ""; # alternate destination directory path
@ -270,21 +276,26 @@ sub do_copyfile
}
# set the destination path, if alternate destination given, use it.
if ($flat) {
$destpathcomp = "$destdir";
} else {
$destpathcomp = "$destdir$PD$component";
}
if ( $altdest ne "" ) {
if ( $dirflag ) { # directory copy to altdest
($destname, $destpath, $destsuffix) = fileparse("$destdir$PD$component$PD$altdest$PD$File::Find::name", '\..*?$');
($destname, $destpath, $destsuffix) = fileparse("$destpathcomp$PD$altdest$PD$File::Find::name", '\..*?$');
# Todo: add MSDOS hack
$destpath =~ s/$srcdir$PD$line$PD//; # rm info added by find
($debug >= 5) &&
print " dir copy to altdest: $destpath $destname $destsuffix\n";
} else { # single file copy to altdest
($destname, $destpath, $destsuffix) = fileparse("$destdir$PD$component$PD$altdest", '\..*?$');
($destname, $destpath, $destsuffix) = fileparse("$destpathcomp$PD$altdest", '\..*?$');
($debug >= 5) &&
print " file copy to altdest: $destpath $destname $destsuffix\n";
}
} else {
if ( $dirflag ) { # directory copy, no altdest
($destname, $destpath, $destsuffix) = fileparse("$destdir$PD$component$PD$File::Find::name", '\..*?$');
($destname, $destpath, $destsuffix) = fileparse("$destpathcomp$PD$File::Find::name", '\..*?$');
# avert your eyes now, butt-ugly hack
if ( $os eq "MSDOS" ) {
@ -303,7 +314,7 @@ sub do_copyfile
($debug >= 5) &&
print " dir copy w/o altdest: $destpath $destname $destsuffix\n";
} else { # single file copy, no altdest
($destname, $destpath, $destsuffix) = fileparse("$destdir$PD$component$PD$line", '\..*?$');
($destname, $destpath, $destsuffix) = fileparse("$destpathcomp$PD$line", '\..*?$');
($debug >= 5) &&
print " file copy w/o altdest: $destpath $destname $destsuffix\n";
}
@ -440,12 +451,14 @@ sub do_component
print "[$component]\n";
}
# create component directory
if ( -d "$destdir$PD$component" ) {
warn "Warning: component directory \"$component\" already exists in \"$destdir\".\n";
} else {
($debug >= 4) && print " mkdir $destdir$PD$component\n";
mkdir ("$destdir$PD$component", 0755) ||
die "Error: couldn't create component directory \"$component\": $!. Exiting...\n";
if (!$flat) {
if ( -d "$destdir$PD$component" ) {
warn "Warning: component directory \"$component\" already exists in \"$destdir\".\n";
} else {
($debug >= 4) && print " mkdir $destdir$PD$component\n";
mkdir ("$destdir$PD$component", 0755) ||
die "Error: couldn't create component directory \"$component\": $!. Exiting...\n";
}
}
}
@ -599,6 +612,11 @@ NOTE: Source and destination directories must be absolute paths.
"-c browser -c mail" to copy mail and news only).
Optional.
-l, --flat
Suppresses creation of components dirs, but stuffes everything
directly into the package destination dir. This is useful
for creating tarballs.
-h, --help
Prints this information.
Optional.

View File

@ -3,4 +3,4 @@ pref("xpinstall.manual_confirm", true);
pref("xpinstall.notifications.enabled", true);
pref("xpinstall.notifications.interval", 1);
pref("xpinstall.notifications.lastDate", 0);
pref("xpinstall.notifications.lastDate", 0);