mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 552864 part 2 - Load the XUL library with the standalone glue and get rid of the startup shell script. r=tglek,r=ted
This commit is contained in:
parent
ad45dfb74f
commit
46128c3e45
@ -91,62 +91,22 @@ include $(topsrcdir)/config/rules.mk
|
||||
else
|
||||
# Build a binary bootstrapping with XRE_main
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
|
||||
else
|
||||
PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
|
||||
endif
|
||||
|
||||
CPPSRCS = nsBrowserApp.cpp
|
||||
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
|
||||
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
ifdef _MSC_VER
|
||||
STATIC_COMPONENTS_LINKER_PATH = -LIBPATH:$(DEPTH)/staticlib
|
||||
else
|
||||
STATIC_COMPONENTS_LINKER_PATH = -L$(DEPTH)/staticlib
|
||||
endif
|
||||
LIBS += $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
|
||||
else
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
LIBS += $(DIST)/bin/XUL
|
||||
else
|
||||
EXTRA_DSO_LIBS += xul
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
TK_LIBS := $(TK_LIBS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
|
||||
else
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
APP_XPCOM_LIBS = $(XPCOM_LIBS)
|
||||
endif
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
STL_FLAGS=
|
||||
|
||||
LIBS += \
|
||||
$(STATIC_COMPONENTS_LINKER_PATH) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(APP_XPCOM_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(XPCOM_STANDALONE_GLUE_LDOPTS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
LIBS += \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(TK_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
# Add explicit X11 dependency when building against X11 toolkits
|
||||
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
|
||||
LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_JPROF
|
||||
LIBS += -ljprof
|
||||
endif
|
||||
@ -171,18 +131,6 @@ ifdef _MSC_VER
|
||||
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
include $(topsrcdir)/config/static-config.mk
|
||||
|
||||
EXTRA_DEPS += \
|
||||
$(STATIC_EXTRA_DEPS) \
|
||||
$(NULL)
|
||||
DEFINES += $(STATIC_DEFINES)
|
||||
CPPSRCS += $(STATIC_CPPSRCS)
|
||||
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
|
||||
EXTRA_LIBS += $(STATIC_EXTRA_LIBS)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
|
||||
@ -195,9 +143,6 @@ RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
|
||||
else
|
||||
RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
|
||||
endif
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
RCFLAGS += -DMOZ_STATIC_BUILD
|
||||
endif
|
||||
ifdef DEBUG
|
||||
RCFLAGS += -DDEBUG
|
||||
endif
|
||||
@ -206,9 +151,6 @@ endif
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
RESFILE=splashos2.res
|
||||
RCFLAGS += -DMOZ_PHOENIX
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include
|
||||
endif
|
||||
ifdef DEBUG
|
||||
RCFLAGS += -DDEBUG
|
||||
endif
|
||||
@ -217,12 +159,6 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
include $(topsrcdir)/config/static-rules.mk
|
||||
|
||||
DEFINES += -DIMPL_XREAPI
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
|
||||
LIBS += -lphexlib
|
||||
endif
|
||||
@ -249,18 +185,9 @@ endif
|
||||
|
||||
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
|
||||
$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
|
||||
cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
|
||||
-e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
|
||||
chmod +x $@
|
||||
libs::
|
||||
cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
|
||||
|
||||
libs:: $(MOZ_APP_NAME)
|
||||
$(INSTALL) $< $(DIST)/bin
|
||||
|
||||
install:: $(MOZ_APP_NAME)
|
||||
$(SYSINSTALL) $< $(DESTDIR)$(bindir)
|
||||
|
||||
GARBAGE += $(MOZ_APP_NAME)
|
||||
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
|
||||
|
||||
endif
|
||||
@ -328,7 +255,7 @@ libs repackage:: $(PROGRAM) application.ini
|
||||
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
|
||||
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
|
||||
ifdef LIBXUL_SDK
|
||||
cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox-bin
|
||||
cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox
|
||||
else
|
||||
$(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
|
||||
rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
|
||||
|
@ -94,7 +94,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>firefox-bin</string>
|
||||
<string>firefox</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>%APP_NAME% %APP_VERSION%</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
@ -44,6 +45,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
@ -56,7 +58,12 @@
|
||||
#ifdef XP_WIN
|
||||
// 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
|
||||
|
||||
static void Output(const char *fmt, ... )
|
||||
{
|
||||
@ -83,12 +90,12 @@ static PRBool IsArg(const char* arg, const char* s)
|
||||
{
|
||||
if (*++arg == '-')
|
||||
++arg;
|
||||
return !PL_strcasecmp(arg, s);
|
||||
return !strcasecmp(arg, s);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
if (*arg == '/')
|
||||
return !PL_strcasecmp(++arg, s);
|
||||
return !strcasecmp(++arg, s);
|
||||
#endif
|
||||
|
||||
return PR_FALSE;
|
||||
@ -104,26 +111,46 @@ public:
|
||||
~ScopedLogging() { NS_LogTerm(); }
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
ScopedLogging log;
|
||||
|
||||
XRE_GetFileFromPathType XRE_GetFileFromPath;
|
||||
XRE_CreateAppDataType XRE_CreateAppData;
|
||||
XRE_FreeAppDataType XRE_FreeAppData;
|
||||
#ifdef XRE_HAS_DLL_BLOCKLIST
|
||||
XRE_SetupDllBlocklist();
|
||||
XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
|
||||
#endif
|
||||
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_main", (NSFuncPtr*) &XRE_main },
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
static int do_main(const char *exePath, int argc, char* argv[])
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> appini;
|
||||
nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
|
||||
#ifdef XP_WIN
|
||||
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
|
||||
// encoded path, so it is safe to convert it
|
||||
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
|
||||
getter_AddRefs(appini));
|
||||
#else
|
||||
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
|
||||
getter_AddRefs(appini));
|
||||
#endif
|
||||
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");
|
||||
const char *appDataFile = getenv("XUL_APP_FILE");
|
||||
if (appDataFile && *appDataFile) {
|
||||
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -143,8 +170,12 @@ int main(int argc, char* argv[])
|
||||
return 255;
|
||||
}
|
||||
|
||||
appEnv = PR_smprintf("XUL_APP_FILE=%s", argv[2]);
|
||||
PR_SetEnv(appEnv);
|
||||
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;
|
||||
@ -159,7 +190,47 @@ int main(int argc, char* argv[])
|
||||
|
||||
int result = XRE_main(argc, argv, appData);
|
||||
XRE_FreeAppData(appData);
|
||||
if (appEnv)
|
||||
PR_smprintf_free(appEnv);
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char exePath[MAXPATHLEN];
|
||||
|
||||
nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
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);
|
||||
|
||||
rv = XPCOMGlueStartup(exePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't load XPCOM.\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't load XRE functions.\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
#ifdef XRE_HAS_DLL_BLOCKLIST
|
||||
XRE_SetupDllBlocklist();
|
||||
#endif
|
||||
|
||||
int result;
|
||||
{
|
||||
ScopedLogging log;
|
||||
result = do_main(exePath, argc, argv);
|
||||
}
|
||||
|
||||
XPCOMGlueShutdown();
|
||||
return result;
|
||||
}
|
||||
|
@ -317,6 +317,13 @@ sub do_copyfile
|
||||
}
|
||||
}
|
||||
unlink("$destpath$destname$destsuffix") if ( -e "$destpath$destname$destsuffix");
|
||||
# If source is a symbolic link pointing in the same directory, create a
|
||||
# symbolic link
|
||||
if ((-l "$srcpath$srcname$srcsuffix") && (readlink("$srcpath$srcname$srcsuffix") !~ /\//)) {
|
||||
symlink(readlink("$srcpath$srcname$srcsuffix"), "$destpath$destname$destsuffix") ||
|
||||
die "Error: copy of symbolic link $srcpath$srcname$srcsuffix failed ($package, $component, $lineno): $!. Exiting...\n";
|
||||
return;
|
||||
}
|
||||
copy ("$srcpath$srcname$srcsuffix", "$destpath$destname$destsuffix") ||
|
||||
die "Error: copy of file $srcpath$srcname$srcsuffix failed ($package, $component, $lineno): $!. Exiting...\n";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user