зеркало из https://github.com/mozilla/gecko-dev.git
238 строки
7.1 KiB
Plaintext
238 строки
7.1 KiB
Plaintext
# 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 the Python XPCOM language bindings.
|
|
#
|
|
# The Initial Developer of the Original Code is ActiveState Tool Corp.
|
|
# Portions created by ActiveState Tool Corp. are Copyright (C) 2000, 2001
|
|
# ActiveState Tool Corp. All Rights Reserved.
|
|
#
|
|
# Contributor(s): Trent Mick <TrentM@ActiveState.com> (original author)
|
|
# Mark Hammond <MarkH@ActiveState.com>
|
|
#
|
|
|
|
# Dumb makefile to build PyXPCOM on Windows
|
|
#
|
|
# The build is by no means clean. I just kept shoving in compiler and linker
|
|
# options until it worked. :)
|
|
#
|
|
# USAGE:
|
|
# 1. edit top section as appropriate
|
|
# 2. build, install, and test PyXPCOM
|
|
# > nmake -f makefile.stupid.win
|
|
# > nmake -f makefile.stupid.win install
|
|
# > nmake -f makefile.stupid.win test
|
|
|
|
#----------------------------------------------------------------------------
|
|
# You must edit the variables in this section as appropriate for your machine
|
|
# The most common edits will just be:
|
|
# INSTALLDIR, and PYTHON_SRC
|
|
# ========= START OF SECTION FOR COMMON EDITS ==============
|
|
|
|
# this will have an "xpcom" subdir on install
|
|
INSTALLDIR=C:\Python20
|
|
|
|
# this is setup to use the *installed* Python directory structure
|
|
PYTHON_SRC=C:\Python20
|
|
|
|
|
|
# ========= END OF SECTION FOR COMMON EDITS ==============
|
|
# We expect a "mozilla" directory under this
|
|
MOZ_SRC=..\..\..\..\..
|
|
|
|
!IF DEFINED(DEBUG)
|
|
MOZ_BUILD_DIR=$(MOZ_SRC)\mozilla\dist\WIN32_D.OBJ
|
|
PYTHON_EXE=python_d.exe
|
|
!ELSE
|
|
MOZ_BUILD_DIR=$(MOZ_SRC)\mozilla\dist\WIN32_O.OBJ
|
|
PYTHON_EXE=python.exe
|
|
!ENDIF
|
|
|
|
MOZCOMPONENTSDIR=$(MOZ_BUILD_DIR)\bin\components
|
|
MOZINCLUDES=/I$(MOZ_SRC)\mozilla\dist\include /I$(MOZ_BUILD_DIR)\include
|
|
MOZLIBS=/LIBPATH:$(MOZ_BUILD_DIR)\lib
|
|
|
|
# this is setup to use the *installed* Python directory structure
|
|
# - To use the development Python dir structure some changes are
|
|
# necessary here *and* below (below, because there two lib dir
|
|
# to include in LDFLAGS for the dev dir structure)
|
|
PYTHONINCLUDES=/I$(PYTHON_SRC)\include /I$(PYTHON_SRC)\PC
|
|
PYTHONLIBS=/LIBPATH:$(PYTHON_SRC)\libs /LIBPATH:$(PYTHON_SRC)\pcbuild
|
|
|
|
MOZ_BIN=$(MOZ_BUILD_DIR)\bin
|
|
|
|
XPIDL=$(MOZ_BIN)\xpidl.exe
|
|
IDLINCLUDES=-I$(MOZ_SRC)\mozilla\dist\idl
|
|
REGXPCOM=$(MOZ_BIN)\regxpcom.exe
|
|
|
|
|
|
#----------------------------------------------------------------------------
|
|
# You should not need to edit anything beyond this point.
|
|
#
|
|
|
|
# the main PyXPCOM engine library
|
|
!IF DEFINED(DEBUG)
|
|
ENGINE=src\_xpcom_d.pyd
|
|
# the PyXPCOM loader
|
|
LOADER=src\loader\pyloader_d.dll
|
|
!ELSE
|
|
ENGINE=src\_xpcom.pyd
|
|
# the PyXPCOM loader
|
|
LOADER=src\loader\pyloader.dll
|
|
!ENDIF
|
|
|
|
|
|
all:: $(ENGINE) $(LOADER)
|
|
|
|
|
|
#---- build the PyXPCOM loader
|
|
|
|
!IF DEFINED(DEBUG)
|
|
LOADER_CFLAGS_THIS_BUILD=/ZI /MDd /Od /DDEBUG /D_DEBUG
|
|
LOADER_LDFLAGS_THIS_BUILD=/debug
|
|
!ELSE
|
|
LOADER_CFLAGS_THIS_BUILD=/MD /Ox /DNDEBUG /D_NDEBUG
|
|
LOADER_LDFLAGS_THIS_BUILD=
|
|
!ENDIF
|
|
|
|
LOADER_CFLAGS=/W3 /D WIN32 /D _WINDOWS /D XPCOM_EXPORTS $(LOADER_CFLAGS_THIS_BUILD)
|
|
LOADER_LDFLAGS=/dll $(LOADER_LDFLAGS_THIS_BUILD)
|
|
|
|
$(LOADER): src\loader\pyloader.cpp
|
|
cl /nologo $(LOADER_CFLAGS) $(MOZINCLUDES) $(PYTHONINCLUDES) \
|
|
/c src\loader\pyloader.cpp \
|
|
/Fosrc\loader\pyloader.obj
|
|
link $(LOADER_LDFLAGS) $(PYTHONLIBS) $(MOZLIBS) \
|
|
/out:$(LOADER) \
|
|
src\loader\pyloader.obj \
|
|
xpcom.lib
|
|
|
|
|
|
#---- build the PyXPCOM engine
|
|
|
|
!IF DEFINED(DEBUG)
|
|
ENGINE_CFLAGS_THIS_BUILD=/ZI /MDd /Od /DDEBUG /D_DEBUG
|
|
!ELSE
|
|
ENGINE_CFLAGS_THIS_BUILD=/MD /Ox /DNDEBUG /D_NDEBUG
|
|
!ENDIF
|
|
|
|
ENGINE_CFLAGS=/D _USRDLL /W3 /D WIN32 /D _WINDOWS /D XPCOM_EXPORTS $(ENGINE_CFLAGS_THIS_BUILD)
|
|
|
|
XPCOM_SRC_OBJECTS = \
|
|
src\ErrorUtils.obj \
|
|
src\PyGBase.obj \
|
|
src\PyGModule.obj \
|
|
src\PyGStub.obj \
|
|
src\PyGInputStream.obj \
|
|
src\PyGWeakReference.obj \
|
|
src\PyIComponentManager.obj \
|
|
src\PyIInputStream.obj \
|
|
src\PyIEnumerator.obj \
|
|
src\PyIID.obj \
|
|
src\PyIInterfaceInfo.obj \
|
|
src\PyIInterfaceInfoManager.obj \
|
|
src\PyIServiceManager.obj \
|
|
src\PyISimpleEnumerator.obj \
|
|
src\PyISupports.obj \
|
|
src\Pyxpt_info.obj \
|
|
src\TypeObject.obj \
|
|
src\VariantUtils.obj \
|
|
src\dllmain.obj \
|
|
src\xpcom.obj
|
|
|
|
.cpp.obj:
|
|
cl /nologo $(ENGINE_CFLAGS) $(MOZINCLUDES) $(PYTHONINCLUDES) -c $< -Fo$@
|
|
|
|
!IF DEFINED(DEBUG)
|
|
ENGINE_LDFLAGS_THIS_BUILD=/debug
|
|
!ELSE
|
|
ENGINE_LDFLAGS_THIS_BUILD=
|
|
!ENDIF
|
|
|
|
#XXX for debug: ENGINE_LDFLAGS_DEBUG=/DEBUG
|
|
ENGINE_LDFLAGS=/dll /export:init_xpcom $(ENGINE_LDFLAGS_THIS_BUILD)
|
|
|
|
$(ENGINE): $(XPCOM_SRC_OBJECTS)
|
|
link $(ENGINE_LDFLAGS) $(XPCOM_SRC_OBJECTS) $(MOZLIBS) $(PYTHONLIBS) /out:$(ENGINE)
|
|
|
|
|
|
#---- install PyXPCOM
|
|
|
|
XPCOM_PACKAGE_FILES = \
|
|
__init__.py \
|
|
components.py \
|
|
file.py \
|
|
nsError.py \
|
|
register.py \
|
|
xpcom_consts.py \
|
|
xpt.py \
|
|
client\__init__.py \
|
|
server\__init__.py \
|
|
server\enumerator.py \
|
|
server\factory.py \
|
|
server\loader.py \
|
|
server\module.py \
|
|
server\policy.py
|
|
|
|
# this is a cheasy install
|
|
# - no attention to permissions
|
|
# - doesn't explicitly use $(XPCOM_PACKAGE_FILES)
|
|
install:: all $(XPCOM_PACKAGE_FILES)
|
|
if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
|
|
if not exist $(INSTALLDIR)\xpcom mkdir $(INSTALLDIR)\xpcom
|
|
if not exist $(INSTALLDIR)\xpcom\client mkdir $(INSTALLDIR)\xpcom\client
|
|
if not exist $(INSTALLDIR)\xpcom\server mkdir $(INSTALLDIR)\xpcom\server
|
|
if not exist $(INSTALLDIR)\xpcom\test mkdir $(INSTALLDIR)\xpcom\test
|
|
if not exist $(INSTALLDIR)\xpcom\test\output mkdir $(INSTALLDIR)\xpcom\test\output
|
|
copy /v /y *.py $(INSTALLDIR)\xpcom
|
|
copy /v /y client\*.py $(INSTALLDIR)\xpcom\client
|
|
copy /v /y server\*.py $(INSTALLDIR)\xpcom\server
|
|
copy /v /y test\*.py $(INSTALLDIR)\xpcom\test
|
|
copy /v /y test\output\* $(INSTALLDIR)\xpcom\test\output
|
|
copy /v /y $(ENGINE) $(INSTALLDIR)\xpcom
|
|
if not exist $(MOZCOMPONENTSDIR) mkdir $(MOZCOMPONENTSDIR)
|
|
copy /v /y $(LOADER) $(MOZCOMPONENTSDIR)
|
|
set PYTHONPATH=$(INSTALLDIR);$(PYTHONPATH)
|
|
set PATH=$(MOZ_BIN);$(PATH)
|
|
$(REGXPCOM)
|
|
|
|
|
|
#---- build and run the PyXPCOM test suite
|
|
|
|
all:: test\test_component\py_test_component.xpt
|
|
|
|
test\test_component\py_test_component.xpt: test\test_component\py_test_component.idl
|
|
$(XPIDL) -m typelib -w $(IDLINCLUDES) -o test\test_component\py_test_component test\test_component\py_test_component.idl
|
|
|
|
install::
|
|
if not exist $(MOZCOMPONENTSDIR) mkdir $(MOZCOMPONENTSDIR)
|
|
copy /v /y test\test_component\py_test_component.xpt $(MOZCOMPONENTSDIR)
|
|
copy /v /y test\test_component\py_test_component.py $(MOZCOMPONENTSDIR)
|
|
set PYTHONPATH=$(INSTALLDIR);$(PYTHONPATH)
|
|
set PATH=$(MOZ_BIN);$(PATH)
|
|
$(REGXPCOM)
|
|
|
|
test:: install
|
|
set PATH=$(MOZ_BIN);$(PATH)
|
|
set PYTHONPATH=$(INSTALLDIR);$(PYTHONPATH)
|
|
$(PYTHON_EXE) test\regrtest.py
|
|
|
|
runpython:: install
|
|
set PATH=$(MOZ_BIN);$(PATH)
|
|
set PYTHONPATH=$(INSTALLDIR);$(PYTHONPATH)
|
|
$(PYTHON_EXE)
|
|
|
|
clean:
|
|
-del /f /q src\*.obj
|
|
-del /f /q src\loader\*.obj
|
|
-del /f /q *.pyc
|
|
-del /f /q client\*.pyc
|
|
-del /f /q server\*.pyc
|
|
-del /f /q test\*.pyc
|
|
|