Compare commits
1 Commits
tags/commi
...
tags/pre-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af3598ba92 |
@@ -1,816 +0,0 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Stephen Lamm
|
||||
# Benjamin Smedberg <bsmedberg@covad.net>
|
||||
# Chase Phillips <chase@mozilla.org>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Build a mozilla application.
|
||||
#
|
||||
# To checkout and build a tree,
|
||||
# 1. cvs co mozilla/client.mk
|
||||
# 2. cd mozilla
|
||||
# 3. create your .mozconfig file with
|
||||
# mk_add_options MOZ_CO_PROJECT=suite,browser,mail,minimo,xulrunner
|
||||
# 4. gmake -f client.mk
|
||||
#
|
||||
# This script will pick up the CVSROOT from the CVS/Root file. If you wish
|
||||
# to use a different CVSROOT, you must set CVSROOT in your environment:
|
||||
#
|
||||
# export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
# export CVSROOT=:pserver:username%somedomain.org@cvs.mozilla.org:/cvsroot
|
||||
#
|
||||
# You must specify which products/modules you wish to checkout, with
|
||||
# MOZ_CO_PROJECT, MOZ_CO_MODULE, and BUILD_MODULES variables.
|
||||
#
|
||||
# MOZ_CO_PROJECT possibilities include the following:
|
||||
# suite (Seamonkey suite)
|
||||
# browser (aka Firefox)
|
||||
# mail (aka Thunderbird)
|
||||
# minimo (small browser for devices)
|
||||
# composer (standalone composer, aka NVU)
|
||||
# calendar (aka Sunbird, use this to build the calendar extensions also)
|
||||
# xulrunner
|
||||
# macbrowser (aka Camino)
|
||||
#
|
||||
# Other common MOZ_CO_MODULE options include the following:
|
||||
# mozilla/other-licenses/libart_lgpl
|
||||
# mozilla/other-licenses/bsdiff
|
||||
# mozilla/tools/codesighs
|
||||
#
|
||||
# Other targets (gmake -f client.mk [targets...]),
|
||||
# checkout
|
||||
# build
|
||||
# clean (realclean is now the same as clean)
|
||||
# distclean
|
||||
#
|
||||
# See http://www.mozilla.org/build/ for more information.
|
||||
#
|
||||
# Options:
|
||||
# MOZ_OBJDIR - Destination object directory
|
||||
# MOZ_CO_DATE - Date tag to use for checkout (default: none)
|
||||
# MOZ_CO_MODULE - Module to checkout
|
||||
# MOZ_CVS_FLAGS - Flags to pass cvs (default: -q -z3)
|
||||
# MOZ_CO_FLAGS - Flags to pass after 'cvs co' (default: -P)
|
||||
# MOZ_MAKE_FLAGS - Flags to pass to $(MAKE)
|
||||
# MOZ_CO_LOCALES - localizations to pull (MOZ_CO_LOCALES="de-DE,pt-BR")
|
||||
# MOZ_LOCALE_DIRS - directories which contain localizations
|
||||
# LOCALES_CVSROOT - CVSROOT to use to pull localizations
|
||||
#
|
||||
|
||||
AVAILABLE_PROJECTS = \
|
||||
all \
|
||||
suite \
|
||||
toolkit \
|
||||
browser \
|
||||
mail \
|
||||
minimo \
|
||||
composer \
|
||||
calendar \
|
||||
xulrunner \
|
||||
macbrowser \
|
||||
$(NULL)
|
||||
|
||||
MODULES_core := \
|
||||
SeaMonkeyAll \
|
||||
mozilla/browser/config/version.txt \
|
||||
mozilla/mail/config/version.txt \
|
||||
mozilla/ipc/ipcd \
|
||||
mozilla/modules/libpr0n \
|
||||
mozilla/modules/libmar \
|
||||
mozilla/modules/libbz2 \
|
||||
mozilla/accessible \
|
||||
mozilla/security/manager \
|
||||
mozilla/toolkit \
|
||||
mozilla/storage \
|
||||
mozilla/db/sqlite3 \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_core := \
|
||||
netwerk \
|
||||
dom \
|
||||
$(NULL)
|
||||
|
||||
MODULES_toolkit := \
|
||||
$(MODULES_core) \
|
||||
mozilla/chrome \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_toolkit := \
|
||||
$(LOCALES_core) \
|
||||
toolkit \
|
||||
security/manager \
|
||||
$(NULL)
|
||||
|
||||
MODULES_suite := \
|
||||
$(MODULES_core) \
|
||||
mozilla/suite \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_suite := \
|
||||
$(LOCALES_core) \
|
||||
$(NULL)
|
||||
|
||||
MODULES_browser := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/browser \
|
||||
mozilla/other-licenses/branding/firefox \
|
||||
mozilla/other-licenses/7zstub/firefox \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_browser := \
|
||||
$(LOCALES_toolkit) \
|
||||
browser \
|
||||
other-licenses/branding/firefox \
|
||||
$(NULL)
|
||||
|
||||
BOOTSTRAP_browser := mozilla/browser/config/mozconfig
|
||||
|
||||
MODULES_minimo := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/minimo \
|
||||
$(NULL)
|
||||
|
||||
MODULES_mail := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/mail \
|
||||
mozilla/other-licenses/branding/thunderbird \
|
||||
mozilla/other-licenses/7zstub/thunderbird \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_mail := \
|
||||
$(LOCALES_toolkit) \
|
||||
mail \
|
||||
other-licenses/branding/thunderbird \
|
||||
editor/ui \
|
||||
$(NULL)
|
||||
|
||||
BOOTSTRAP_mail := mozilla/mail/config/mozconfig
|
||||
|
||||
MODULES_composer := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/composer \
|
||||
$(NULL)
|
||||
|
||||
MODULES_calendar := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/storage \
|
||||
mozilla/db/sqlite3 \
|
||||
mozilla/calendar \
|
||||
$(NULL)
|
||||
|
||||
BOOTSTRAP_calendar := mozilla/calendar/sunbird/config/mozconfig
|
||||
|
||||
MODULES_xulrunner := \
|
||||
$(MODULES_toolkit) \
|
||||
mozilla/xulrunner \
|
||||
$(NULL)
|
||||
|
||||
LOCALES_xulrunner := \
|
||||
$(LOCALES_toolkit) \
|
||||
$(NULL)
|
||||
|
||||
BOOTSTRAP_xulrunner := mozilla/xulrunner/config/mozconfig
|
||||
|
||||
MODULES_macbrowser := \
|
||||
$(MODULES_core) \
|
||||
mozilla/camino \
|
||||
$(NULL)
|
||||
|
||||
BOOTSTRAP_macbrowser := mozilla/camino/config/mozconfig
|
||||
|
||||
MODULES_all := \
|
||||
mozilla/other-licenses/bsdiff \
|
||||
mozilla/other-licenses/libart_lgpl \
|
||||
mozilla/tools/trace-malloc \
|
||||
mozilla/tools/jprof \
|
||||
mozilla/tools/codesighs \
|
||||
mozilla/tools/update-packaging \
|
||||
mozilla/other-licenses/branding \
|
||||
mozilla/other-licenses/7zstub \
|
||||
$(NULL)
|
||||
|
||||
#######################################################################
|
||||
# Checkout Tags
|
||||
#
|
||||
# For branches, uncomment the MOZ_CO_TAG line with the proper tag,
|
||||
# and commit this file on that tag.
|
||||
MOZ_CO_TAG = MOZILLA_1_8_BRANCH
|
||||
NSPR_CO_TAG = MOZILLA_1_8_BRANCH
|
||||
NSS_CO_TAG = MOZILLA_1_8_BRANCH
|
||||
LDAPCSDK_CO_TAG = MOZILLA_1_8_BRANCH
|
||||
LOCALES_CO_TAG = MOZILLA_1_8_BRANCH
|
||||
|
||||
BUILD_MODULES = all
|
||||
|
||||
#######################################################################
|
||||
# Defines
|
||||
#
|
||||
CVS = cvs
|
||||
comma := ,
|
||||
|
||||
CWD := $(shell pwd)
|
||||
|
||||
ifeq "$(CWD)" "/"
|
||||
CWD := /.
|
||||
endif
|
||||
|
||||
ifneq (, $(wildcard client.mk))
|
||||
# Ran from mozilla directory
|
||||
ROOTDIR := $(shell dirname $(CWD))
|
||||
TOPSRCDIR := $(CWD)
|
||||
else
|
||||
# Ran from mozilla/.. directory (?)
|
||||
ROOTDIR := $(CWD)
|
||||
TOPSRCDIR := $(CWD)/mozilla
|
||||
endif
|
||||
|
||||
# on os2, TOPSRCDIR may have two forward slashes in a row, which doesn't
|
||||
# work; replace first instance with one forward slash
|
||||
TOPSRCDIR := $(shell echo "$(TOPSRCDIR)" | sed -e 's%//%/%')
|
||||
|
||||
ifndef TOPSRCDIR_MOZ
|
||||
TOPSRCDIR_MOZ=$(TOPSRCDIR)
|
||||
endif
|
||||
|
||||
# if ROOTDIR equals only drive letter (i.e. "C:"), set to "/"
|
||||
DIRNAME := $(shell echo "$(ROOTDIR)" | sed -e 's/^.://')
|
||||
ifeq ($(DIRNAME),)
|
||||
ROOTDIR := /.
|
||||
endif
|
||||
|
||||
AUTOCONF := autoconf
|
||||
MKDIR := mkdir
|
||||
SH := /bin/sh
|
||||
ifndef MAKE
|
||||
MAKE := gmake
|
||||
endif
|
||||
|
||||
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
|
||||
ifdef CONFIG_GUESS_SCRIPT
|
||||
CONFIG_GUESS = $(shell $(CONFIG_GUESS_SCRIPT))
|
||||
else
|
||||
_IS_FIRST_CHECKOUT := 1
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS
|
||||
|
||||
# Add the CVS root to CVS_FLAGS if needed
|
||||
CVS_ROOT_IN_TREE := $(shell cat $(TOPSRCDIR)/CVS/Root 2>/dev/null)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),)
|
||||
ifneq ($(CVS_ROOT_IN_TREE),$(CVSROOT))
|
||||
CVS_FLAGS := -d $(CVS_ROOT_IN_TREE)
|
||||
endif
|
||||
endif
|
||||
|
||||
CVS_CO_DATE_FLAGS = $(if $(MOZ_CO_DATE),-D "$(MOZ_CO_DATE)")
|
||||
CVSCO = $(CVS) $(CVS_FLAGS) co $(MOZ_CO_FLAGS) $(if $(MOZ_CO_TAG),-r $(MOZ_CO_TAG)) $(CVS_CO_DATE_FLAGS)
|
||||
|
||||
CVSCO_LOGFILE := $(ROOTDIR)/cvsco.log
|
||||
CVSCO_LOGFILE := $(shell echo $(CVSCO_LOGFILE) | sed s%//%/%)
|
||||
|
||||
# if LOCALES_CVSROOT is not specified, set it here
|
||||
# (and let mozconfig override it)
|
||||
LOCALES_CVSROOT ?= :pserver:anonymous@cvs-mirror.mozilla.org:/l10n
|
||||
|
||||
####################################
|
||||
# Load mozconfig Options
|
||||
|
||||
# See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
|
||||
|
||||
MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
|
||||
MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
|
||||
MOZCONFIG_MODULES := mozilla/build/unix/modules.mk mozilla/build/unix/uniq.pl
|
||||
run_for_side_effects := \
|
||||
$(shell cd $(ROOTDIR); \
|
||||
if test "$(_IS_FIRST_CHECKOUT)"; then \
|
||||
$(CVSCO) $(MOZCONFIG_FINDER) $(MOZCONFIG_LOADER) $(MOZCONFIG_MODULES); \
|
||||
else true; \
|
||||
fi; \
|
||||
$(MOZCONFIG_LOADER) $(TOPSRCDIR) mozilla/.mozconfig.mk > mozilla/.mozconfig.out)
|
||||
include $(TOPSRCDIR)/.mozconfig.mk
|
||||
include $(TOPSRCDIR)/build/unix/modules.mk
|
||||
|
||||
####################################
|
||||
# Options that may come from mozconfig
|
||||
|
||||
MOZ_PROJECT_LIST := $(subst $(comma), ,$(MOZ_CO_PROJECT))
|
||||
|
||||
ifneq (,$(filter-out $(AVAILABLE_PROJECTS),$(MOZ_PROJECT_LIST)))
|
||||
$(error MOZ_CO_PROJECT contains an unrecognized project.)
|
||||
endif
|
||||
|
||||
ifeq (all,$(filter all,$(MOZ_PROJECT_LIST)))
|
||||
MOZ_PROJECT_LIST := $(AVAILABLE_PROJECTS)
|
||||
endif
|
||||
|
||||
MOZ_MODULE_LIST := $(subst $(comma), ,$(MOZ_CO_MODULE)) $(foreach project,$(MOZ_PROJECT_LIST),$(MODULES_$(project)))
|
||||
LOCALE_DIRS := $(MOZ_LOCALE_DIRS) $(foreach project,$(MOZ_PROJECT_LIST),$(LOCALES_$(project)))
|
||||
|
||||
MOZCONFIG_MODULES += $(foreach project,$(MOZ_PROJECT_LIST),$(BOOTSTRAP_$(project)))
|
||||
|
||||
# Using $(sort) here because it also removes duplicate entries.
|
||||
MOZ_MODULE_LIST := $(sort $(MOZ_MODULE_LIST))
|
||||
LOCALE_DIRS := $(sort $(LOCALE_DIRS))
|
||||
MOZCONFIG_MODULES := $(sort $(MOZCONFIG_MODULES))
|
||||
|
||||
# Change CVS flags if anonymous root is requested
|
||||
ifdef MOZ_CO_USE_MIRROR
|
||||
CVS_FLAGS := -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
||||
endif
|
||||
|
||||
# MOZ_CVS_FLAGS - Basic CVS flags
|
||||
ifeq "$(origin MOZ_CVS_FLAGS)" "undefined"
|
||||
CVS_FLAGS := $(CVS_FLAGS) -q -z 3
|
||||
else
|
||||
CVS_FLAGS := $(MOZ_CVS_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_OBJDIR
|
||||
OBJDIR := $(MOZ_OBJDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
|
||||
else
|
||||
OBJDIR := $(TOPSRCDIR)
|
||||
MOZ_MAKE := $(MAKE) $(MOZ_MAKE_FLAGS)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for NSS
|
||||
#
|
||||
NSS_CO_MODULE = \
|
||||
mozilla/security/nss \
|
||||
mozilla/security/coreconf \
|
||||
$(NULL)
|
||||
|
||||
NSS_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSS_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
NSS_CO_FLAGS := $(NSS_CO_FLAGS) $(if $(NSS_CO_TAG),-r $(NSS_CO_TAG),-A)
|
||||
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSS_CO_TAG),NSS_CLIENT_TAG)
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(NSS_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSS = $(CVS) $(CVS_FLAGS) co $(NSS_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSS_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for NSPR
|
||||
#
|
||||
NSPR_CO_MODULE = mozilla/nsprpub
|
||||
NSPR_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
NSPR_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
NSPR_CO_FLAGS := $(NSPR_CO_FLAGS) $(if $(NSPR_CO_TAG),-r $(NSPR_CO_TAG),-A)
|
||||
|
||||
# Cannot pull static tags by date
|
||||
ifeq ($(NSPR_CO_TAG),NSPRPUB_CLIENT_TAG)
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(NSPR_CO_MODULE)
|
||||
else
|
||||
CVSCO_NSPR = $(CVS) $(CVS_FLAGS) co $(NSPR_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(NSPR_CO_MODULE)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# CVS defines for the C LDAP SDK
|
||||
#
|
||||
LDAPCSDK_CO_MODULE = mozilla/directory/c-sdk
|
||||
LDAPCSDK_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
LDAPCSDK_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
LDAPCSDK_CO_FLAGS := $(LDAPCSDK_CO_FLAGS) $(if $(LDAPCSDK_CO_TAG),-r $(LDAPCSDK_CO_TAG),-A)
|
||||
CVSCO_LDAPCSDK = $(CVS) $(CVS_FLAGS) co $(LDAPCSDK_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(LDAPCSDK_CO_MODULE)
|
||||
|
||||
####################################
|
||||
# CVS defines for standalone modules
|
||||
#
|
||||
ifeq ($(BUILD_MODULES),all)
|
||||
CHECKOUT_STANDALONE := true
|
||||
CHECKOUT_STANDALONE_NOSUBDIRS := true
|
||||
else
|
||||
STANDALONE_CO_MODULE := $(filter-out $(NSPRPUB_DIR) security directory/c-sdk, $(BUILD_MODULE_CVS))
|
||||
STANDALONE_CO_MODULE += allmakefiles.sh client.mk aclocal.m4 configure configure.in
|
||||
STANDALONE_CO_MODULE += Makefile.in
|
||||
|
||||
MOZ_MODULE_LIST += $(addprefix mozilla/,$(STANDALONE_CO_MODULE))
|
||||
NOSUBDIRS_MODULE := $(addprefix mozilla/,$(BUILD_MODULE_CVS_NS))
|
||||
|
||||
ifeq (,$(filter $(NSPRPUB_DIR), $(BUILD_MODULE_CVS))$(MOZ_CO_PROJECT))
|
||||
CVSCO_NSPR :=
|
||||
endif
|
||||
ifeq (,$(filter security security/manager, $(BUILD_MODULE_CVS))$(MOZ_CO_PROJECT))
|
||||
CVSCO_NSS :=
|
||||
endif
|
||||
ifeq (,$(filter directory/c-sdk, $(BUILD_MODULE_CVS))$(MOZ_CO_PROJECT))
|
||||
CVSCO_LDAPCSDK :=
|
||||
endif
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Error on obsolete variables.
|
||||
#
|
||||
|
||||
ifdef MOZ_MAPINFO
|
||||
$(warning MOZ_MAPINFO is obsolete, use MOZ_CO_MODULE=mozilla/tools/codesighs instead.)
|
||||
MOZ_MODULE_LIST += mozilla/tools/codesighs
|
||||
endif
|
||||
ifdef MOZ_INTERNAL_LIBART_LGPL
|
||||
$(error MOZ_INTERNAL_LIBART_LGPL is obsolete, use MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl instead.)
|
||||
endif
|
||||
ifdef MOZ_PHOENIX
|
||||
$(warning MOZ_PHOENIX is obsolete.)
|
||||
MOZ_MODULE_LIST += $(MODULES_browser)
|
||||
# $(error MOZ_PHOENIX is obsolete, use MOZ_CO_PROJECT=browser and --enable-application=browser)
|
||||
endif
|
||||
ifdef MOZ_THUNDERBIRD
|
||||
$(warning MOZ_THUNDERBIRD is obsolete.)
|
||||
MOZ_MODULE_LIST += $(MODULES_mail)
|
||||
# $(error MOZ_THUNDERBIRD is obsolete, use MOZ_CO_PROJECT=mail and --enable-application=mail)
|
||||
endif
|
||||
|
||||
###################################
|
||||
# Checkout main modules
|
||||
#
|
||||
|
||||
# sort is used to remove duplicates. SeaMonkeyAll is special-cased to
|
||||
# checkout last, because if you check it out first, there is a sticky
|
||||
# tag left over from checking out the LDAP SDK, which causes files in
|
||||
# the root directory to be missed.
|
||||
MOZ_MODULE_LIST := $(sort $(filter-out SeaMonkeyAll,$(MOZ_MODULE_LIST))) $(firstword $(filter SeaMonkeyAll,$(MOZ_MODULE_LIST)))
|
||||
|
||||
MODULES_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
MODULES_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
MODULES_CO_FLAGS := $(MODULES_CO_FLAGS) $(if $(MOZ_CO_TAG),-r $(MOZ_CO_TAG),-A)
|
||||
|
||||
CVSCO_MODULES_NS = $(CVS) $(CVS_FLAGS) co $(MODULES_CO_FLAGS) $(CVS_CO_DATE_FLAGS) -l $(NOSUBDIRS_MODULE)
|
||||
|
||||
ifeq (,$(strip $(MOZ_MODULE_LIST)))
|
||||
FASTUPDATE_MODULES = $(error No modules or projects were specified. Use MOZ_CO_PROJECT to specify a project for checkout.)
|
||||
CHECKOUT_MODULES = $(error No modules or projects were specified. Use MOZ_CO_PROJECT to specify a project for checkout.)
|
||||
else
|
||||
FASTUPDATE_MODULES := fast_update $(CVS) $(CVS_FLAGS) co $(MODULES_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(MOZ_MODULE_LIST)
|
||||
CHECKOUT_MODULES := $(foreach module,$(MOZ_MODULE_LIST),cvs_co $(CVS) $(CVS_FLAGS) co $(MODULES_CO_FLAGS) $(CVS_CO_DATE_FLAGS) $(module);)
|
||||
endif
|
||||
ifeq (,$(NOSUBDIRS_MODULE))
|
||||
FASTUPDATE_MODULES_NS := true
|
||||
CHECKOUT_MODULES_NS := true
|
||||
else
|
||||
FASTUPDATE_MODULES_NS := fast_update $(CVSCO_MODULES_NS)
|
||||
CHECKOUT_MODULES_NS := cvs_co $(CVSCO_MODULES_NS)
|
||||
endif
|
||||
|
||||
###################################
|
||||
# CVS defines for locales
|
||||
#
|
||||
|
||||
LOCALES_CO_FLAGS := -P
|
||||
ifdef MOZ_CO_FLAGS
|
||||
LOCALES_CO_FLAGS := $(MOZ_CO_FLAGS)
|
||||
endif
|
||||
LOCALES_CO_FLAGS := $(LOCALES_CO_FLAGS) $(if $(LOCALES_CO_TAG),-r $(LOCALES_CO_TAG),-A)
|
||||
|
||||
ifndef MOZ_CO_LOCALES
|
||||
FASTUPDATE_LOCALES := true
|
||||
CHECKOUT_LOCALES := true
|
||||
else
|
||||
|
||||
override MOZ_CO_LOCALES := $(subst $(comma), ,$(MOZ_CO_LOCALES))
|
||||
|
||||
ifeq (all,$(MOZ_CO_LOCALES))
|
||||
MOZCONFIG_MODULES += $(foreach project,$(MOZ_PROJECT_LIST),mozilla/$(project)/locales/all-locales)
|
||||
|
||||
LOCALE_CO_DIRS := $(sort $(foreach project,$(MOZ_PROJECT_LIST),$(foreach locale,$(shell cat mozilla/$(project)/locales/all-locales),$(foreach dir,$(LOCALES_$(project)),l10n/$(locale)/$(dir)))))
|
||||
else # MOZ_CO_LOCALES != all
|
||||
LOCALE_CO_DIRS = $(sort $(foreach locale,$(MOZ_CO_LOCALES),$(foreach dir,$(LOCALE_DIRS),l10n/$(locale)/$(dir))))
|
||||
endif
|
||||
|
||||
CVSCO_LOCALES := $(CVS) $(CVS_FLAGS) -d $(LOCALES_CVSROOT) co $(LOCALES_CO_FLAGS) $(LOCALE_CO_DIRS)
|
||||
|
||||
FASTUPDATE_LOCALES := fast_update $(CVSCO_LOCALES)
|
||||
CHECKOUT_LOCALES := cvs_co $(CVSCO_LOCALES)
|
||||
endif #MOZ_CO_LOCALES
|
||||
|
||||
#######################################################################
|
||||
# Rules
|
||||
#
|
||||
|
||||
# Print out any options loaded from mozconfig.
|
||||
all build checkout clean depend distclean export libs install realclean::
|
||||
@if test -f .mozconfig.out; then \
|
||||
cat .mozconfig.out; \
|
||||
rm -f .mozconfig.out; \
|
||||
else true; \
|
||||
fi
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
all:: checkout build
|
||||
else
|
||||
all:: checkout alldep
|
||||
endif
|
||||
|
||||
# Windows equivalents
|
||||
pull_all: checkout
|
||||
build_all: build
|
||||
build_all_dep: alldep
|
||||
build_all_depend: alldep
|
||||
clobber clobber_all: clean
|
||||
pull_and_build_all: checkout alldep
|
||||
|
||||
# Do everything from scratch
|
||||
everything: checkout clean build
|
||||
|
||||
####################################
|
||||
# CVS checkout
|
||||
#
|
||||
checkout::
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/client.mk $(MOZCONFIG_MODULES)'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) $(CVS_CO_DATE_FLAGS) mozilla/client.mk $(MOZCONFIG_MODULES)
|
||||
@cd $(ROOTDIR) && $(MAKE) -f mozilla/client.mk real_checkout
|
||||
|
||||
# Start the checkout. Split the output to the tty and a log file.
|
||||
|
||||
real_checkout:
|
||||
@set -e; \
|
||||
cvs_co() { set -e; echo "$$@" ; \
|
||||
"$$@" 2>&1 | tee -a $(CVSCO_LOGFILE); }; \
|
||||
cvs_co $(CVSCO_NSPR); \
|
||||
cvs_co $(CVSCO_NSS); \
|
||||
cvs_co $(CVSCO_LDAPCSDK); \
|
||||
$(CHECKOUT_MODULES) \
|
||||
$(CHECKOUT_MODULES_NS); \
|
||||
$(CHECKOUT_LOCALES);
|
||||
@echo "checkout finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# update the NSS checkout timestamp
|
||||
@if test `egrep -c '^(U|C) mozilla/security/(nss|coreconf)' $(CVSCO_LOGFILE) 2>/dev/null` != 0; then \
|
||||
touch $(TOPSRCDIR)/security/manager/.nss.checkout; \
|
||||
fi
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during checkout." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
fast-update:
|
||||
# @: Backup the last checkout log.
|
||||
@if test -f $(CVSCO_LOGFILE) ; then \
|
||||
mv $(CVSCO_LOGFILE) $(CVSCO_LOGFILE).old; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo "Removing local configures" ; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(RM) -f mozilla/configure mozilla/nsprpub/configure \
|
||||
mozilla/directory/c-sdk/configure
|
||||
endif
|
||||
@echo "checkout start: "`date` | tee $(CVSCO_LOGFILE)
|
||||
@echo '$(CVSCO) mozilla/client.mk $(MOZCONFIG_MODULES)'; \
|
||||
cd $(ROOTDIR) && \
|
||||
$(CVSCO) mozilla/client.mk $(MOZCONFIG_MODULES)
|
||||
@cd $(TOPSRCDIR) && \
|
||||
$(MAKE) -f client.mk real_fast-update
|
||||
|
||||
# Start the update. Split the output to the tty and a log file.
|
||||
real_fast-update:
|
||||
@set -e; \
|
||||
fast_update() { set -e; config/cvsco-fast-update.pl $$@ 2>&1 | tee -a $(CVSCO_LOGFILE); }; \
|
||||
cvs_co() { set -e; echo "$$@" ; \
|
||||
"$$@" 2>&1 | tee -a $(CVSCO_LOGFILE); }; \
|
||||
fast_update $(CVSCO_NSPR); \
|
||||
cd $(ROOTDIR); \
|
||||
cvs_co $(CVSCO_NSS); \
|
||||
cd mozilla; \
|
||||
fast_update $(CVSCO_LDAPCSDK); \
|
||||
$(FASTUPDATE_MODULES); \
|
||||
$(FASTUPDATE_MODULES_NS); \
|
||||
$(FASTUPDATE_LOCALES);
|
||||
@echo "fast_update finish: "`date` | tee -a $(CVSCO_LOGFILE)
|
||||
# update the NSS checkout timestamp
|
||||
@if test `egrep -c '^(U|C) mozilla/security/(nss|coreconf)' $(CVSCO_LOGFILE) 2>/dev/null` != 0; then \
|
||||
touch $(TOPSRCDIR)/security/manager/.nss.checkout; \
|
||||
fi
|
||||
# @: Check the log for conflicts. ;
|
||||
@conflicts=`egrep "^C " $(CVSCO_LOGFILE)` ;\
|
||||
if test "$$conflicts" ; then \
|
||||
echo "$(MAKE): *** Conflicts during fast-update." ;\
|
||||
echo "$$conflicts" ;\
|
||||
echo "$(MAKE): Refer to $(CVSCO_LOGFILE) for full log." ;\
|
||||
false; \
|
||||
else true; \
|
||||
fi
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
@echo Generating configures using $(AUTOCONF) ; \
|
||||
cd $(TOPSRCDIR) && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/nsprpub && $(AUTOCONF) && \
|
||||
cd $(TOPSRCDIR)/directory/c-sdk && $(AUTOCONF)
|
||||
endif
|
||||
|
||||
####################################
|
||||
# Web configure
|
||||
|
||||
WEBCONFIG_FILE := $(HOME)/.mozconfig
|
||||
|
||||
MOZCONFIG2CONFIGURATOR := build/autoconf/mozconfig2configurator
|
||||
webconfig:
|
||||
@cd $(TOPSRCDIR); \
|
||||
url=`$(MOZCONFIG2CONFIGURATOR) $(TOPSRCDIR)`; \
|
||||
echo Running mozilla with the following url: ;\
|
||||
echo ;\
|
||||
echo $$url ;\
|
||||
mozilla -remote "openURL($$url)" || \
|
||||
netscape -remote "openURL($$url)" || \
|
||||
mozilla $$url || \
|
||||
netscape $$url ;\
|
||||
echo ;\
|
||||
echo 1. Fill out the form on the browser. ;\
|
||||
echo 2. Save the results to $(WEBCONFIG_FILE)
|
||||
|
||||
#####################################################
|
||||
# First Checkout
|
||||
|
||||
ifdef _IS_FIRST_CHECKOUT
|
||||
# First time, do build target in a new process to pick up new files.
|
||||
build::
|
||||
$(MAKE) -f $(TOPSRCDIR)/client.mk build
|
||||
else
|
||||
|
||||
#####################################################
|
||||
# After First Checkout
|
||||
|
||||
|
||||
####################################
|
||||
# Configure
|
||||
|
||||
CONFIG_STATUS := $(wildcard $(OBJDIR)/config.status)
|
||||
CONFIG_CACHE := $(wildcard $(OBJDIR)/config.cache)
|
||||
|
||||
ifdef RUN_AUTOCONF_LOCALLY
|
||||
EXTRA_CONFIG_DEPS := \
|
||||
$(TOPSRCDIR)/aclocal.m4 \
|
||||
$(wildcard $(TOPSRCDIR)/build/autoconf/*.m4) \
|
||||
$(NULL)
|
||||
|
||||
$(TOPSRCDIR)/configure: $(TOPSRCDIR)/configure.in $(EXTRA_CONFIG_DEPS)
|
||||
@echo Generating $@ using autoconf
|
||||
cd $(TOPSRCDIR); $(AUTOCONF)
|
||||
endif
|
||||
|
||||
CONFIG_STATUS_DEPS := \
|
||||
$(TOPSRCDIR)/configure \
|
||||
$(TOPSRCDIR)/allmakefiles.sh \
|
||||
$(TOPSRCDIR)/.mozconfig.mk \
|
||||
$(wildcard $(TOPSRCDIR)/nsprpub/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/directory/c-sdk/configure) \
|
||||
$(wildcard $(TOPSRCDIR)/mailnews/makefiles) \
|
||||
$(wildcard $(TOPSRCDIR)/themes/makefiles) \
|
||||
$(wildcard $(TOPSRCDIR)/config/milestone.txt) \
|
||||
$(wildcard $(TOPSRCDIR)/config/chrome-versions.sh) \
|
||||
$(NULL)
|
||||
|
||||
# configure uses the program name to determine @srcdir@. Calling it without
|
||||
# $(TOPSRCDIR) will set @srcdir@ to "."; otherwise, it is set to the full
|
||||
# path of $(TOPSRCDIR).
|
||||
ifeq ($(TOPSRCDIR),$(OBJDIR))
|
||||
CONFIGURE := ./configure
|
||||
else
|
||||
CONFIGURE := $(TOPSRCDIR)/configure
|
||||
endif
|
||||
|
||||
ifdef MOZ_TOOLS
|
||||
CONFIGURE := $(TOPSRCDIR)/configure
|
||||
endif
|
||||
|
||||
configure:
|
||||
@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
|
||||
@echo cd $(OBJDIR);
|
||||
@echo $(CONFIGURE) $(CONFIGURE_ARGS)
|
||||
@cd $(OBJDIR) && $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
|
||||
|| ( echo "*** Fix above errors and then restart with\
|
||||
\"$(MAKE) -f client.mk build\"" && exit 1 )
|
||||
@touch $(OBJDIR)/Makefile
|
||||
|
||||
$(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
|
||||
@$(MAKE) -f $(TOPSRCDIR)/client.mk configure
|
||||
|
||||
ifdef CONFIG_STATUS
|
||||
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in
|
||||
cd $(OBJDIR); \
|
||||
CONFIG_FILES=config/autoconf.mk ./config.status
|
||||
endif
|
||||
|
||||
|
||||
####################################
|
||||
# Depend
|
||||
|
||||
depend:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) export && $(MOZ_MAKE) depend
|
||||
|
||||
####################################
|
||||
# Build it
|
||||
|
||||
build:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE)
|
||||
|
||||
####################################
|
||||
# Profile-feedback build (gcc only)
|
||||
# To use this, you should set the following variables in your mozconfig
|
||||
# mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
|
||||
#
|
||||
# The profile script should exercise the functionality to be included
|
||||
# in the profile feedback.
|
||||
|
||||
profiledbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) MOZ_PROFILE_GENERATE=1
|
||||
OBJDIR=${OBJDIR} $(PROFILE_GEN_SCRIPT)
|
||||
$(MOZ_MAKE) clobber_all
|
||||
$(MOZ_MAKE) MOZ_PROFILE_USE=1
|
||||
find $(OBJDIR) -name "*.da" -exec rm {} \;
|
||||
|
||||
####################################
|
||||
# Other targets
|
||||
|
||||
# Pass these target onto the real build system
|
||||
install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
|
||||
$(MOZ_MAKE) $@
|
||||
|
||||
cleansrcdir:
|
||||
@cd $(TOPSRCDIR); \
|
||||
if [ -f webshell/embed/gtk/Makefile ]; then \
|
||||
$(MAKE) -C webshell/embed/gtk distclean; \
|
||||
fi; \
|
||||
if [ -f Makefile ]; then \
|
||||
$(MAKE) distclean ; \
|
||||
else \
|
||||
echo "Removing object files from srcdir..."; \
|
||||
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
|
||||
-o -exec test ! -d {}/CVS \; \) -prune \
|
||||
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
|
||||
build/autoconf/clean-config.sh; \
|
||||
fi;
|
||||
|
||||
# (! IS_FIRST_CHECKOUT)
|
||||
endif
|
||||
|
||||
echo_objdir:
|
||||
@echo $(OBJDIR)
|
||||
|
||||
.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure
|
||||
9
mozilla/xpinstall/wizard/unix/src2/.LIBSREQD.list
Normal file
9
mozilla/xpinstall/wizard/unix/src2/.LIBSREQD.list
Normal file
@@ -0,0 +1,9 @@
|
||||
libjar50.so
|
||||
libjsdom.so
|
||||
libmozjs.so
|
||||
libnspr3.so
|
||||
libplc3.so
|
||||
libplds3.so
|
||||
libxpcom.so
|
||||
libxpinstall.so
|
||||
libxpistub.so
|
||||
352
mozilla/xpinstall/wizard/unix/src2/INSTALL.cpp
Normal file
352
mozilla/xpinstall/wizard/unix/src2/INSTALL.cpp
Normal file
@@ -0,0 +1,352 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1999
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "INSTALL.h"
|
||||
|
||||
static xpistub_t gstub;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int err = XI_OK;
|
||||
xpi_t *pkglist;
|
||||
|
||||
ERR_CHECK( init() );
|
||||
ERR_CHECK( build_list(&pkglist) );
|
||||
ERR_CHECK( install_all(pkglist) );
|
||||
ERR_CHECK( shutdown(pkglist) );
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
init()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
char progdir[512];
|
||||
int err = XI_OK;
|
||||
DUMP("initialize");
|
||||
|
||||
err = extract_core();
|
||||
if (err != XI_OK)
|
||||
{
|
||||
PRINT_ERR(err);
|
||||
shutdown(NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = load_stub();
|
||||
if (err != XI_OK)
|
||||
{
|
||||
PRINT_ERR(err);
|
||||
shutdown(NULL);
|
||||
return err;
|
||||
}
|
||||
|
||||
getcwd(progdir, 512);
|
||||
rv = gstub.fn_init(progdir, progress_callback);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
PRINT_ERR(rv);
|
||||
shutdown(NULL);
|
||||
return XI_XPI_FAIL;
|
||||
}
|
||||
DUMP("XPI_Init called");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
extract_core()
|
||||
{
|
||||
char cmd[256];
|
||||
int i;
|
||||
int err = XI_OK;
|
||||
DUMP("extract_core");
|
||||
|
||||
for (i = 0; i < CORE_LIB_COUNT*2; i++)
|
||||
{
|
||||
strcpy(cmd, "unzip -j "); /* -j = junk paths; install here */
|
||||
strcat(cmd, CORE_ARCHIVE); /* relative path to install.xpi */
|
||||
strcat(cmd, " -d . "); /* -d = destination root */
|
||||
strcat(cmd, core_libs[i]); /* archive subdir */
|
||||
strcat(cmd, core_libs[++i]);/* lib file name */
|
||||
strcat(cmd, "\0");
|
||||
DUMP(cmd);
|
||||
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
load_stub()
|
||||
{
|
||||
char libpath[512];
|
||||
char *dlerr;
|
||||
int err = XI_OK;
|
||||
DUMP("load_stub");
|
||||
|
||||
/* get the working dir and tack on lib name */
|
||||
getcwd(libpath, 512);
|
||||
strncat(libpath, "/", 1);
|
||||
strncat(libpath, XPISTUB, strlen(XPISTUB));
|
||||
DUMP(libpath);
|
||||
|
||||
/* open the library */
|
||||
gstub.handle = NULL;
|
||||
gstub.handle = dlopen(libpath, RTLD_NOW);
|
||||
if (!gstub.handle)
|
||||
{
|
||||
dlerr = dlerror();
|
||||
DUMP(dlerr);
|
||||
return XI_LIB_OPEN;
|
||||
}
|
||||
DUMP("xpistub opened");
|
||||
|
||||
/* read and store symbol addresses */
|
||||
gstub.fn_init = (pfnXPI_Init) dlsym(gstub.handle, FN_INIT);
|
||||
gstub.fn_install = (pfnXPI_Install) dlsym(gstub.handle, FN_INSTALL);
|
||||
gstub.fn_exit = (pfnXPI_Exit) dlsym(gstub.handle, FN_EXIT);
|
||||
if (!gstub.fn_init || !gstub.fn_install || !gstub.fn_exit)
|
||||
{
|
||||
dlerr = dlerror();
|
||||
DUMP(dlerr);
|
||||
return XI_LIB_SYM;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void
|
||||
progress_callback(const char* msg, PRInt32 max, PRInt32 val)
|
||||
{
|
||||
DUMP("progress_callback");
|
||||
if (max == 0)
|
||||
{
|
||||
if (val > 0)
|
||||
printf("Preparing item %d ...\n", val);
|
||||
}
|
||||
else
|
||||
printf("Installing item %d of %d ...\n", val, max);
|
||||
}
|
||||
|
||||
int
|
||||
build_list(xpi_t **listhead)
|
||||
{
|
||||
xpi_t *currxpi = NULL, *lastxpi = NULL;
|
||||
char mfpath[512];
|
||||
char *buf = NULL, *pcurr, curr[32];
|
||||
fpos_t mfeof;
|
||||
FILE *fdmf;
|
||||
size_t rd = 0;
|
||||
int len = 0, total, head;
|
||||
int err = XI_OK;
|
||||
DUMP("build_list");
|
||||
|
||||
if (!listhead)
|
||||
return XI_NULL_PTR;
|
||||
|
||||
*listhead = NULL;
|
||||
|
||||
/* XXX optionally set mf path in cmd line args */
|
||||
strcpy(mfpath, MANIFEST);
|
||||
|
||||
/* open manifest file */
|
||||
fdmf = NULL;
|
||||
fdmf = fopen(mfpath, "r");
|
||||
if (!fdmf)
|
||||
{
|
||||
err = XI_NO_MANIFEST;
|
||||
goto bail;
|
||||
}
|
||||
DUMP("opened manifest");
|
||||
|
||||
/* read the file into a buffer */
|
||||
if (fseek(fdmf, 0, SEEK_END) != 0)
|
||||
{
|
||||
err = XI_NO_MANIFEST;
|
||||
goto bail;
|
||||
}
|
||||
if (fgetpos(fdmf, &mfeof) != 0)
|
||||
{
|
||||
err = XI_NO_MANIFEST;
|
||||
goto bail;
|
||||
}
|
||||
DUMP("eof manifest found");
|
||||
|
||||
buf = (char*) malloc(mfeof * sizeof(char));
|
||||
if (!buf)
|
||||
{
|
||||
err = XI_OUT_OF_MEM;
|
||||
goto bail;
|
||||
}
|
||||
DUMP("malloc'd manifest buf");
|
||||
|
||||
if (fseek(fdmf, 0, SEEK_SET) != 0)
|
||||
{
|
||||
err = XI_NO_MANIFEST;
|
||||
goto bail;
|
||||
}
|
||||
rd = fread( (void*)buf, 1, mfeof, fdmf);
|
||||
if (!rd)
|
||||
{
|
||||
err = XI_NO_MANIFEST;
|
||||
goto bail;
|
||||
}
|
||||
DUMP(buf);
|
||||
|
||||
/* loop over each line reading in a .xpi module
|
||||
* name unless commented with ';'
|
||||
*/
|
||||
head = 1;
|
||||
for (pcurr = buf, total = 0; total < mfeof; pcurr = strchr(pcurr, '\n')+1)
|
||||
{
|
||||
len = strchr(pcurr, '\n') - pcurr;
|
||||
total += len + 1;
|
||||
strncpy(curr, pcurr, len);
|
||||
curr[ (len>32?32:len) ] = '\0';
|
||||
|
||||
/* malloc a new xpi structure */
|
||||
currxpi = (xpi_t *) malloc(sizeof(xpi_t));
|
||||
if (!currxpi)
|
||||
{
|
||||
err = XI_OUT_OF_MEM;
|
||||
goto bail;
|
||||
}
|
||||
currxpi->next = NULL;
|
||||
if (head)
|
||||
{
|
||||
*listhead = currxpi;
|
||||
lastxpi = currxpi;
|
||||
}
|
||||
strncpy(currxpi->name, curr, (len>32?32:len));
|
||||
|
||||
/* link to xpi list */
|
||||
if (!head && *listhead)
|
||||
{
|
||||
lastxpi->next = currxpi;
|
||||
lastxpi = currxpi;
|
||||
}
|
||||
else
|
||||
head = 0;
|
||||
}
|
||||
|
||||
/* close manifest file */
|
||||
fclose(fdmf);
|
||||
|
||||
return err;
|
||||
|
||||
bail:
|
||||
if (buf)
|
||||
free(buf);
|
||||
shutdown(*listhead);
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
install_all(xpi_t *listhead)
|
||||
{
|
||||
xpi_t *curr = listhead;
|
||||
int err = XI_OK;
|
||||
DUMP("install_all");
|
||||
|
||||
if (!listhead)
|
||||
return XI_NULL_PTR;
|
||||
|
||||
while (curr)
|
||||
{
|
||||
install_one(curr);
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
install_one(xpi_t *pkg)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
char xpipath[512];
|
||||
int err = XI_OK;
|
||||
DUMP("install_one");
|
||||
|
||||
getcwd(xpipath, 512);
|
||||
strncat(xpipath, "/modules/", 9);
|
||||
strncat(xpipath, pkg->name, strlen(pkg->name));
|
||||
|
||||
DUMP("--------- installing xpi package: ");
|
||||
DUMP(xpipath);
|
||||
DUMP("---------\n");
|
||||
|
||||
/* XXX check if file exists: if not skip it with status */
|
||||
|
||||
rv = gstub.fn_install(xpipath, "", 0);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
err = XI_XPI_FAIL;
|
||||
printf("ERROR %d: Installation of %s failed.\n", rv, pkg->name);
|
||||
}
|
||||
else
|
||||
printf("Installed %s successfully.\n", pkg->name);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
shutdown(xpi_t *list)
|
||||
{
|
||||
xpi_t *curr = list;
|
||||
int i;
|
||||
int err = XI_OK;
|
||||
DUMP("shutdown");
|
||||
|
||||
/* release XPCOM and XPInstall */
|
||||
if (gstub.fn_exit)
|
||||
{
|
||||
gstub.fn_exit();
|
||||
DUMP("XPI_Exit called");
|
||||
}
|
||||
|
||||
/* close xpistub library */
|
||||
if (gstub.handle)
|
||||
{
|
||||
dlclose(gstub.handle);
|
||||
DUMP("xpistub closed");
|
||||
}
|
||||
|
||||
while (curr)
|
||||
{
|
||||
list = curr->next;
|
||||
free(curr);
|
||||
curr = list;
|
||||
}
|
||||
|
||||
/* clean up extracted core libs */
|
||||
for (i=1; i<CORE_LIB_COUNT*2; i+=2)
|
||||
{
|
||||
unlink(core_libs[i]);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
136
mozilla/xpinstall/wizard/unix/src2/INSTALL.h
Normal file
136
mozilla/xpinstall/wizard/unix/src2/INSTALL.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1999
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _INSTALL_H_
|
||||
#define _INSTALL_H_
|
||||
|
||||
#include "xpistub.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
/*_____________________________________________ func ptrs __*/
|
||||
typedef nsresult (*pfnXPI_Init) (const char *aProgramDir, pfnXPIProgress progressCB);
|
||||
typedef nsresult (*pfnXPI_Install) (const char *file, const char *args, long flags);
|
||||
typedef void (*pfnXPI_Exit) ();
|
||||
|
||||
/*________________________________________________ arrays __*/
|
||||
#define CORE_LIB_COUNT 10
|
||||
static char core_libs[CORE_LIB_COUNT*2][32] =
|
||||
{
|
||||
/* Archive Subdir File */
|
||||
/* -------------- ---- */
|
||||
"bin/", "libjsdom.so",
|
||||
"bin/", "libmozjs.so",
|
||||
"bin/", "libnspr3.so",
|
||||
"bin/", "libplc3.so",
|
||||
"bin/", "libplds3.so",
|
||||
"bin/", "libxpcom.so",
|
||||
"bin/", "libxpistub.so",
|
||||
"bin/components/", "libxpinstall.so",
|
||||
"bin/components/", "libjar50.so",
|
||||
"bin/", "component.reg"
|
||||
};
|
||||
|
||||
/*_______________________________________________ structs __*/
|
||||
typedef struct _xpistub_t
|
||||
{
|
||||
const char *name;
|
||||
void *handle;
|
||||
pfnXPI_Init fn_init;
|
||||
pfnXPI_Install fn_install;
|
||||
pfnXPI_Exit fn_exit;
|
||||
} xpistub_t;
|
||||
|
||||
typedef struct _xpi_t
|
||||
{
|
||||
char name[32];
|
||||
struct _xpi_t *next;
|
||||
} xpi_t;
|
||||
|
||||
/*_________________________________________________ funcs __*/
|
||||
int main(int argc, char **argv);
|
||||
int init();
|
||||
int extract_core();
|
||||
int load_stub();
|
||||
void progress_callback(const char *msg, PRInt32 max, PRInt32 val);
|
||||
int build_list(xpi_t **listhead);
|
||||
int install_all(xpi_t *listhead);
|
||||
int install_one(xpi_t *pkg);
|
||||
int shutdown(xpi_t *list);
|
||||
|
||||
/*________________________________________________ macros __*/
|
||||
#ifdef DEBUG_sgehani___
|
||||
#define DUMP(_msg) \
|
||||
printf("%s %d: ", __FILE__, __LINE__); \
|
||||
printf(_msg); \
|
||||
printf("\n");
|
||||
#else
|
||||
#define DUMP(_msg)
|
||||
#endif
|
||||
|
||||
#define XPISTUB "libxpistub.so"
|
||||
#define FN_INIT "XPI_Init"
|
||||
#define FN_INSTALL "XPI_Install"
|
||||
#define FN_EXIT "XPI_Exit"
|
||||
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define CORE_ARCHIVE "modules/install.xpi"
|
||||
#define MANIFEST "modules/MANIFEST"
|
||||
|
||||
#define ERR_CHECK(_func) \
|
||||
{ \
|
||||
int ret_err = XI_OK; \
|
||||
ret_err = _func; \
|
||||
if (ret_err != XI_OK) \
|
||||
{ \
|
||||
PRINT_ERR(ret_err); \
|
||||
return ret_err; \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sgehani
|
||||
#define PRINT_ERR(_err) \
|
||||
printf("%s %d: err = %d \n", __FILE__, __LINE__, _err);
|
||||
#endif
|
||||
|
||||
/*________________________________________________ errors __*/
|
||||
#define XI_OK 0
|
||||
#define XI_NULL_PTR -1
|
||||
#define XI_OUT_OF_MEM -2
|
||||
#define XI_FAIL -3
|
||||
#define XI_LIB_OPEN -4
|
||||
#define XI_LIB_SYM -5
|
||||
#define XI_XPI_FAIL -6
|
||||
#define XI_NO_MANIFEST -7
|
||||
|
||||
#endif /* _INSTALL_H_ */
|
||||
47
mozilla/xpinstall/wizard/unix/src2/Makefile.in
Normal file
47
mozilla/xpinstall/wizard/unix/src2/Makefile.in
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Samir Gehani <sgehani@netscape.com>
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
PROGRAM = MozInstaller
|
||||
|
||||
CPPSRCS = \
|
||||
nsXInstallerDlg.cpp \
|
||||
nsComponent.cpp \
|
||||
nsSetupType.cpp \
|
||||
nsComponentList.cpp \
|
||||
nsLicenseDlg.cpp \
|
||||
nsWelcomeDlg.cpp \
|
||||
nsSetupTypeDlg.cpp \
|
||||
nsComponentsDlg.cpp \
|
||||
nsInstallDlg.cpp \
|
||||
nsXInstaller.cpp \
|
||||
nsINIParser.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
51
mozilla/xpinstall/wizard/unix/src2/XIErrors.h
Normal file
51
mozilla/xpinstall/wizard/unix/src2/XIErrors.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _XI_ERRORS_H_
|
||||
#define _XI_ERRORS_H_
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
* X Installer Errors
|
||||
*------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
OK = 0,
|
||||
E_MEM = -601, /* out of memory */
|
||||
E_PARAM = -602, /* invalid param */
|
||||
E_NO_MEMBER = -603 /* invalid member variable */
|
||||
};
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#endif /* _XI_ERRORS_H_ */
|
||||
32
mozilla/xpinstall/wizard/unix/src2/XILimits.h
Normal file
32
mozilla/xpinstall/wizard/unix/src2/XILimits.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _XILIMITS_H_
|
||||
#define _XILIMITS_H_
|
||||
|
||||
#define MAX_COMPONENTS 64
|
||||
#define MAX_SETUP_TYPES 32
|
||||
|
||||
|
||||
#endif /* _XILIMITS_H_ */
|
||||
17
mozilla/xpinstall/wizard/unix/src2/config.ini
Normal file
17
mozilla/xpinstall/wizard/unix/src2/config.ini
Normal file
@@ -0,0 +1,17 @@
|
||||
[section1]
|
||||
key1=value_of_key1_of_section1
|
||||
key2=value_of_key2_of_section1
|
||||
|
||||
[section2]
|
||||
key1=value_of_key1_of_section2
|
||||
; key2=commentvalue_of_key2_of_section2
|
||||
key2=realvalue_of_key2_of_section2
|
||||
|
||||
|
||||
; dhdks
|
||||
; kjdsakjdas
|
||||
[SetupType0]
|
||||
Short Description=Browser
|
||||
Long Description=This is the browser component.
|
||||
Size=9090
|
||||
|
||||
32
mozilla/xpinstall/wizard/unix/src2/ftptest.c
Normal file
32
mozilla/xpinstall/wizard/unix/src2/ftptest.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int arc, char **argv)
|
||||
{
|
||||
char *ftphost = "sweetlou";
|
||||
char *file = "/products/server/README";
|
||||
char *basename = "./README";
|
||||
char *user = "test";
|
||||
char *localhost = "test.com";
|
||||
char *ftpcmds = malloc(1024);
|
||||
|
||||
sprintf(ftpcmds, "\
|
||||
\
|
||||
ftp -n %s <<EndFTP\n\
|
||||
binary\n\
|
||||
user anonymous %s@%s\n\
|
||||
get %s %s\n\
|
||||
EndFTP\n\
|
||||
\
|
||||
", ftphost, user, localhost, file, basename);
|
||||
|
||||
printf(ftpcmds);
|
||||
system(ftpcmds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
240
mozilla/xpinstall/wizard/unix/src2/nsComponent.cpp
Normal file
240
mozilla/xpinstall/wizard/unix/src2/nsComponent.cpp
Normal file
@@ -0,0 +1,240 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsComponent.h"
|
||||
|
||||
nsComponent::nsComponent() :
|
||||
mDescShort(NULL),
|
||||
mDescLong(NULL),
|
||||
mArchive(NULL),
|
||||
mSize(0),
|
||||
mDependencies(NULL),
|
||||
mAttributes(NO_ATTR)
|
||||
{
|
||||
}
|
||||
|
||||
nsComponent::~nsComponent()
|
||||
{
|
||||
if (mDescShort)
|
||||
free (mDescShort);
|
||||
if (mDescLong)
|
||||
free (mDescLong);
|
||||
if (mArchive)
|
||||
free (mArchive);
|
||||
if (mDependencies)
|
||||
delete mDependencies;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetDescShort(char *aDescShort)
|
||||
{
|
||||
if (!aDescShort)
|
||||
return E_PARAM;
|
||||
|
||||
mDescShort = aDescShort;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsComponent::GetDescShort()
|
||||
{
|
||||
if (mDescShort)
|
||||
return mDescShort;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetDescLong(char *aDescLong)
|
||||
{
|
||||
if (!aDescLong)
|
||||
return E_PARAM;
|
||||
|
||||
mDescLong = aDescLong;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsComponent::GetDescLong()
|
||||
{
|
||||
if (mDescLong)
|
||||
return mDescLong;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetArchive(char *aArchive)
|
||||
{
|
||||
if (!aArchive)
|
||||
return E_PARAM;
|
||||
|
||||
mArchive = aArchive;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsComponent::GetArchive()
|
||||
{
|
||||
if (mArchive)
|
||||
return mArchive;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetSize(int aSize)
|
||||
{
|
||||
mSize = aSize;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::GetSize()
|
||||
{
|
||||
if (mSize >= 0)
|
||||
return mSize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::AddDependency(nsComponent *aDependent)
|
||||
{
|
||||
if (!aDependent)
|
||||
return E_PARAM;
|
||||
|
||||
if (!mDependencies)
|
||||
mDependencies = new nsComponentList();
|
||||
|
||||
if (!mDependencies)
|
||||
return E_MEM;
|
||||
|
||||
return mDependencies->AddComponent(aDependent);
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::RemoveDependency(nsComponent *aIndependent)
|
||||
{
|
||||
if (!aIndependent)
|
||||
return E_PARAM;
|
||||
|
||||
if (!mDependencies)
|
||||
return E_NO_MEMBER;
|
||||
|
||||
return mDependencies->RemoveComponent(aIndependent);
|
||||
}
|
||||
|
||||
nsComponentList *
|
||||
nsComponent::GetDependencies()
|
||||
{
|
||||
if (mDependencies)
|
||||
return mDependencies;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetSelected()
|
||||
{
|
||||
mAttributes |= nsComponent::SELECTED;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetUnselected()
|
||||
{
|
||||
if (IsSelected())
|
||||
mAttributes &= ~nsComponent::SELECTED;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::IsSelected()
|
||||
{
|
||||
if (mAttributes & nsComponent::SELECTED)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetInvisible()
|
||||
{
|
||||
mAttributes |= nsComponent::INVISIBLE;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetVisible()
|
||||
{
|
||||
if (IsInvisible())
|
||||
mAttributes &= ~nsComponent::INVISIBLE;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::IsInvisible()
|
||||
{
|
||||
if (mAttributes & nsComponent::INVISIBLE)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetNext(nsComponent *aComponent)
|
||||
{
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
mNext = aComponent;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::InitNext()
|
||||
{
|
||||
mNext = NULL;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponent::GetNext()
|
||||
{
|
||||
if (mNext)
|
||||
return mNext;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
84
mozilla/xpinstall/wizard/unix/src2/nsComponent.h
Normal file
84
mozilla/xpinstall/wizard/unix/src2/nsComponent.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_COMPONENT_H_
|
||||
#define _NS_COMPONENT_H_
|
||||
|
||||
#include "XILimits.h"
|
||||
#include "XIErrors.h"
|
||||
#include <malloc.h>
|
||||
|
||||
#include "nsComponentList.h"
|
||||
|
||||
class nsComponent
|
||||
{
|
||||
public:
|
||||
nsComponent();
|
||||
~nsComponent();
|
||||
|
||||
/*--------------------------------------------------------------*
|
||||
* Accessors/Mutators
|
||||
*--------------------------------------------------------------*/
|
||||
int SetDescShort(char *aDescShort);
|
||||
char * GetDescShort();
|
||||
int SetDescLong(char *aDescLong);
|
||||
char * GetDescLong();
|
||||
int SetArchive(char *aAcrhive);
|
||||
char * GetArchive();
|
||||
int SetSize(int aSize);
|
||||
int GetSize();
|
||||
int AddDependency(nsComponent *aDependent);
|
||||
int RemoveDependency(nsComponent *aIndependent);
|
||||
nsComponentList *GetDependencies();
|
||||
int SetSelected();
|
||||
int SetUnselected();
|
||||
int IsSelected();
|
||||
int SetInvisible();
|
||||
int SetVisible();
|
||||
int IsInvisible();
|
||||
int SetNext(nsComponent *aComponent);
|
||||
int InitNext();
|
||||
nsComponent *GetNext();
|
||||
|
||||
/*---------------------------------------------------------------*
|
||||
* Attributes
|
||||
*---------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
NO_ATTR = 0x00000000,
|
||||
SELECTED = 0x00000001,
|
||||
INVISIBLE = 0x00000010
|
||||
};
|
||||
|
||||
private:
|
||||
char *mDescShort;
|
||||
char *mDescLong;
|
||||
char *mArchive;
|
||||
int mSize;
|
||||
nsComponentList *mDependencies;
|
||||
int mAttributes;
|
||||
nsComponent *mNext;
|
||||
};
|
||||
|
||||
#endif /* _NS_COMPONENT_H_ */
|
||||
149
mozilla/xpinstall/wizard/unix/src2/nsComponentList.cpp
Normal file
149
mozilla/xpinstall/wizard/unix/src2/nsComponentList.cpp
Normal file
@@ -0,0 +1,149 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsComponentList.h"
|
||||
#include "nsComponent.h"
|
||||
|
||||
nsComponentList::nsComponentList() :
|
||||
mHead(NULL),
|
||||
mTail(NULL),
|
||||
mNext(NULL),
|
||||
mLength(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsComponentList::~nsComponentList()
|
||||
{
|
||||
nsComponent *curr = mHead;
|
||||
nsComponent *next = NULL;
|
||||
|
||||
while (curr)
|
||||
{
|
||||
next = NULL;
|
||||
next = curr->GetNext();
|
||||
delete curr;
|
||||
curr = next;
|
||||
}
|
||||
|
||||
mHead = NULL;
|
||||
mTail = NULL;
|
||||
mLength = 0;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponentList::GetHead()
|
||||
{
|
||||
if (mHead)
|
||||
{
|
||||
mNext = mHead->GetNext();
|
||||
return mHead;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponentList::GetNext()
|
||||
{
|
||||
nsComponent *curr = mNext;
|
||||
|
||||
if (mNext)
|
||||
{
|
||||
mNext = mNext->GetNext();
|
||||
return curr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponentList::GetTail()
|
||||
{
|
||||
if (mTail)
|
||||
return mTail;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentList::AddComponent(nsComponent *aComponent)
|
||||
{
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
// empty list: head and tail are the same -- the new comp
|
||||
if (!mHead)
|
||||
{
|
||||
mHead = aComponent;
|
||||
mHead->InitNext();
|
||||
mTail = mHead;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// non-empty list: the new comp is tacked on and tail is updated
|
||||
mTail->SetNext(aComponent);
|
||||
mTail = aComponent;
|
||||
mTail->InitNext();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentList::RemoveComponent(nsComponent *aComponent)
|
||||
{
|
||||
nsComponent *curr = GetHead();
|
||||
nsComponent *last = NULL;
|
||||
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
while (curr)
|
||||
{
|
||||
if (aComponent == curr)
|
||||
{
|
||||
// remove and link last to next while deleting current
|
||||
if (last)
|
||||
{
|
||||
last->SetNext(curr->GetNext());
|
||||
}
|
||||
else
|
||||
{
|
||||
mHead = curr->GetNext();
|
||||
if (mTail == curr)
|
||||
mTail = NULL;
|
||||
}
|
||||
|
||||
delete aComponent;
|
||||
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// move on to next
|
||||
last = curr;
|
||||
curr = GetNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
96
mozilla/xpinstall/wizard/unix/src2/nsComponentList.h
Normal file
96
mozilla/xpinstall/wizard/unix/src2/nsComponentList.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_COMPONENTLIST_H_
|
||||
#define _NS_COMPONENTLIST_H_
|
||||
|
||||
#include "XIErrors.h"
|
||||
|
||||
class nsComponent;
|
||||
|
||||
class nsComponentList
|
||||
{
|
||||
public:
|
||||
nsComponentList();
|
||||
~nsComponentList();
|
||||
|
||||
/**
|
||||
* GetHead
|
||||
*
|
||||
* Initializes the next ptr to the second item and
|
||||
* returns the head item.
|
||||
*
|
||||
* @return mHead the head of the singly-linked list
|
||||
*/
|
||||
nsComponent * GetHead();
|
||||
|
||||
/**
|
||||
* GetNext
|
||||
*
|
||||
* Returns the next available item. GetFirst() has to have
|
||||
* been called prior calling this and after the last time
|
||||
* the entire list was iterated over.
|
||||
*
|
||||
* @return mNext the next available component
|
||||
*/
|
||||
nsComponent * GetNext();
|
||||
|
||||
/**
|
||||
* GetTail
|
||||
*
|
||||
* Returns the tail item of the list.
|
||||
*
|
||||
* @return mTail the tail item of the list
|
||||
*/
|
||||
nsComponent * GetTail();
|
||||
|
||||
/**
|
||||
* AddComponent
|
||||
*
|
||||
* Adds the supplied component to the list's tail.
|
||||
*
|
||||
* @param aComponent the component to add
|
||||
* @return err integer err code (zero means OK)
|
||||
*/
|
||||
int AddComponent(nsComponent *aComponent);
|
||||
|
||||
/**
|
||||
* RemoveComponent
|
||||
*
|
||||
* Searches the list and removes the first component that
|
||||
* matches the supplied component.
|
||||
*
|
||||
* @param aComponent the component to remove
|
||||
* @return err integer error code (zero means OK)
|
||||
*/
|
||||
int RemoveComponent(nsComponent *aComponent);
|
||||
|
||||
private:
|
||||
nsComponent *mHead;
|
||||
nsComponent *mTail;
|
||||
nsComponent *mNext;
|
||||
int mLength;
|
||||
};
|
||||
|
||||
#endif /* _NS_COMPONENTLIST_H_ */
|
||||
92
mozilla/xpinstall/wizard/unix/src2/nsComponentsDlg.cpp
Normal file
92
mozilla/xpinstall/wizard/unix/src2/nsComponentsDlg.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsComponentsDlg.h"
|
||||
|
||||
nsComponentsDlg::nsComponentsDlg() :
|
||||
mMsg0(NULL),
|
||||
mCompList(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsComponentsDlg::~nsComponentsDlg()
|
||||
{
|
||||
if (mMsg0)
|
||||
free (mMsg0);
|
||||
|
||||
if (mCompList)
|
||||
delete mCompList;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentsDlg::Back()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentsDlg::Next()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentsDlg::SetMsg0(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg0 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsComponentsDlg::GetMsg0()
|
||||
{
|
||||
if (mMsg0)
|
||||
return mMsg0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponentsDlg::SetCompList(nsComponentList *aCompList)
|
||||
{
|
||||
if (!aCompList)
|
||||
return E_PARAM;
|
||||
|
||||
mCompList = aCompList;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsComponentList *
|
||||
nsComponentsDlg::GetCompList()
|
||||
{
|
||||
if (mCompList)
|
||||
return mCompList;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
59
mozilla/xpinstall/wizard/unix/src2/nsComponentsDlg.h
Normal file
59
mozilla/xpinstall/wizard/unix/src2/nsComponentsDlg.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_COMPONENTSDLG_H_
|
||||
#define _NS_COMPONENTSDLG_H_
|
||||
|
||||
#include "XIErrors.h"
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
#include "nsComponentList.h"
|
||||
|
||||
class nsComponentsDlg : public nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsComponentsDlg();
|
||||
~nsComponentsDlg();
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*--------------------------------------------------------------------*/
|
||||
int Back();
|
||||
int Next();
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*--------------------------------------------------------------------*/
|
||||
int SetMsg0(char *aMsg);
|
||||
char *GetMsg0();
|
||||
|
||||
int SetCompList(nsComponentList *aCompList);
|
||||
nsComponentList *GetCompList();
|
||||
|
||||
private:
|
||||
char *mMsg0;
|
||||
nsComponentList *mCompList;
|
||||
};
|
||||
|
||||
#endif /* _NS_COMPONENTSDLG_H_ */
|
||||
265
mozilla/xpinstall/wizard/unix/src2/nsINIParser.cpp
Normal file
265
mozilla/xpinstall/wizard/unix/src2/nsINIParser.cpp
Normal file
@@ -0,0 +1,265 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsINIParser.h"
|
||||
|
||||
nsINIParser::nsINIParser(char *aFilename)
|
||||
{
|
||||
FILE *fd = NULL;
|
||||
fpos_t eofpos = (fpos_t) NULL;
|
||||
int rd = 0;
|
||||
|
||||
mFileBuf = NULL;
|
||||
mFileBufSize = 0;
|
||||
mError = OK;
|
||||
DUMP("nsINIParser");
|
||||
|
||||
/* param check */
|
||||
if (!aFilename)
|
||||
{
|
||||
mError = E_PARAM;
|
||||
return;
|
||||
}
|
||||
|
||||
/* open the file */
|
||||
fd = fopen(aFilename, "r");
|
||||
if (!fd)
|
||||
goto bail;
|
||||
|
||||
/* get file size */
|
||||
if (fseek(fd, 0, SEEK_END) != 0)
|
||||
goto bail;
|
||||
if (fgetpos(fd, &eofpos) != 0)
|
||||
goto bail;
|
||||
|
||||
/* malloc an internal buf the size of the file */
|
||||
mFileBuf = (char *) malloc(eofpos * sizeof(char));
|
||||
if (!mFileBuf)
|
||||
{
|
||||
mError = E_MEM;
|
||||
return;
|
||||
}
|
||||
mFileBufSize = eofpos;
|
||||
|
||||
/* read the file in one swoop */
|
||||
if (fseek(fd, 0, SEEK_SET) != 0)
|
||||
goto bail;
|
||||
rd = fread((void *)mFileBuf, 1, eofpos, fd);
|
||||
if (!rd)
|
||||
goto bail;
|
||||
|
||||
/* close file */
|
||||
fclose(fd);
|
||||
|
||||
return;
|
||||
|
||||
bail:
|
||||
mError = E_READ;
|
||||
return;
|
||||
}
|
||||
|
||||
nsINIParser::~nsINIParser()
|
||||
{
|
||||
DUMP("~nsINIParser");
|
||||
}
|
||||
|
||||
int
|
||||
nsINIParser::GetString( char *aSection, char *aKey,
|
||||
char *aValBuf, int *aIOValBufSize )
|
||||
{
|
||||
char *secPtr = NULL;
|
||||
mError = OK;
|
||||
DUMP("GetString");
|
||||
|
||||
/* param check */
|
||||
if ( !aSection || !aKey || !aValBuf ||
|
||||
!aIOValBufSize || (*aIOValBufSize <= 0) )
|
||||
return E_PARAM;
|
||||
|
||||
/* find the section if it exists */
|
||||
mError = FindSection(aSection, &secPtr);
|
||||
if (mError != OK)
|
||||
return mError;
|
||||
|
||||
/* find the key if it exists in the valid section we found */
|
||||
mError = FindKey(secPtr, aKey, aValBuf, aIOValBufSize);
|
||||
|
||||
return mError;
|
||||
}
|
||||
|
||||
int
|
||||
nsINIParser::GetStringAlloc( char *aSection, char *aKey,
|
||||
char **aOutBuf, int *aOutBufSize )
|
||||
{
|
||||
char buf[MAX_VAL_SIZE];
|
||||
int bufsize = MAX_VAL_SIZE;
|
||||
mError = OK;
|
||||
DUMP("GetStringAlloc");
|
||||
|
||||
mError = GetString(aSection, aKey, buf, &bufsize);
|
||||
if (mError != OK)
|
||||
return mError;
|
||||
|
||||
*aOutBuf = (char *) malloc(bufsize + 1);
|
||||
strncpy(*aOutBuf, buf, bufsize);
|
||||
strcat(*aOutBuf, "\0");
|
||||
*aOutBufSize = bufsize + 1;
|
||||
|
||||
return mError;
|
||||
}
|
||||
|
||||
int
|
||||
nsINIParser::GetError()
|
||||
{
|
||||
DUMP("GetError");
|
||||
return mError;
|
||||
}
|
||||
|
||||
int
|
||||
nsINIParser::FindSection(char *aSection, char **aOutSecPtr)
|
||||
{
|
||||
char *currChar = mFileBuf;
|
||||
char *nextSec = NULL;
|
||||
char *secClose = NULL;
|
||||
char *nextNL = NULL;
|
||||
mError = E_NO_SEC;
|
||||
DUMP("FindSection");
|
||||
|
||||
// param check
|
||||
if (!aSection || !aOutSecPtr)
|
||||
{
|
||||
mError = E_PARAM;
|
||||
return mError;
|
||||
}
|
||||
|
||||
while (currChar < (mFileBuf + mFileBufSize))
|
||||
{
|
||||
// look for first '['
|
||||
nextSec = NULL;
|
||||
nextSec = strchr(currChar, '[');
|
||||
if (!nextSec)
|
||||
break;
|
||||
|
||||
currChar = nextSec + 1;
|
||||
|
||||
// extract section name till first ']'
|
||||
secClose = NULL; nextNL = NULL;
|
||||
secClose = strchr(currChar, ']');
|
||||
nextNL = strchr(currChar, NL);
|
||||
if ((!nextNL) || (nextNL < secClose))
|
||||
{
|
||||
currChar = nextNL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if section name matches we succeeded
|
||||
if (strncmp(aSection, currChar, secClose - currChar) == 0)
|
||||
{
|
||||
*aOutSecPtr = secClose + 1;
|
||||
mError = OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return mError;
|
||||
}
|
||||
|
||||
int
|
||||
nsINIParser::FindKey(char *aSecPtr, char *aKey, char *aVal, int *aIOValSize)
|
||||
{
|
||||
char *nextNL = NULL;
|
||||
char *secEnd = NULL;
|
||||
char *currLine = aSecPtr;
|
||||
char *nextEq = NULL;
|
||||
mError = E_NO_KEY;
|
||||
DUMP("FindKey");
|
||||
|
||||
// param check
|
||||
if (!aSecPtr || !aKey || !aVal || !aIOValSize || (*aIOValSize <= 0))
|
||||
{
|
||||
mError = E_PARAM;
|
||||
return mError;
|
||||
}
|
||||
|
||||
// determine the section end
|
||||
secEnd = strchr(aSecPtr, '['); // search for next sec start
|
||||
if (!secEnd)
|
||||
{
|
||||
secEnd = strchr(aSecPtr, '\0'); // else search for file end
|
||||
if (!secEnd)
|
||||
{
|
||||
mError = E_SEC_CORRUPT; // else this data is corrupt
|
||||
return mError;
|
||||
}
|
||||
}
|
||||
|
||||
while (currLine < secEnd)
|
||||
{
|
||||
nextNL = NULL;
|
||||
nextNL = strchr(currLine, NL);
|
||||
if (!nextNL)
|
||||
nextNL = mFileBuf + mFileBufSize;
|
||||
|
||||
// ignore commented lines (starting with ;)
|
||||
if (currLine == strchr(currLine, ';'))
|
||||
{
|
||||
currLine = nextNL + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// extract key before '='
|
||||
nextEq = NULL;
|
||||
nextEq = strchr(currLine, '=');
|
||||
if (!nextEq || nextEq > nextNL)
|
||||
{
|
||||
currLine = nextNL + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if key matches we succeeded
|
||||
if (strncmp(currLine, aKey, nextEq - currLine) == 0)
|
||||
{
|
||||
// extract the value and return
|
||||
if (*aIOValSize < nextNL - nextEq)
|
||||
{
|
||||
mError = E_SMALL_BUF;
|
||||
*aVal = "\0";
|
||||
*aIOValSize = 0;
|
||||
return mError;
|
||||
}
|
||||
|
||||
*aIOValSize = nextNL - nextEq;
|
||||
strncpy(aVal, (nextEq + 1), *aIOValSize);
|
||||
mError = OK;
|
||||
return mError;
|
||||
}
|
||||
else
|
||||
{
|
||||
currLine = nextNL + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return mError;
|
||||
}
|
||||
128
mozilla/xpinstall/wizard/unix/src2/nsINIParser.h
Normal file
128
mozilla/xpinstall/wizard/unix/src2/nsINIParser.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_INIPARSER_H_
|
||||
#define _NS_INIPARSER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
class nsINIParser
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* nsINIParser
|
||||
*
|
||||
* Construct a new INI parser for the file specified.
|
||||
*
|
||||
* @param aFilename path to INI file
|
||||
*/
|
||||
nsINIParser(char *aFilename);
|
||||
~nsINIParser();
|
||||
|
||||
/**
|
||||
* GetString
|
||||
*
|
||||
* Gets the value of the specified key in the specified section
|
||||
* of the INI file represented by this instance. The value is stored
|
||||
* in the supplied buffer. The buffer size is provided as input and
|
||||
* the actual bytes used by the value is set in the in/out size param.
|
||||
*
|
||||
* @param aSection section name
|
||||
* @param aKey key name
|
||||
* @param aValBuf user supplied buffer
|
||||
* @param aIOValBufSize buf size on input; actual buf used on output
|
||||
*
|
||||
* @return mError operation success code
|
||||
*/
|
||||
int GetString( char *aSection, char *aKey,
|
||||
char *aValBuf, int *aIOValBufSize );
|
||||
|
||||
/**
|
||||
* GetStringAlloc
|
||||
*
|
||||
* Same as GetString() except the buffer is allocated to the exact
|
||||
* size of the value. Useful when the buffer is allocated everytime
|
||||
* rather than reusing the same buffer when calling this function
|
||||
* multiple times.
|
||||
*
|
||||
* @param aSection section name
|
||||
* @param aKey key name
|
||||
* @param aOutBuf buffer to be allocated
|
||||
* @param aOutBufSize size of newly allocated buffer
|
||||
*
|
||||
* @return mError operation success code
|
||||
*/
|
||||
int GetStringAlloc( char *aSection, char *aKey,
|
||||
char **aOutBuf, int *aOutBufSize );
|
||||
|
||||
/**
|
||||
* GetError
|
||||
*
|
||||
* Exposes the last error on this instance. Useful for checking
|
||||
* teh state of the object after construtcion since the INI file
|
||||
* is parsed once at object-allocation time.
|
||||
*
|
||||
* @return mError last error on ops on this object
|
||||
*/
|
||||
int GetError();
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* Errors
|
||||
*--------------------------------------------------------------------*/
|
||||
enum
|
||||
{
|
||||
OK = 0,
|
||||
E_READ = -701,
|
||||
E_MEM = -702,
|
||||
E_PARAM = -703,
|
||||
E_NO_SEC = -704,
|
||||
E_NO_KEY = -705,
|
||||
E_SEC_CORRUPT = -706,
|
||||
E_SMALL_BUF = -707
|
||||
};
|
||||
|
||||
private:
|
||||
int FindSection(char *aSection, char **aOutSecPtr);
|
||||
int FindKey(char *aSecPtr, char *aKey, char *aVal, int *aIOValSize);
|
||||
|
||||
char *mFileBuf;
|
||||
int mFileBufSize;
|
||||
int mError;
|
||||
};
|
||||
|
||||
#define NL '\n'
|
||||
#define MAX_VAL_SIZE 512
|
||||
|
||||
#ifdef DEBUG_druidd
|
||||
#define DUMP(_msg) printf("%s %d: %s \n", __FILE__, __LINE__, _msg);
|
||||
#else
|
||||
#define DUMP(_msg)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_NS_INIPARSER_H_ */
|
||||
68
mozilla/xpinstall/wizard/unix/src2/nsInstallDlg.cpp
Normal file
68
mozilla/xpinstall/wizard/unix/src2/nsInstallDlg.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsInstallDlg.h"
|
||||
|
||||
nsInstallDlg::nsInstallDlg() :
|
||||
mMsg0(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsInstallDlg::~nsInstallDlg()
|
||||
{
|
||||
if (mMsg0)
|
||||
free (mMsg0);
|
||||
}
|
||||
|
||||
int
|
||||
nsInstallDlg::Back()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsInstallDlg::Next()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsInstallDlg::SetMsg0(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg0 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsInstallDlg::GetMsg0()
|
||||
{
|
||||
if (mMsg0)
|
||||
return mMsg0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
53
mozilla/xpinstall/wizard/unix/src2/nsInstallDlg.h
Normal file
53
mozilla/xpinstall/wizard/unix/src2/nsInstallDlg.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_INSTALLDLG_H_
|
||||
#define _NS_INSTALLDLG_H_
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
#include "XIErrors.h"
|
||||
|
||||
class nsInstallDlg : public nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsInstallDlg();
|
||||
~nsInstallDlg();
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*------------------------------------------------------------------*/
|
||||
int Back();
|
||||
int Next();
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*------------------------------------------------------------------*/
|
||||
int SetMsg0(char *aMsg);
|
||||
char *GetMsg0();
|
||||
|
||||
private:
|
||||
char *mMsg0;
|
||||
};
|
||||
|
||||
#endif /* _NS_INSTALLDLG_H_ */
|
||||
114
mozilla/xpinstall/wizard/unix/src2/nsLicenseDlg.cpp
Normal file
114
mozilla/xpinstall/wizard/unix/src2/nsLicenseDlg.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsLicenseDlg.h"
|
||||
|
||||
nsLicenseDlg::nsLicenseDlg() :
|
||||
mLicenseFile(NULL),
|
||||
mMsg0(NULL),
|
||||
mMsg1(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsLicenseDlg::~nsLicenseDlg()
|
||||
{
|
||||
if (mLicenseFile)
|
||||
free (mLicenseFile);
|
||||
if (mMsg0)
|
||||
free (mMsg0);
|
||||
if (mMsg1)
|
||||
free (mMsg1);
|
||||
}
|
||||
|
||||
int
|
||||
nsLicenseDlg::Back()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsLicenseDlg::Next()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsLicenseDlg::SetLicenseFile(char *aLicenseFile)
|
||||
{
|
||||
if (!aLicenseFile)
|
||||
return E_PARAM;
|
||||
|
||||
aLicenseFile = mLicenseFile;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsLicenseDlg::GetLicenseFile()
|
||||
{
|
||||
if (mLicenseFile)
|
||||
return mLicenseFile;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsLicenseDlg::SetMsg0(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg0 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsLicenseDlg::GetMsg0()
|
||||
{
|
||||
if (mMsg0)
|
||||
return mMsg0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsLicenseDlg::SetMsg1(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg1 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsLicenseDlg::GetMsg1()
|
||||
{
|
||||
if (mMsg1)
|
||||
return mMsg1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
59
mozilla/xpinstall/wizard/unix/src2/nsLicenseDlg.h
Normal file
59
mozilla/xpinstall/wizard/unix/src2/nsLicenseDlg.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_LICENSEDLG_H_
|
||||
#define _NS_LICENSEDLG_H_
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
#include "XIErrors.h"
|
||||
|
||||
class nsLicenseDlg : public nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsLicenseDlg();
|
||||
~nsLicenseDlg();
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*-------------------------------------------------------------------*/
|
||||
int Back();
|
||||
int Next();
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*-------------------------------------------------------------------*/
|
||||
int SetLicenseFile(char *aLicenseFile);
|
||||
char * GetLicenseFile();
|
||||
int SetMsg0(char *aMsg);
|
||||
char * GetMsg0();
|
||||
int SetMsg1(char *aMsg);
|
||||
char * GetMsg1();
|
||||
|
||||
private:
|
||||
char *mLicenseFile;
|
||||
char *mMsg0;
|
||||
char *mMsg1;
|
||||
};
|
||||
|
||||
#endif /* _NS_LICENSEDLG_H_ */
|
||||
139
mozilla/xpinstall/wizard/unix/src2/nsSetupType.cpp
Normal file
139
mozilla/xpinstall/wizard/unix/src2/nsSetupType.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsSetupType.h"
|
||||
|
||||
nsSetupType::nsSetupType() :
|
||||
mDescShort(NULL),
|
||||
mDescLong(NULL),
|
||||
mComponents(NULL),
|
||||
mNext(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsSetupType::~nsSetupType()
|
||||
{
|
||||
if (mDescShort)
|
||||
free (mDescShort);
|
||||
if (mDescLong)
|
||||
free (mDescLong);
|
||||
if (mComponents)
|
||||
delete mComponents;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupType::SetDescShort(char *aDescShort)
|
||||
{
|
||||
if (!aDescShort)
|
||||
return E_PARAM;
|
||||
|
||||
mDescShort = aDescShort;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsSetupType::GetDescShort()
|
||||
{
|
||||
if (mDescShort)
|
||||
return mDescShort;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupType::SetDescLong(char *aDescLong)
|
||||
{
|
||||
if (!aDescLong)
|
||||
return E_PARAM;
|
||||
|
||||
mDescLong = aDescLong;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsSetupType::GetDescLong()
|
||||
{
|
||||
if (mDescLong)
|
||||
return mDescLong;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupType::SetComponent(nsComponent *aComponent)
|
||||
{
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
if (!mComponents)
|
||||
mComponents = new nsComponentList();
|
||||
|
||||
if (!mComponents)
|
||||
return E_MEM;
|
||||
|
||||
return mComponents->AddComponent(aComponent);
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupType::UnsetComponent(nsComponent *aComponent)
|
||||
{
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
if (!mComponents)
|
||||
return OK;
|
||||
|
||||
return mComponents->RemoveComponent(aComponent);
|
||||
}
|
||||
|
||||
nsComponentList *
|
||||
nsSetupType::GetComponents()
|
||||
{
|
||||
if (mComponents)
|
||||
return mComponents;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupType::SetNext(nsSetupType *aSetupType)
|
||||
{
|
||||
if (!aSetupType)
|
||||
return E_PARAM;
|
||||
|
||||
mNext = aSetupType;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsSetupType *
|
||||
nsSetupType::GetNext()
|
||||
{
|
||||
if (mNext)
|
||||
return mNext;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
61
mozilla/xpinstall/wizard/unix/src2/nsSetupType.h
Normal file
61
mozilla/xpinstall/wizard/unix/src2/nsSetupType.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_SETUPTYPE_H_
|
||||
#define _NS_SETUPTYPE_H_
|
||||
|
||||
#include "XILimits.h"
|
||||
#include "XIErrors.h"
|
||||
|
||||
#include "nsComponent.h"
|
||||
|
||||
class nsComponentList;
|
||||
|
||||
class nsSetupType
|
||||
{
|
||||
public:
|
||||
nsSetupType();
|
||||
~nsSetupType();
|
||||
|
||||
/*--------------------------------------------------------------*
|
||||
* Accessors/Mutators
|
||||
*--------------------------------------------------------------*/
|
||||
int SetDescShort(char *aDescShort);
|
||||
char * GetDescShort();
|
||||
int SetDescLong(char *aDescLong);
|
||||
char * GetDescLong();
|
||||
int SetComponent(nsComponent *aComponent);
|
||||
int UnsetComponent(nsComponent *aComponent);
|
||||
nsComponentList *GetComponents();
|
||||
int SetNext(nsSetupType *aSetupType);
|
||||
nsSetupType * GetNext();
|
||||
|
||||
private:
|
||||
char *mDescShort;
|
||||
char *mDescLong;
|
||||
nsComponentList *mComponents;
|
||||
nsSetupType *mNext;
|
||||
};
|
||||
|
||||
#endif /* _NS_SETUPTYPE_H_ */
|
||||
103
mozilla/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp
Normal file
103
mozilla/xpinstall/wizard/unix/src2/nsSetupTypeDlg.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
|
||||
#include "nsSetupTypeDlg.h"
|
||||
|
||||
nsSetupTypeDlg::nsSetupTypeDlg() :
|
||||
mMsg0(NULL),
|
||||
mSetupTypeList(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsSetupTypeDlg::~nsSetupTypeDlg()
|
||||
{
|
||||
FreeSetupTypeList();
|
||||
|
||||
if (mMsg0)
|
||||
free (mMsg0);
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupTypeDlg::Back()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupTypeDlg::Next()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupTypeDlg::SetMsg0(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg0 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsSetupTypeDlg::GetMsg0()
|
||||
{
|
||||
if (mMsg0)
|
||||
return mMsg0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsSetupTypeDlg::AddSetupType(nsSetupType *aSetupType)
|
||||
{
|
||||
if (!aSetupType)
|
||||
return E_PARAM;
|
||||
|
||||
if (!mSetupTypeList)
|
||||
{
|
||||
mSetupTypeList = aSetupType;
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsSetupType *curr = mSetupTypeList;
|
||||
nsSetupType *next;
|
||||
while (curr)
|
||||
{
|
||||
next = NULL;
|
||||
next = curr->GetNext();
|
||||
|
||||
if (!next)
|
||||
{
|
||||
return curr->SetNext(aSetupType);
|
||||
}
|
||||
|
||||
curr = next;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsSetupType *
|
||||
nsSetupTypeDlg::GetSetupTypeList()
|
||||
{
|
||||
if (mSetupTypeList)
|
||||
return mSetupTypeList;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
nsSetupTypeDlg::FreeSetupTypeList()
|
||||
{
|
||||
nsSetupType *curr = mSetupTypeList;
|
||||
nsSetupType *prev;
|
||||
|
||||
while (curr)
|
||||
{
|
||||
prev = curr;
|
||||
curr = curr->GetNext();
|
||||
|
||||
if (prev)
|
||||
delete prev;
|
||||
}
|
||||
}
|
||||
59
mozilla/xpinstall/wizard/unix/src2/nsSetupTypeDlg.h
Normal file
59
mozilla/xpinstall/wizard/unix/src2/nsSetupTypeDlg.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_SETUPTYPEDLG_H_
|
||||
#define _NS_SETUPTYPEDLG_H_
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
#include "nsSetupType.h"
|
||||
|
||||
class nsSetupTypeDlg : public nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsSetupTypeDlg();
|
||||
~nsSetupTypeDlg();
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*---------------------------------------------------------------------*/
|
||||
int Back();
|
||||
int Next();
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*---------------------------------------------------------------------*/
|
||||
int SetMsg0(char *aMsg);
|
||||
char *GetMsg0();
|
||||
|
||||
int AddSetupType(nsSetupType *aSetupType);
|
||||
nsSetupType *GetSetupTypeList();
|
||||
|
||||
private:
|
||||
void FreeSetupTypeList();
|
||||
|
||||
char *mMsg0;
|
||||
nsSetupType *mSetupTypeList;
|
||||
};
|
||||
|
||||
#endif /* _NS_SETUPTYPEDLG_H_ */
|
||||
137
mozilla/xpinstall/wizard/unix/src2/nsWelcomeDlg.cpp
Normal file
137
mozilla/xpinstall/wizard/unix/src2/nsWelcomeDlg.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsWelcomeDlg.h"
|
||||
|
||||
nsWelcomeDlg::nsWelcomeDlg() :
|
||||
mReadmeFile(NULL),
|
||||
mMsg0(NULL),
|
||||
mMsg1(NULL),
|
||||
mMsg2(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsWelcomeDlg::~nsWelcomeDlg()
|
||||
{
|
||||
if (mReadmeFile)
|
||||
free (mReadmeFile);
|
||||
if (mMsg0)
|
||||
free (mMsg0);
|
||||
if (mMsg1)
|
||||
free (mMsg1);
|
||||
if (mMsg2)
|
||||
free (mMsg2);
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::Back()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::Next()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::SetReadmeFile(char *aReadmeFile)
|
||||
{
|
||||
if (!aReadmeFile)
|
||||
return E_PARAM;
|
||||
|
||||
mReadmeFile = aReadmeFile;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsWelcomeDlg::GetReadmeFile()
|
||||
{
|
||||
if (mReadmeFile)
|
||||
return mReadmeFile;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::SetMsg0(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg0 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsWelcomeDlg::GetMsg0()
|
||||
{
|
||||
if (mMsg0)
|
||||
return mMsg0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::SetMsg1(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg1 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsWelcomeDlg::GetMsg1()
|
||||
{
|
||||
if (mMsg1)
|
||||
return mMsg1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsWelcomeDlg::SetMsg2(char *aMsg)
|
||||
{
|
||||
if (!aMsg)
|
||||
return E_PARAM;
|
||||
|
||||
mMsg2 = aMsg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsWelcomeDlg::GetMsg2()
|
||||
{
|
||||
if (mMsg2)
|
||||
return mMsg2;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
62
mozilla/xpinstall/wizard/unix/src2/nsWelcomeDlg.h
Normal file
62
mozilla/xpinstall/wizard/unix/src2/nsWelcomeDlg.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_WELCOMEDLG_H_
|
||||
#define _NS_WELCOMEDLG_H_
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
#include "XIErrors.h"
|
||||
|
||||
class nsWelcomeDlg : public nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsWelcomeDlg();
|
||||
~nsWelcomeDlg();
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*--------------------------------------------------------------------*/
|
||||
int Back();
|
||||
int Next();
|
||||
|
||||
/*--------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*--------------------------------------------------------------------*/
|
||||
int SetReadmeFile(char *aReadmeFile);
|
||||
char *GetReadmeFile();
|
||||
int SetMsg0(char *aMsg);
|
||||
char *GetMsg0();
|
||||
int SetMsg1(char *aMsg);
|
||||
char *GetMsg1();
|
||||
int SetMsg2(char *aMsg);
|
||||
char *GetMsg2();
|
||||
|
||||
private:
|
||||
char *mReadmeFile;
|
||||
char *mMsg0;
|
||||
char *mMsg1;
|
||||
char *mMsg2;
|
||||
};
|
||||
|
||||
#endif /* _NS_WELCOMEDLG_H_ */
|
||||
126
mozilla/xpinstall/wizard/unix/src2/nsXInstaller.cpp
Normal file
126
mozilla/xpinstall/wizard/unix/src2/nsXInstaller.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsXInstaller.h"
|
||||
#include "nsINIParser.h"
|
||||
|
||||
#include "XIErrors.h"
|
||||
|
||||
nsXInstaller::nsXInstaller()
|
||||
{
|
||||
}
|
||||
|
||||
nsXInstaller::~nsXInstaller()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::ParseConfig()
|
||||
{
|
||||
int err = OK;
|
||||
nsINIParser *parser = new nsINIParser( CONFIG_INI );
|
||||
char *bufalloc = NULL;
|
||||
char buf[512];
|
||||
int bufsize = 0;
|
||||
|
||||
if (!parser)
|
||||
return E_MEM;
|
||||
|
||||
err = parser->GetError();
|
||||
if (err != nsINIParser::OK)
|
||||
return err;
|
||||
|
||||
bufsize = 512;
|
||||
// err = parser->GetString("section2", "key2", buf, &bufsize);
|
||||
err = parser->GetStringAlloc("section2", "key2", &bufalloc, &bufsize);
|
||||
if ( (err == nsINIParser::OK) && (bufalloc) && (bufsize > 0) )
|
||||
{
|
||||
DUMP("section2 key2 = ");
|
||||
DUMP(bufalloc);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::Run()
|
||||
{
|
||||
int err = OK;
|
||||
|
||||
if ( (err = StartWizard()) != OK)
|
||||
goto au_revoir;
|
||||
|
||||
if ( (err = Download()) != OK)
|
||||
goto au_revoir;
|
||||
|
||||
if ( (err = Extract()) != OK)
|
||||
goto au_revoir;
|
||||
|
||||
if ( (err = Install()) != OK)
|
||||
goto au_revoir;
|
||||
|
||||
au_revoir:
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::StartWizard()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::Download()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::Extract()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstaller::Install()
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
nsXInstaller *installer = new nsXInstaller();
|
||||
int err = OK;
|
||||
|
||||
if (installer)
|
||||
{
|
||||
if ( (err = installer->ParseConfig()) == OK)
|
||||
err = installer->Run();
|
||||
}
|
||||
|
||||
exit(err);
|
||||
}
|
||||
|
||||
59
mozilla/xpinstall/wizard/unix/src2/nsXInstaller.h
Normal file
59
mozilla/xpinstall/wizard/unix/src2/nsXInstaller.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_XINSTALLER_H_
|
||||
#define _NS_XINSTALLER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "XIErrors.h"
|
||||
|
||||
class nsXInstaller
|
||||
{
|
||||
public:
|
||||
nsXInstaller();
|
||||
~nsXInstaller();
|
||||
|
||||
int ParseConfig();
|
||||
int Run();
|
||||
|
||||
private:
|
||||
int StartWizard();
|
||||
int Download();
|
||||
int Extract();
|
||||
int Install();
|
||||
};
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
|
||||
#define CONFIG_INI "config.ini"
|
||||
|
||||
#ifdef DEBUG_druidd
|
||||
#define DUMP(_msg) printf("%s %d: %s \n", __FILE__, __LINE__, _msg);
|
||||
#else
|
||||
#define DUMP(_msg)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*_NS_XINSTALLER_H_ */
|
||||
75
mozilla/xpinstall/wizard/unix/src2/nsXInstallerDlg.cpp
Normal file
75
mozilla/xpinstall/wizard/unix/src2/nsXInstallerDlg.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsXInstallerDlg.h"
|
||||
|
||||
nsXInstallerDlg::nsXInstallerDlg() :
|
||||
mShowDlg(nsXInstallerDlg::SHOW_DLG),
|
||||
mTitle(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
nsXInstallerDlg::~nsXInstallerDlg()
|
||||
{
|
||||
if (mTitle)
|
||||
free (mTitle);
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstallerDlg::SetShowDlg(int aShowDlg)
|
||||
{
|
||||
if ( aShowDlg != nsXInstallerDlg::SHOW_DLG &&
|
||||
aShowDlg != nsXInstallerDlg::SKIP_DLG )
|
||||
return E_PARAM;
|
||||
|
||||
mShowDlg = aShowDlg;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstallerDlg::GetShowDlg()
|
||||
{
|
||||
return mShowDlg;
|
||||
}
|
||||
|
||||
int
|
||||
nsXInstallerDlg::SetTitle(char *aTitle)
|
||||
{
|
||||
if (!aTitle)
|
||||
return E_PARAM;
|
||||
|
||||
mTitle = aTitle;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
nsXInstallerDlg::GetTitle()
|
||||
{
|
||||
if (mTitle)
|
||||
return mTitle;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
70
mozilla/xpinstall/wizard/unix/src2/nsXInstallerDlg.h
Normal file
70
mozilla/xpinstall/wizard/unix/src2/nsXInstallerDlg.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef _NS_XINSTALLERDLG_H_
|
||||
#define _NS_XINSTALLERDLG_H_
|
||||
|
||||
#include <malloc.h>
|
||||
#include "XIErrors.h"
|
||||
|
||||
/**
|
||||
* nsXInstallerDlg
|
||||
*
|
||||
* The interface for all installer dialogs. Helps maintain
|
||||
* uniform navigation mechanism and UI widgets.
|
||||
*/
|
||||
class nsXInstallerDlg
|
||||
{
|
||||
public:
|
||||
nsXInstallerDlg();
|
||||
virtual ~nsXInstallerDlg();
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
* Navigation
|
||||
*-------------------------------------------------------------------*/
|
||||
virtual int Back() = 0;
|
||||
virtual int Next() = 0;
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
* INI Properties
|
||||
*-------------------------------------------------------------------*/
|
||||
int SetShowDlg(int aShowDlg);
|
||||
int GetShowDlg();
|
||||
int SetTitle(char *aTitle);
|
||||
char *GetTitle();
|
||||
|
||||
// TO DO
|
||||
|
||||
enum
|
||||
{
|
||||
SKIP_DLG = 0,
|
||||
SHOW_DLG = 1
|
||||
};
|
||||
|
||||
protected:
|
||||
int mShowDlg;
|
||||
char *mTitle;
|
||||
};
|
||||
|
||||
#endif /* _NS_INSTALLERDLG_H_ */
|
||||
Reference in New Issue
Block a user