bug 543060 - remove fennec's dependency on xulrunner r=mfinkle

This commit is contained in:
Brad Lassey 2010-01-29 11:15:37 -05:00
Родитель c1dcaf8c48
Коммит dfb20c2c75
6 изменённых файлов: 210 добавлений и 2 удалений

Просмотреть файл

@ -45,6 +45,10 @@ include $(DEPTH)/config/autoconf.mk
DIRS = chrome locales components themes app
ifndef LIBXUL_SDK
PARALLEL_DIRS += $(DEPTH)/xulrunner/tools/redit
endif
ifdef WINCE
DIRS += installer/wince
endif

Просмотреть файл

@ -45,6 +45,43 @@ include $(DEPTH)/config/autoconf.mk
PREF_JS_EXPORTS = $(srcdir)/mobile.js
DIST_FILES = application.ini
ifndef LIBXUL_SDK
PROGRAM=$(MOZ_APP_NAME)$(BIN_SUFFIX)
CPPSRCS = nsBrowserApp.cpp
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
ifdef MOZ_ENABLE_LIBXUL
APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
else
MOZILLA_INTERNAL_API = 1
APP_XPCOM_LIBS = $(XPCOM_LIBS)
endif
LIBS += $(APP_XPCOM_LIBS) \
$(NSPR_LIBS) \
$(NULL)
ifdef BUILD_STATIC_LIBS
LIBS += $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
else
ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
LIBS += $(LIB_PREFIX)xul.$(LIB_SUFFIX)
endif
endif
ifdef _MSC_VER
# Always enter a Windows program through wmain, whether or not we're
# a console application.
ifdef WINCE
WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
else
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
endif
endif
endif #LIBXUL_SDK
include $(topsrcdir)/config/rules.mk
GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
@ -128,8 +165,11 @@ libs repackage:: application.ini
else
libs::
ifdef LIBXUL_SDK
cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/$(APP_BINARY)
endif
ifdef MOZ_FASTSTART
ifdef _MSC_VER
ifdef WINCE
@ -138,8 +178,10 @@ endif
endif
endif
ifndef SKIP_COPY_XULRUNNER
ifdef LIBXUL_SDK
$(NSINSTALL) -D $(DIST)/bin/xulrunner
(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
endif
endif # SKIP_COPY_XULRUNNER
$(NSINSTALL) -D $(DIST)/bin/chrome/icons/default

151
mobile/app/nsBrowserApp.cpp Normal file
Просмотреть файл

@ -0,0 +1,151 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
*
* 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 ***** */
#include "nsXULAppAPI.h"
#ifdef XP_WIN
#include <windows.h>
#include <stdlib.h>
#endif
#include <stdio.h>
#include <stdarg.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"
#endif
static void Output(const char *fmt, ... )
{
va_list ap;
va_start(ap, fmt);
#if defined(XP_WIN) && !MOZ_WINCONSOLE
PRUnichar msg[2048];
_vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap);
MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR);
#else
vfprintf(stderr, fmt, ap);
#endif
va_end(ap);
}
/**
* Return true if |arg| matches the given argument name.
*/
static PRBool IsArg(const char* arg, const char* s)
{
if (*arg == '-')
{
if (*++arg == '-')
++arg;
return !PL_strcasecmp(arg, s);
}
#if defined(XP_WIN) || defined(XP_OS2)
if (*arg == '/')
return !PL_strcasecmp(++arg, s);
#endif
return PR_FALSE;
}
int main(int argc, char* argv[])
{
nsCOMPtr<nsILocalFile> appini;
nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("Couldn't calculate the application directory.");
return 255;
}
appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
char *appEnv = nsnull;
const char *appDataFile = PR_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;
}
appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
PR_SetEnv(appEnv);
argv[2] = argv[0];
argv += 2;
argc -= 2;
}
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
if (NS_FAILED(rv)) {
Output("Couldn't read application.ini");
return 255;
}
int result = XRE_main(argc, argv, appData);
XRE_FreeAppData(appData);
if (appEnv)
PR_smprintf_free(appEnv);
return result;
}

Просмотреть файл

@ -35,6 +35,10 @@
#
# ***** END LICENSE BLOCK *****
ifndef LIBXUL_SDK
include $(topsrcdir)/toolkit/toolkit-tiers.mk
endif
TIERS += app
ifdef MOZ_EXTENSIONS

Просмотреть файл

@ -51,7 +51,12 @@ case "$target" in
esac
MOZ_XUL_APP=1
MOZ_UPDATER=0
MOZ_ENABLE_LIBXUL=1
MOZ_NO_XPCOM_OBSOLETE=1
if test "$LIBXUL_SDK"; then
MOZ_XULRUNNER=1
else
MOZ_XULRUNNER=
MOZ_MORK=
MOZ_PLACES=1
fi

Просмотреть файл

@ -73,6 +73,7 @@ NO_PKG_FILES = \
$(MOZ_APP_NAME)-config \
$(MOZ_APP_NAME)-bin.elf \
xulrunner-config \
$(MOZ_APP_NAME)-bin$(BIN_SUFFIX) \
nspr-config \
regchrome* \
regxpcom* \
@ -81,7 +82,6 @@ NO_PKG_FILES = \
xpt_dump* \
xpt_link* \
bloaturls.txt \
run-mozilla.sh \
nsinstall \
*Test* \
*test* \
@ -128,6 +128,7 @@ include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
DEBDESTDIR=debian/$(MOZ_APP_NAME)
package-xulrunner:
ifdef LIBXUL_SDK
ifndef SYSTEM_LIBXUL
@echo "Packaging xulrunner..."
@rm -rf $(LIBXUL_DIST)/xulrunner*
@ -138,6 +139,7 @@ ifndef SYSTEM_LIBXUL
else
@echo "Using system xulrunner..."
endif
endif
ifeq ($(OS_TARGET),Linux)
PP_DEB_FILES = debian/control \