Bug 722262 -- Port |
Bug 552864 - Throw away wrapper shell script on unix and lazily load libxul| to SeaMonkey. r=KaiRo,glandium f=Mnyromyr
Also Fixes:
Bug 704835 - Use a pre-generated nsXREAppData struct instead of application.ini. [SeaMonkey Part]
--- a/suite/app/Makefile.in
+++ b/suite/app/Makefile.in
@@ -39,204 +39,148 @@ DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
AB_CD = $(MOZ_UI_LOCALE)
-GRE_MILESTONE = $(shell $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
-GRE_BUILDID = $(shell $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
-
DEFINES += \
-DSEAMONKEY_ICO=\"$(DIST)/branding/seamonkey.ico\" \
- -DAB_CD=$(AB_CD) \
-DAPP_VERSION="$(MOZ_APP_VERSION)" \
- -DGRE_MILESTONE=$(GRE_MILESTONE) \
- -DGRE_BUILDID=$(GRE_BUILDID) \
-DNO_BLOCKLIST_CRASHREPORTER \
$(NULL)
-MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null))
-ifdef MOZ_SOURCE_STAMP
-DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
-endif
+ifdef LIBXUL_SDK
+include $(topsrcdir)/config/rules.mk
+else
+# Build a binary bootstrapping with XRE_main
-SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
-ifdef SOURCE_REPO
-DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
-endif
-
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-else
-PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-endif
-
CPPSRCS = nsSuiteApp.cpp
-DIST_FILES = application.ini
-
LOCAL_INCLUDES += \
-I$(MOZILLA_SRCDIR)/toolkit/xre \
-I$(MOZILLA_SRCDIR)/xpcom/base \
+ -I$(MOZILLA_SRCDIR)/xpcom/build \
+ -I$(DEPTH)/mozilla/build \
$(NULL)
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-LIBS += $(DIST)/bin/XUL
-else
-EXTRA_DSO_LIBS += xul
-endif
-
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-TK_LIBS := -framework Cocoa $(TK_LIBS)
-endif
-
-APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
+DEFINES += -DXPCOM_GLUE
+STL_FLAGS=
LIBS += \
- $(STATIC_COMPONENTS_LINKER_PATH) \
$(EXTRA_DSO_LIBS) \
- $(APP_XPCOM_LIBS) \
- $(NSPR_LIBS) \
+ $(XPCOM_STANDALONE_GLUE_LDOPTS) \
$(NULL)
-ifdef MOZ_JPROF
-LIBS += -ljprof
-endif
-
-ifdef MOZ_ENABLE_DBUS
-LIBS += $(MOZ_DBUS_GLIB_LIBS)
-endif
-
ifndef MOZ_WINCONSOLE
ifdef MOZ_DEBUG
MOZ_WINCONSOLE = 1
else
MOZ_WINCONSOLE = 0
endif
endif
+# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
+# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
NSDISTMODE = copy
include $(topsrcdir)/config/config.mk
ifdef _MSC_VER
+# Always enter a Windows program through wmain, whether or not we're
+# a console application.
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
endif
-# OpenGL is required by (mozilla/)content/canvas: see (mozilla/)layout/build/Makefile.in.
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-OS_LIBS += -framework OpenGL
-endif
-
ifeq ($(OS_ARCH),WINNT)
-OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
RCINCLUDE = splash.rc
ifndef GNU_CC
RCFLAGS += -DMOZ_SUITE -I$(srcdir)
else
RCFLAGS += -DMOZ_SUITE --include-dir $(srcdir)
endif
+ifdef DEBUG
+RCFLAGS += -DDEBUG
+endif
+endif
+
+ifeq ($(OS_ARCH),OS2)
+RESFILE = splashos2.res
+RCFLAGS += -DMOZ_SUITE
+RCFLAGS += -i $(MOZILLA_SRCDIR)/toolkit/xre
+RCFLAGS += -DSEAMONKEY_ICO=\"$(DIST)/branding/seamonkey.ico\"
endif
ifeq ($(OS_ARCH),BeOS)
BEOS_PROGRAM_RESOURCE = apprunner-beos.rsrc
endif
-ifeq ($(OS_ARCH),OS2)
-RESFILE = splashos2.res
-RCFLAGS += -i $(MOZILLA_SRCDIR)/toolkit/xre
-RCFLAGS += -DSEAMONKEY_ICO=\"$(DIST)/branding/seamonkey.ico\"
-endif
-
include $(topsrcdir)/config/rules.mk
-ifdef MOZILLA_OFFICIAL
-DEFINES += -DMOZILLA_OFFICIAL
-endif
-
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-LIBS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
-endif
-
ifeq ($(OS_ARCH),WINNT)
#
# Control the default heap size.
# This is the heap returned by GetProcessHeap().
# As we use the CRT heap, the default size is too large and wastes VM.
#
# The default heap size is 1MB on Win32.
# The heap will grow if need be.
#
# Set it to 256k. See bug 127069.
#
ifndef GNU_CC
LDFLAGS += /HEAP:0x40000
+ifeq ($(OS_TEST),x86_64)
+# set stack to 2MB on x64 build. See bug 582910
+LDFLAGS += -STACK:2097152
+endif
endif
endif
+libs::
+ifeq ($(OS_ARCH),WINNT)
+ $(EXIT_ON_ERROR) \
+ $(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $(topsrcdir)/suite/installer/license.txt > $(DIST)/bin/license.txt
+else
+ $(INSTALL) $(IFLAGS1) $(topsrcdir)/suite/installer/license.txt $(DIST)/bin/
+endif
+
+ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+
+libs::
+ cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
+
+endif
+
+endif # LIBXUL_SDK
+
+libs:: blocklist.xml
+ $(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
+
ifneq (,$(filter-out OS2 WINNT Darwin,$(OS_ARCH)))
$(MOZ_APP_NAME).1: seamonkey.man.in $(GLOBAL_DEPS) $(DEPTH)/config/autoconf.mk
@sed -e "s|\@bindir\@|$(bindir)|g" -e "s|\@mozappdir\@|$(mozappdir)|g" \
-e "s|\@MOZ_APP_DISPLAYNAME\@|$(MOZ_APP_DISPLAYNAME)|g" \
-e "s|\@MOZ_APP_NAME\@|$(MOZ_APP_NAME)|g" \
-e "s|\@MOZ_APP_VERSION\@|${MOZ_APP_VERSION}|g" < $< > $@
libs:: $(MOZ_APP_NAME).1
$(INSTALL) $< $(DIST)/man/man1
install:: $(MOZ_APP_NAME).1
$(SYSINSTALL) $(IFLAGS1) $< $(DESTDIR)$(mandir)/man1
-$(MOZ_APP_NAME):: $(MOZILLA_DIR)/build/unix/mozilla.in $(GLOBAL_DEPS) $(DEPTH)/config/autoconf.mk
- cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
- -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" \
- -e "s|%MOZILLA-BIN%|$(PROGRAM)|g" > $@
- chmod +x $@
-
-libs:: $(MOZ_APP_NAME)
- $(INSTALL) $< $(DIST)/bin
-
-install:: $(MOZ_APP_NAME)
- $(SYSINSTALL) $< $(DESTDIR)$(bindir)
-
-GARBAGE += $(MOZ_APP_NAME) $(MOZ_APP_NAME).1
+GARBAGE += $(MOZ_APP_NAME).1
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, browser-prefs.js)
endif
-ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
-LIBS += -lphexlib
-endif
-
-libs::
-ifeq ($(OS_ARCH),WINNT)
- $(EXIT_ON_ERROR) \
- $(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $(topsrcdir)/suite/installer/license.txt > $(DIST)/bin/license.txt
-else
- $(INSTALL) $(IFLAGS1) $(topsrcdir)/suite/installer/license.txt $(DIST)/bin/
-endif
-
-libs:: blocklist.xml
- $(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
-
-ifdef ENABLE_TESTS
-# XXX This is a hack to ensure that we get the right xpcshell.ini for our tests
-# and that we can share the core mozilla-central xpcshell.ini.
-# mozilla-central does this in testing/xpcshell-tests which means that it is
-# very hard for anyone to specify anything else.
-libs::
- $(NSINSTALL) -D $(MOZDEPTH)/_tests/xpcshell
- cp $(MOZILLA_SRCDIR)/testing/xpcshell/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell/xpcshell-core.ini
- $(INSTALL) $(topsrcdir)/suite/test/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell
- cp $(topsrcdir)/suite/test/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell/all-test-dirs.list
-endif
-
ifdef MOZ_OMNIJAR
# Make extensions end up as XPIs instead of flat chrome when doing omni.jar.
# APP_EXTENSIONS exist only bundled with the application,
# PROFILE_EXTENSIONS will be copied to the profile in installed builds.
# NOTE: This is a hack to run this at the end of compilation, would be nicer
# if this was done right away for built-in extensions in omnijar mode.
# Listed extension GUIDs:
# 972ce4c6-... Classic Theme, 59c81df5-... ChatZilla, f13b157f-... Venkman
@@ -288,38 +232,80 @@ pack-ext: $(STAGEDIST)
$(foreach dir,$(PROFILE_EXTENSIONS),$(_PACKAGE_PROFILE_EXTENSIONS))
libs::
@$(MAKE) pack-ext STAGEDIST="$(DIST)/bin"
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+# Anything below the above ifdef won't be included in mac builds. So be very
+# careful what you add here.
+
+MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
+
+ifdef MOZ_DEBUG
+MAC_APP_NAME := $(MAC_APP_NAME)Debug
+endif
+
+LOWER_MAC_APP_NAME = $(shell echo $(MAC_APP_NAME) | tr '[A-Z]' '[a-z]')
AB := $(firstword $(subst -, ,$(AB_CD)))
-ifdef MOZ_DEBUG
-MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)Debug
+clean clobber repackage::
+ $(RM) -r $(DIST)/$(MOZ_MACBUNDLE_NAME)
+
+ifdef LIBXUL_SDK
+APPFILES = Resources
else
-MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
+APPFILES = MacOS
endif
libs:: $(PROGRAM)
mkdir -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(MOZ_MACBUNDLE_NAME) --exclude English.lproj
mkdir -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
sed -e "s/\@MOZ_APP_NAME\@/$(MOZ_APP_NAME)/" -e "s/\@MAC_APP_NAME\@/$(MAC_APP_NAME)/" -e "s/\@MOZ_APP_DISPLAYNAME\@/$(MOZ_APP_DISPLAYNAME)/" -e "s/\@MOZ_APP_VERSION\@/$(MOZ_APP_VERSION)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Info.plist
sed -e "s/\@MOZ_APP_NAME\@/$(MOZ_APP_NAME)/" -e "s/\@MAC_APP_NAME\@/$(MAC_APP_NAME)/" -e "s/\@MOZ_APP_DISPLAYNAME\@/$(MOZ_APP_DISPLAYNAME)/" -e "s/\@MOZ_APP_VERSION\@/$(MOZ_APP_VERSION)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj/InfoPlist.strings
- rsync -a $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
- rm -f $(DIST)/$(MAC_APP_NAME)/Contents/MacOS/$(PROGRAM)
+ rsync -a $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+ rm -f $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/mangle $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/shlibsign
+ifdef LIBXUL_SDK
+ cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/seamonkey
+else
+ rm -f $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
rsync -aL $(PROGRAM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
+endif
+ -cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
cp -RL $(DIST)/branding/icons/*.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/
printf APPLMOZZ > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/PkgInfo
# remove CVS dirs from packaged app
find $(DIST)/$(MOZ_MACBUNDLE_NAME) -type d -name "CVS" -prune -exec rm -rf {} \;
-
-clean clobber::
- rm -rf $(DIST)/$(MOZ_MACBUNDLE_NAME)
+else
+ifdef LIBXUL_SDK
+libs::
+ cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/seamonkey$(BIN_SUFFIX)
+endif
endif
-# Anything below the above ifdef won't be included in mac builds. So be very
-# careful what you add here.
+ifdef LIBXUL_SDK
+ifndef SKIP_COPY_XULRUNNER
+libs::
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+ rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Frameworks
+else
+ $(NSINSTALL) -D $(DIST)/bin/xulrunner
+ (cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
+endif # cocoa
+endif # SKIP_COPY_XULRUNNER
+endif # LIBXUL_SDK
+
+ifdef ENABLE_TESTS
+# XXX This is a hack to ensure that we get the right xpcshell.ini for our tests
+# and that we can share the core mozilla-central xpcshell.ini.
+# mozilla-central does this in testing/xpcshell-tests which means that it is
+# very hard for anyone to specify anything else.
+libs::
+ $(NSINSTALL) -D $(MOZDEPTH)/_tests/xpcshell
+ cp $(MOZILLA_SRCDIR)/testing/xpcshell/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell/xpcshell-core.ini
+ $(INSTALL) $(topsrcdir)/suite/test/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell
+ cp $(topsrcdir)/suite/test/xpcshell.ini $(MOZDEPTH)/_tests/xpcshell/all-test-dirs.list
+endif
deleted file mode 100644
--- a/suite/app/application.ini
+++ /dev/null
@@ -1,64 +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 Firefox.
-;
-; The Initial Developer of the Original Code is
-; Benjamin Smedberg <benjamin@smedbergs.us>.
-;
-; Portions created by the Initial Developer are Copyright (C) 2006
-; the Mozilla Foundation <http://www.mozilla.org/>. All Rights Reserved.
-;
-; Contributor(s):
-;
-; 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 *****
-
-#filter substitution
-[App]
-Vendor=Mozilla
-Name=SeaMonkey
-Version=@APP_VERSION@
-BuildID=@GRE_BUILDID@
-#ifdef MOZ_SOURCE_REPO
-SourceRepository=@MOZ_SOURCE_REPO@
-#endif
-#ifdef MOZ_SOURCE_STAMP
-SourceStamp=@MOZ_SOURCE_STAMP@
-#endif
-ID={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
-
-[Gecko]
-MinVersion=@GRE_MILESTONE@
-MaxVersion=@GRE_MILESTONE@
-
-[XRE]
-EnableProfileMigrator=1
-EnableExtensionManager=1
-
-[Crash Reporter]
-#if MOZILLA_OFFICIAL
-Enabled=1
-#endif
-ServerURL=https://crash-reports.mozilla.com/submit
--- a/suite/app/macbuild/Contents/Info.plist.in
+++ b/suite/app/macbuild/Contents/Info.plist.in
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
- <string>@MOZ_APP_NAME@-bin</string>
+ <string>@MOZ_APP_NAME@</string>
<key>CFBundleIdentifier</key>
<string>org.mozilla.@MAC_APP_NAME@</string>
<key>CFBundleVersion</key>
<string>@MOZ_APP_VERSION@</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleName</key>
<string>@MOZ_APP_DISPLAYNAME@</string>
--- a/suite/app/nsSuiteApp.cpp
+++ b/suite/app/nsSuiteApp.cpp
@@ -31,38 +31,53 @@
* 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 ***** */
-#include "nsXULAppAPI.h"
-#ifdef XP_WIN
+#include "application.ini.h"
+#include "nsXPCOMGlue.h"
+#if defined(XP_WIN)
#include <windows.h>
#include <stdlib.h>
+#elif defined(XP_UNIX)
+#include <sys/time.h>
+#include <sys/resource.h>
#endif
#ifdef XP_MACOSX
#include "MacQuirks.h"
#endif
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
+
+#include "plstr.h"
+#include "prprf.h"
+#include "prenv.h"
#include "nsCOMPtr.h"
#include "nsILocalFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
-// we want to use the DLL blocklist if possible
-#define XRE_WANT_DLL_BLOCKLIST
+// we want a wmain entry point
#include "nsWindowsWMain.cpp"
+#define snprintf _snprintf
+#define strcasecmp _stricmp
#endif
+#include "BinaryPath.h"
+
+#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
+
+#include "mozilla/Telemetry.h"
static void Output(const char *fmt, ... )
{
va_list ap;
va_start(ap, fmt);
#if defined(XP_WIN) && !MOZ_WINCONSOLE
PRUnichar msg[2048];
@@ -71,44 +86,213 @@ static void Output(const char *fmt, ...
#else
vfprintf(stderr, fmt, ap);
#endif
va_end(ap);
}
/**
+ * Return true if |arg| matches the given argument name.
+ */
+static bool IsArg(const char* arg, const char* s)
+{
+ if (*arg == '-')
+ {
+ if (*++arg == '-')
+ ++arg;
+ return !strcasecmp(arg, s);
+ }
+
+#if defined(XP_WIN) || defined(XP_OS2)
+ if (*arg == '/')
+ return !strcasecmp(++arg, s);
+#endif
+
+ return false;
+}
+
+/**
* A helper class which calls NS_LogInit/NS_LogTerm in its scope.
*/
class ScopedLogging
{
public:
ScopedLogging() { NS_LogInit(); }
~ScopedLogging() { NS_LogTerm(); }
};
+XRE_GetFileFromPathType XRE_GetFileFromPath;
+XRE_CreateAppDataType XRE_CreateAppData;
+XRE_FreeAppDataType XRE_FreeAppData;
+#ifdef XRE_HAS_DLL_BLOCKLIST
+XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
+#endif
+XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
+XRE_mainType XRE_main;
+
+static const nsDynamicFunctionLoad kXULFuncs[] = {
+ { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
+ { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+ { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+#ifdef XRE_HAS_DLL_BLOCKLIST
+ { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
+#endif
+ { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
+ { "XRE_main", (NSFuncPtr*) &XRE_main },
+ { nsnull, nsnull }
+};
+
+static int do_main(const char *exePath, int argc, char* argv[])
+{
+ nsCOMPtr<nsILocalFile> appini;
+ nsresult rv;
+
+ // Allow seamonkey.exe to launch XULRunner apps via -app <application.ini>
+ // Note that -app must be the *first* argument.
+ const char *appDataFile = getenv("XUL_APP_FILE");
+ if (appDataFile && *appDataFile) {
+ rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
+ if (NS_FAILED(rv)) {
+ Output("Invalid path found: '%s'", appDataFile);
+ return 255;
+ }
+ }
+ else if (argc > 1 && IsArg(argv[1], "app")) {
+ if (argc == 2) {
+ Output("Incorrect number of arguments passed to -app");
+ return 255;
+ }
+
+ rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
+ if (NS_FAILED(rv)) {
+ Output("application.ini path not recognized: '%s'", argv[2]);
+ return 255;
+ }
+
+ char appEnv[MAXPATHLEN];
+ snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
+ if (putenv(appEnv)) {
+ Output("Couldn't set %s.\n", appEnv);
+ return 255;
+ }
+ argv[2] = argv[0];
+ argv += 2;
+ argc -= 2;
+ }
+
+ int result;
+ if (appini) {
+ nsXREAppData *appData;
+ rv = XRE_CreateAppData(appini, &appData);
+ if (NS_FAILED(rv)) {
+ Output("Couldn't read application.ini");
+ return 255;
+ }
+ result = XRE_main(argc, argv, appData);
+ XRE_FreeAppData(appData);
+ } else {
+#ifdef XP_WIN
+ // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
+ // encoded path, so it is safe to convert it
+ rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
+ getter_AddRefs(appini));
+#else
+ rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
+ getter_AddRefs(appini));
+#endif
+ if (NS_FAILED(rv)) {
+ return 255;
+ }
+ result = XRE_main(argc, argv, &sAppData);
+ }
+
+ return result;
+}
int main(int argc, char* argv[])
{
- ScopedLogging log;
+ char exePath[MAXPATHLEN];
#ifdef XP_MACOSX
TriggerQuirks();
#endif
-
- nsCOMPtr<nsILocalFile> appini;
- nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
+
+ nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
if (NS_FAILED(rv)) {
- Output("Couldn't calculate the application directory.");
+ Output("Couldn't calculate the application directory.\n");
+ return 255;
+ }
+
+ char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
+ if (!lastSlash || (lastSlash - exePath > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
+ return 255;
+
+ strcpy(++lastSlash, XPCOM_DLL);
+
+ int gotCounters;
+#if defined(XP_UNIX)
+ struct rusage initialRUsage;
+ gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
+#elif defined(XP_WIN)
+ // GetProcessIoCounters().ReadOperationCount seems to have little to
+ // do with actual read operations. It reports 0 or 1 at this stage
+ // in the program. Luckily 1 coincides with when prefetch is
+ // enabled. If Windows prefetch didn't happen we can do our own
+ // faster dll preloading.
+ IO_COUNTERS ioCounters;
+ gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+ if (gotCounters && !ioCounters.ReadOperationCount)
+#endif
+ {
+ XPCOMGlueEnablePreload();
+ }
+
+ rv = XPCOMGlueStartup(exePath);
+ if (NS_FAILED(rv)) {
+ Output("Couldn't load XPCOM.\n");
return 255;
}
- appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
+ // Reset exePath so that it is the directory name and not the xpcom dll name
+ *lastSlash = 0;
- nsXREAppData *appData;
- rv = XRE_CreateAppData(appini, &appData);
+ rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
if (NS_FAILED(rv)) {
- Output("Couldn't read application.ini");
+ Output("Couldn't load XRE functions.\n");
return 255;
}
-
- int result = XRE_main(argc, argv, appData);
- XRE_FreeAppData(appData);
+
+#ifdef XRE_HAS_DLL_BLOCKLIST
+ XRE_SetupDllBlocklist();
+#endif
+
+ if (gotCounters) {
+#if defined(XP_WIN)
+ XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
+ int(ioCounters.ReadOperationCount));
+ XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
+ int(ioCounters.ReadTransferCount / 1024));
+ IO_COUNTERS newIoCounters;
+ if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
+ XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
+ int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
+ XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
+ int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
+ }
+#elif defined(XP_UNIX)
+ XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
+ int(initialRUsage.ru_majflt));
+ struct rusage newRUsage;
+ if (!getrusage(RUSAGE_SELF, &newRUsage)) {
+ XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
+ int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
+ }
+#endif
+ }
+
+ int result;
+ {
+ ScopedLogging log;
+ result = do_main(exePath, argc, argv);
+ }
+
+ XPCOMGlueShutdown();
return result;
}
--- a/suite/confvars.sh
+++ b/suite/confvars.sh
@@ -31,16 +31,18 @@
# 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 *****
+MOZ_APP_BASENAME=SeaMonkey
+MOZ_APP_VENDOR=Mozilla
MOZ_APP_NAME=seamonkey
MOZ_APP_DISPLAYNAME=SeaMonkey
if [ "$COMM_BUILD" ]; then
MOZ_LDAP_XPCOM=1
fi
MOZ_CHROME_FILE_FORMAT=omni
MOZ_COMPOSER=1
MOZ_SUITE=1
@@ -54,8 +56,13 @@ MOZ_STATIC_BUILD_UNSUPPORTED=1
MOZ_APP_COMPONENT_LIBS="xpautocomplete $MAIL_COMPONENT $LDAP_COMPONENT $MORK_COMPONENT"
MOZ_APP_COMPONENT_MODULES="MODULE(xpAutoComplete) $MAIL_MODULE $LDAP_MODULE $MORK_MODULE"
MOZ_APP_EXTRA_LIBS="$LDAP_LIBS"
MOZ_SERVICES_SYNC=1
MOZ_APP_VERSION_TXT=${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt
MOZ_APP_VERSION=`cat $MOZ_APP_VERSION_TXT`
SEAMONKEY_VERSION=$MOZ_APP_VERSION
+
+MOZ_APP_ID={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
+MOZ_PROFILE_MIGRATOR=1
+MOZ_EXTENSION_MANAGER=1
+MOZ_APP_STATIC_INI=1
new file mode 100644
--- /dev/null
+++ b/suite/extradependlibs.mk
@@ -0,0 +1,16 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This file is included from mozilla/xpcom/stub/Makefile.in
+# Presume all mozilla/autoconf.mk is included and that it does not have
+# Direct access to c-c specific vars not present there.
+
+# We don't have access to MOZ_LDAP_XPCOM here, so cheat.
+ifneq (,$(findstring ldap,$(MOZ_APP_COMPONENT_LIBS)))
+DEPENDENT_LIBS_LIST += \
+ $(DLL_PREFIX)ldap60$(DLL_SUFFIX) \
+ $(DLL_PREFIX)prldap60$(DLL_SUFFIX) \
+ $(DLL_PREFIX)ldif60$(DLL_SUFFIX) \
+ $(NULL)
+endif
--- a/suite/installer/package-manifest.in
+++ b/suite/installer/package-manifest.in
@@ -102,20 +102,18 @@
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
[browser]
; [Base Browser Files]
#ifdef WIN_OR_OS2
@BINPATH@/@MOZ_APP_NAME@.exe
#else
@BINPATH@/@MOZ_APP_NAME@-bin
-#ifndef XP_MACOSX
@BINPATH@/@MOZ_APP_NAME@
#endif
-#endif
@BINPATH@/application.ini
@BINPATH@/platform.ini
#ifdef XP_OS2
@BINPATH@/@DLL_PREFIX@mozsqlt3@DLL_SUFFIX@
#else
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
@BINPATH@/license.txt