summaryrefslogtreecommitdiff
path: root/src/libs/xpcom18a4/python/Makefile.kmk
blob: 50cc5e2d33e8de99ba26717f368112c41487fff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# $Id: Makefile.kmk $
## @file
# Sub-Makefile for Python bindings
#

#
# Copyright (C) 2009-2012 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#

SUB_DEPTH = ../../../..
include $(KBUILD_PATH)/subheader.kmk

ifdef VBOX_WITH_MULTIVERSION_PYTHON
 VBOX_MULTIPYTHON = 1
else
 VBOX_MULTIPYTHON = 0
endif

#
# List of supported Python versions, defining a number of
# VBOX_PYTHON[25|26|27|DEF]_[INC|LIB] variables which get picked up below.
#
ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
 ifeq ($(KBUILD_TARGET_ARCH),x86)
  VBOX_PYTHON25_INC = $(VBOX_PATH_MACOSX_SDK)/usr/include/python2.5
  VBOX_PYTHON25_LIB = $(VBOX_PATH_MACOSX_SDK)/usr/lib/libpython2.5.dylib
  VBOX_PYTHON25_LIB_X86 = $(VBOX_PYTHON25_LIB)
 endif
 if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) \
  && (   !defined(VBOX_OSE) \
      || "$(wildcard $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib)" != "")
  VBOX_PYTHON26_INC = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/include/python2.6
  VBOX_PYTHON26_LIB = $(VBOX_PATH_MACOSX_SDK_10_6)/usr/lib/libpython2.6.dylib
  VBOX_PYTHON26_LIB_X86 = $(VBOX_PYTHON26_LIB)
 endif
 if  !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7) \
  && (   defined(VBOX_NOT_OSE_LATER_SOMETIME) \
      || "$(wildcard $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib)" != "")
  VBOX_PYTHON27_INC = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/include/python2.7
  VBOX_PYTHON27_LIB = $(VBOX_PATH_MACOSX_SDK_10_7)/usr/lib/libpython2.7.dylib
  VBOX_PYTHON27_LIB_X86 = $(VBOX_PYTHON27_LIB)
 endif

else
 # Use the script.
 $(eval $(subst |,$(NL),$(shell $(VBOX_BLD_PYTHON) \
	$(PATH_SUB_CURRENT)/gen_python_deps.py \
	    $(KBUILD_TARGET) \
	    $(KBUILD_TARGET_ARCH) \
	    $(VBOX_MULTIPYTHON) )))
endif

ifndef VBOX_ONLY_SDK

#
# Base Python Client Module - the C++/XPCOM bits (not actually built).
#
VBoxPythonBase_TEMPLATE = XPCOM
VBoxPythonBase_CXXFLAGS = -Wno-write-strings
VBoxPythonBase_DLLSUFF.darwin = .so
VBoxPythonBase_DEFS     = \
	_IMPL_NS_COM \
	_IMPL_NS_BASE \
	EXPORT_XPTI_API \
        EXPORT_XPT_API \
	VBOX_PYXPCOM \
	VBOX_WITH_XPCOM \
	VBOX_PYXPCOM_VERSIONED
#VBoxPythonBase_DEFS.debug = \
#	VBOX_DEBUG_LIFETIMES
VBoxPythonBase_INCS     = \
	src
VBoxPythonBase_SOURCES  = \
	src/module/_xpcom.cpp \
	src/dllmain.cpp \
	src/ErrorUtils.cpp \
	src/PyGBase.cpp \
	src/PyGInputStream.cpp \
	src/PyGModule.cpp \
	src/PyGStub.cpp \
	src/PyGWeakReference.cpp \
	src/PyIClassInfo.cpp \
	src/PyIComponentManager.cpp \
	src/PyIComponentManagerObsolete.cpp \
	src/PyIEnumerator.cpp \
	src/PyIID.cpp \
	src/PyIInputStream.cpp \
	src/PyIInterfaceInfo.cpp \
	src/PyIInterfaceInfoManager.cpp \
	src/PyISimpleEnumerator.cpp \
	src/PyISupports.cpp \
	src/PyIVariant.cpp \
	src/Pyxpt_info.cpp \
	src/TypeObject.cpp \
	src/VariantUtils.cpp
VBoxPythonBase_LIBS     = \
	$(PATH_STAGE_LIB)/VBoxCOM$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_BIN)/VBoxXPCOM$(VBOX_SUFF_DLL)

# 32-bit base.
VBoxPythonBase_x86_TEMPLATE = XPCOM-x86
VBoxPythonBase_x86_EXTENDS  = VBoxPythonBase
VBoxPythonBase_x86_DEFS     = MODULE_NAME_SUFFIX=_x86 $(VBoxPythonBase_DEFS)
VBoxPythonBase_x86_LIBS     = \
	$(PATH_STAGE_LIB)/VBoxCOM-x86$(VBOX_SUFF_LIB) \
	$(PATH_STAGE_BIN)/VBoxXPCOM-x86$(VBOX_SUFF_DLL)


ifdef VBOX_PYTHON23_INC
#
# Python 2.3 version
#
DLLS += VBoxPython2_3
VBoxPython2_3_EXTENDS    = VBoxPythonBase
VBoxPython2_3_EXTENDS_BY = appending
VBoxPython2_3_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,)
VBoxPython2_3_INCS       = $(VBOX_PYTHON23_INC)
VBoxPython2_3_LIBS       = $(VBOX_PYTHON23_LIB)

 ifdef VBOX_WITH_32_ON_64_MAIN_API
DLLS += VBoxPython2_3_x86
VBoxPython2_3_x86_EXTENDS    = VBoxPythonBase_x86
VBoxPython2_3_x86_EXTENDS_BY = appending
VBoxPython2_3_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX104,-x86)
VBoxPython2_3_x86_INCS       = $(VBOX_PYTHON23_INC)
VBoxPython2_3_x86_LIBS       = $(VBOX_PYTHON23_LIB_X86)
 endif
endif

ifdef VBOX_PYTHON24_INC
#
# Python 2.4 version
#
DLLS += VBoxPython2_4
VBoxPython2_4_EXTENDS    = VBoxPythonBase
VBoxPython2_4_EXTENDS_BY = appending
VBoxPython2_4_INCS       = $(VBOX_PYTHON24_INC)
VBoxPython2_4_LIBS       = $(VBOX_PYTHON24_LIB)

 ifdef VBOX_WITH_32_ON_64_MAIN_API
DLLS += VBoxPython2_4_x86
VBoxPython2_4_x86_EXTENDS    = VBoxPythonBase_x86
VBoxPython2_4_x86_EXTENDS_BY = appending
VBoxPython2_4_x86_INCS       = $(VBOX_PYTHON24_INC)
VBoxPython2_4_x86_LIBS       = $(VBOX_PYTHON24_LIB_X86)
 endif
endif

ifdef VBOX_PYTHON25_INC
#
# Python 2.5 version
#
DLLS += VBoxPython2_5
VBoxPython2_5_EXTENDS    = VBoxPythonBase
VBoxPython2_5_EXTENDS_BY = appending
VBoxPython2_5_INCS       = $(VBOX_PYTHON25_INC)
VBoxPython2_5_LIBS       = $(VBOX_PYTHON25_LIB)

 ifdef VBOX_WITH_32_ON_64_MAIN_API
DLLS += VBoxPython2_5_x86
VBoxPython2_5_x86_EXTENDS    = VBoxPythonBase_x86
VBoxPython2_5_x86_EXTENDS_BY = appending
VBoxPython2_5_x86_INCS       = $(VBOX_PYTHON25_INC)
VBoxPython2_5_x86_LIBS       = $(VBOX_PYTHON25_LIB_X86)
 endif
endif

ifdef VBOX_PYTHON26_INC
#
# Python 2.6 version
#
DLLS += VBoxPython2_6
VBoxPython2_6_EXTENDS    = VBoxPythonBase
VBoxPython2_6_EXTENDS_BY = appending
VBoxPython2_6_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,)
VBoxPython2_6_INCS       = $(VBOX_PYTHON26_INC)
VBoxPython2_6_LIBS       = $(VBOX_PYTHON26_LIB)

 ifdef VBOX_WITH_32_ON_64_MAIN_API
DLLS += VBoxPython2_6_x86
VBoxPython2_6_x86_EXTENDS    = VBoxPythonBase_x86
VBoxPython2_6_x86_EXTENDS_BY = appending
VBoxPython2_6_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,-x86)
VBoxPython2_6_x86_INCS       = $(VBOX_PYTHON26_INC)
VBoxPython2_6_x86_LIBS       = $(VBOX_PYTHON26_LIB_X86)
 endif
endif

ifdef VBOX_PYTHON27_INC
#
# Python 2.7 version
#
DLLS += VBoxPython2_7
VBoxPython2_7_EXTENDS    = VBoxPythonBase
VBoxPython2_7_EXTENDS_BY = appending
VBoxPython2_7_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,)
VBoxPython2_7_INCS       = $(VBOX_PYTHON27_INC)
VBoxPython2_7_LIBS       = $(VBOX_PYTHON27_LIB)

 ifdef VBOX_WITH_32_ON_64_MAIN_API
DLLS += VBoxPython2_7_x86
VBoxPython2_7_x86_EXTENDS    = VBoxPythonBase_x86
VBoxPython2_7_x86_EXTENDS_BY = appending
VBoxPython2_7_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,-x86)
VBoxPython2_7_x86_INCS       = $(VBOX_PYTHON27_INC)
VBoxPython2_7_x86_LIBS       = $(VBOX_PYTHON27_LIB_X86)
 endif
endif

ifdef VBOX_PYTHONDEF_INC
#
# Python without versioning
#
DLLS += VBoxPython
VBoxPython_EXTENDS      = VBoxPythonBase
VBoxPython_DEFS         = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_DEFS))
VBoxPython_INCS         = $(VBoxPythonBase_INCS) $(VBOX_PYTHONDEF_INC)
if "$(KBUILD_TARGET)" == "linux"
 VBoxPython_LIBS        = $(VBoxPythonBase_LIBS)
else
 VBoxPython_LIBS        = $(VBoxPythonBase_LIBS) $(VBOX_PYTHONDEF_LIB)
endif

 ifdef VBOX_WITH_32_ON_64_MAIN_API
VBoxPython_x86_EXTENDS      = VBoxPythonBase_x86
VBoxPython_x86_DEFS         = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_x86_DEFS))
VBoxPython_x86_INCS         = $(VBoxPythonBase_x86_INCS) $(VBOX_PYTHONDEF_INC)
if "$(KBUILD_TARGET)" == "linux"
 VBoxPython_x86_LIBS        = $(VBoxPythonBase_x86_LIBS)
else
 VBoxPython_x86_LIBS        = $(VBoxPythonBase_x86_LIBS) $(VBOX_PYTHONDEF_LIB_X86)
endif
 endif
endif

endif # VBOX_ONLY_SDK

#
# Install the python modules.
#
INSTALLS += VBoxPython-inst-py-xpcom
VBoxPython-inst-py-xpcom_INST = $(INST_SDK)bindings/xpcom/python/xpcom/
VBoxPython-inst-py-xpcom_MODE = a+r,u+w
VBoxPython-inst-py-xpcom_SOURCES = \
	vboxxpcom.py \
	components.py \
	file.py \
	__init__.py \
	nsError.py \
	primitives.py \
	xpcom_consts.py \
	xpt.py \
	client/__init__.py=>client/__init__.py \
	server/__init__.py=>server/__init__.py \
	server/enumerator.py=>server/enumerator.py \
	server/factory.py=>server/factory.py \
	server/loader.py=>server/loader.py \
	server/module.py=>server/module.py \
	server/policy.py=>server/policy.py


include $(FILE_KBUILD_SUB_FOOTER)