From 546ff02d58848a70616a625b5cdd735df4d27f31 Mon Sep 17 00:00:00 2001 From: "cathleen%netscape.com" Date: Fri, 10 Aug 2001 05:18:27 +0000 Subject: [PATCH] make static build to support DISABLE_MAILNEWS flag, and enable making gecko.dll for static build bug=93100 sr=waterson git-svn-id: svn://10.0.0.236/trunk@100742 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/staticmod/makefile.win | 8 + mozilla/modules/staticmod/meta.mak | 32 ++++ .../staticmod/nsMetaModule_gecko.cpp.in | 159 ++++++++++++++++++ mozilla/xpfe/bootstrap/makefile.win | 8 +- 4 files changed, 203 insertions(+), 4 deletions(-) create mode 100644 mozilla/modules/staticmod/nsMetaModule_gecko.cpp.in diff --git a/mozilla/modules/staticmod/makefile.win b/mozilla/modules/staticmod/makefile.win index b8f43e29787..de19100856b 100755 --- a/mozilla/modules/staticmod/makefile.win +++ b/mozilla/modules/staticmod/makefile.win @@ -26,6 +26,14 @@ include <$(DEPTH)\config\config.mak> META_MODULES=mail +!ifdef DISABLE_MAILNEWS +META_MODULES= +!endif + +!ifdef MOZ_GECKO_DLL +META_MODULES=$(META_MODULES) gecko +!endif + !ifdef BUILD_PSM2 META_MODULES=$(META_MODULES) crypto !endif diff --git a/mozilla/modules/staticmod/meta.mak b/mozilla/modules/staticmod/meta.mak index 4d00a63bbee..ac22663fd5a 100755 --- a/mozilla/modules/staticmod/meta.mak +++ b/mozilla/modules/staticmod/meta.mak @@ -47,6 +47,23 @@ LLIBS = $(DIST)\lib\gkgfx.lib \ $(DIST)\lib\xpcom.lib \ $(LIBNSPR) +!ifdef MOZ_GECKO_DLL +LLIBS = $(LLIBS) \ + $(DIST)\lib\png.lib \ + $(DIST)\lib\mng.lib \ + $(DIST)\lib\util.lib \ + $(DIST)\lib\expat.lib \ + $(DIST)\lib\nsldap32v40.lib + +WIN_LIBS = comctl32.lib \ + comdlg32.lib \ + uuid.lib \ + ole32.lib \ + shell32.lib \ + oleaut32.lib \ + version.lib +!endif + include <$(DEPTH)/config/rules.mak> # @@ -98,6 +115,21 @@ $(EXTRA_LIBS_LIST_FILE): $(LINK_COMPS) $(LINK_LIBS) sed -e "s/\(.*\)/$(DIST:\=\\\)\\\lib\\\\\1.lib/" $(LINK_COMPS) > $@ sed -e "s/\(.*\)/$(DIST:\=\\\)\\\lib\\\\\1.lib/" $(LINK_LIBS) >> $@ + +# XXX this is a hack. The ``gecko'' meta-module consists +# of all the static components linked into a DLL instead +# of an executable. To make this work, we'll copy the +# statically linked libs, components, and component names +# to the right file. This relies on the fact that the +# modules/staticmod directory gets built after all the other +# directories in the tree are processed. +!if defined(MOZ_GECKO_DLL) && "$(META_MODULE)" == "gecko" +export:: + copy $(FINAL_LINK_LIBS) $(DIST)\$(META_MODULE)-link-libs + copy $(FINAL_LINK_COMPS) $(DIST)\$(META_MODULE)-link-comps + copy $(FINAL_LINK_COMP_NAMES) $(DIST)\$(META_MODULE)-link-comp-names +!endif + install:: $(DLL) $(MAKE_INSTALL) $(DLL) $(DIST)/bin/components diff --git a/mozilla/modules/staticmod/nsMetaModule_gecko.cpp.in b/mozilla/modules/staticmod/nsMetaModule_gecko.cpp.in new file mode 100644 index 00000000000..63a803580f9 --- /dev/null +++ b/mozilla/modules/staticmod/nsMetaModule_gecko.cpp.in @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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.org code. + * + * 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): + * Christopher Seawood + * Doug Turner + */ + +#include "nsError.h" +#include "nsIModule.h" +#include "nsIFile.h" +#include "nsIGenericFactory.h" +#include "prmem.h" + +#define NS_METAMODULE_NAME "nsMetaModuleGecko" +#define NS_METAMODULE_DESC "Meta Component Gecko" +#define NS_METAMODULE_CID \ +{ 0xf958fb6b, 0x41eb, 0x4615, { 0x97, 0xfb, 0x81, 0xf2, 0x29, 0x37, 0xf8, 0x3c } } +#define NS_METAMODULE_CONTRACTID "@mozilla.org/metamodule_gecko;1" + +/* + * NO USER EDITABLE PORTIONS AFTER THIS POINT + * + */ + +#define REGISTER_MODULE_USING(mod) { \ + nsCOMPtr module; \ + mod##(aCompMgr, aPath, getter_AddRefs(module)); \ + module->RegisterSelf(aCompMgr, aPath, aRegistryLocation, aComponentType); \ +} + +struct nsModuleComponentInfoContainer { + nsModuleComponentInfo *list; + PRUint32 count; +}; + +%DECLARE_COMPONENT_LIST% + +static nsresult +NS_RegisterMetaModules(nsIComponentManager *aCompMgr, + nsIFile *aPath, + const char *aRegistryLocation, + const char *aComponentType) +{ + nsresult rv = NS_OK; + + %COMPONENT_NS_GET_MODULE% + + {}; + + return rv; +} + +void META_DESTRUCTOR_FUNC(nsIModule *self, nsModuleComponentInfo *components) +{ + PR_Free(components); +} + +class nsMetaModuleImpl : public nsISupports +{ +public: + nsMetaModuleImpl(); + virtual ~nsMetaModuleImpl(); + NS_DECL_ISUPPORTS +}; + +nsMetaModuleImpl::nsMetaModuleImpl() +{ + NS_INIT_REFCNT(); +} + +nsMetaModuleImpl::~nsMetaModuleImpl() +{ +} + +NS_IMPL_ISUPPORTS1(nsMetaModuleImpl, nsISupports); + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMetaModuleImpl) + +static NS_METHOD nsMetaModuleRegistrationProc(nsIComponentManager *aCompMgr, + nsIFile *aPath, + const char *registryLocation, + const char *componentType, + const nsModuleComponentInfo *info) +{ + NS_RegisterMetaModules(aCompMgr, aPath, registryLocation, componentType); + return NS_OK; +} + +static NS_METHOD nsMetaModuleUnregistrationProc(nsIComponentManager *aCompMgr, + nsIFile *aPath, + const char *registryLocation, + const nsModuleComponentInfo *info) +{ + return NS_OK; +} + + +static nsModuleComponentInfo components[] = +{ + { NS_METAMODULE_DESC, + NS_METAMODULE_CID, + NS_METAMODULE_CONTRACTID, + nsMetaModuleImplConstructor, + nsMetaModuleRegistrationProc, + nsMetaModuleUnregistrationProc + }, +}; + +static nsModuleComponentInfoContainer componentsList[] = { + { components, sizeof(components)/sizeof(components[0]) }, + %COMPONENT_LIST% + { nsnull, 0 } +}; + +extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr, + nsIFile* location, + nsIModule** result) +{ + nsModuleComponentInfo *outList = nsnull; + nsModuleComponentInfoContainer *inList = componentsList; + PRUint32 count = 0, i = 0, k=0, msize = sizeof(nsModuleComponentInfo); + + while (inList[i].list != nsnull) { + count += inList[i].count; + i++; + } + + outList = (nsModuleComponentInfo *) PR_Calloc(count, sizeof(nsModuleComponentInfo)); + + i = 0; k =0; + while (inList[i].list != nsnull) { + memcpy(&outList[k], inList[i].list, msize * inList[i].count); + k+= inList[i].count; + i++; + } + return NS_NewGenericModule(NS_METAMODULE_NAME, count, outList, nsnull, nsnull, result); +} + + + + + diff --git a/mozilla/xpfe/bootstrap/makefile.win b/mozilla/xpfe/bootstrap/makefile.win index 38d99fd1580..8a6a018c402 100644 --- a/mozilla/xpfe/bootstrap/makefile.win +++ b/mozilla/xpfe/bootstrap/makefile.win @@ -24,7 +24,7 @@ include <$(DEPTH)/config/config.mak> DEFINES=-DWIN32_LEAN_AND_MEAN -!ifdef MOZ_STATIC_COMPONENT_LIBS +!if defined(MOZ_STATIC_COMPONENT_LIBS) && !defined(MOZ_GECKO_DLL) DEFINES=$(DEFINES) -D_BUILD_STATIC_BIN EXTRA_LIBS_LIST_FILE=$(OBJDIR)\libs.txt SEDCMDS=nsStaticComonents.cpp.sed @@ -38,7 +38,7 @@ CPPSRCS= \ nsNativeAppSupportBase.cpp \ nsNativeAppSupportWin.cpp \ showOSAlert.cpp \ -!ifdef MOZ_STATIC_COMPONENT_LIBS +!if defined(MOZ_STATIC_COMPONENT_LIBS) && !defined(MOZ_GECKO_DLL) nsStaticComponents.cpp \ !endif $(NULL) @@ -50,7 +50,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsNativeAppSupportBase.obj \ .\$(OBJDIR)\nsNativeAppSupportWin.obj \ .\$(OBJDIR)\showOSAlert.obj \ -!ifdef MOZ_STATIC_COMPONENT_LIBS +!if defined(MOZ_STATIC_COMPONENT_LIBS) && !defined(MOZ_GECKO_DLL) .\$(OBJDIR)\nsStaticComponents.obj \ !endif $(NULL) @@ -140,7 +140,7 @@ WIN_LIBS= \ include <$(DEPTH)\config\rules.mak> -!ifdef MOZ_STATIC_COMPONENT_LIBS +!if defined(MOZ_STATIC_COMPONENT_LIBS) && !defined(MOZ_GECKO_DLL) $(SEDCMDS): $(FINAL_LINK_COMP_NAMES) rm -f $@