Skip to content

Commit b768137

Browse files
spiffJim Carroll
authored andcommitted
Code changes for external python. Changes include submissions by cptspiff,WiSo,blinkseb, and jcarroll
changed: limit the scope of the python includes. this will be useful in an upcomming patch. credit jcarroll changed: use a m4 check to set the python path directly, and ditch the old hardcoded version nonsense. credit jcarroll Fixed the build for when --enable-external-python is not used. Fixed the warnings due to Python.h not being the first header as required by Python. Final fix to the osx make build so that external python works. Needed to change the m4 macro to account for .dylib on osx and the dependant ./configure call to pass the installed location of the python xbmc is to be built against. Also updated .gitignore for the osx dependency builds. There was a name collision between the python datetime.h and the xbmc/DateTime.h on file systems that are not case sensitive. This is now fixed by renaming DateTime.h to XBDateTime.h By request, the .cpp files now sorted alphabetically in the Makefile.in. the m4 macros is a mess of mixed spaces and tabs. In order to make my couple line change more readable I changed the spaces to tabs so it would be consistent with the surrounding area. This was per the request of jmarshall. Fixed an error where under internal python the correct header wasn't being used. if --enable-external-python is selected then don't build the internal python at all and not using any of the wrappers. Modified the xcode project to work with the external python changes. There was a bug in the Makefile.in where the internal python build target wasn't being set correctly. This is now fixed. [WIN32] removed some uneeded files, renamed DateTime* to XBDateTime* and defined USE_EXTERNAL_PYTHON Added xbmc/cores/DllLoader/Makefile to .gitignore since it's being autogened. Made it so that the distinction between internal and external python is limited to mostly just Makefile's now. Most of the code no longer needs to make the distinction. This should make it much easier to move forward in windows and eventually with removing the internal python. updated: .gitignore
1 parent 3b508b2 commit b768137

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+613
-835
lines changed

.gitignore

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,7 @@ lib/cmyth/Makefile
385385
/system/profiles.xml
386386

387387
# /system/python
388-
/system/python/Lib/
389-
/system/python/python24.zip
390-
/system/python/python24.dll
391-
/system/python/DLLs/_socket.pyd
392-
/system/python/DLLs/pyexpat.pyd
393-
/system/python/DLLs/select.pyd
394-
/system/python/DLLs/unicodedata.pyd
395-
/system/python/DLLs/zlib.pyd
396-
/system/python/DLLs/bz2.pyd
388+
/system/python/
397389

398390
# /system/webserver
399391
/system/webserver
@@ -496,6 +488,7 @@ lib/cmyth/Makefile
496488
/xbmc/cores/DllLoader/exports/build_wrapper.sh
497489
/xbmc/cores/DllLoader/exports/wrapper.def
498490
/xbmc/cores/DllLoader/Makefile
491+
499492
/xbmc/cores/Makefile
500493

501494
/xbmc/cores/VideoRenderers/Makefile
@@ -1029,6 +1022,8 @@ lib/cmyth/Makefile
10291022

10301023
# /xbmc/interfaces/
10311024
/xbmc/interfaces/Makefile
1025+
/xbmc/interfaces/python/Makefile
1026+
/xbmc/interfaces/python/xbmcmodule/Makefile
10321027
/xbmc/interfaces/python/linux/Makefile
10331028
/xbmc/interfaces/python/linux/wrapper_python.def
10341029

Makefile.in

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ LIB_DIRS=\
120120
lib/libhdhomerun \
121121
lib/libid3tag \
122122
lib/libapetag \
123-
xbmc/interfaces/python/linux \
124123
lib/cpluff \
125124
lib/xbmc-dll-symbols \
126125
lib/jsoncpp/src/lib_json
127126

127+
ifneq (@USE_EXTERNAL_PYTHON@,1)
128+
LIB_DIRS+=xbmc/interfaces/python/linux
129+
endif
130+
128131
SS_DIRS=\
129132
xbmc/screensavers/rsxs-0.9/xbmc
130133

@@ -168,6 +171,12 @@ DISTCLEAN_FILES=config.h config.log config.status tools/Linux/xbmc.sh \
168171
lib/python/libpython2.4.so.1.0 \
169172
system/libcpluff-@[email protected]
170173

174+
ifneq (@USE_EXTERNAL_PYTHON@,1)
175+
PYTHON_TARGET=python
176+
else
177+
PYTHON_TARGET=
178+
endif
179+
171180
all : Makefile externals xbmc.bin xbmc-xrandr skins
172181

173182
include Makefile.include
@@ -407,8 +416,10 @@ endif
407416
libpython: dllloader
408417
$(MAKE) -C xbmc/interfaces/python
409418
$(MAKE) -C xbmc/interfaces/python/xbmcmodule
419+
ifneq (@USE_EXTERNAL_PYTHON@,1)
410420
python: dllloader
411421
$(MAKE) -C xbmc/interfaces/python/linux
422+
endif
412423
dvdpcodecs: dllloader
413424
$(MAKE) -C lib
414425
$(MAKE) -C lib/libdvd
@@ -453,6 +464,12 @@ codecs: papcodecs dvdpcodecs
453464
libs: cmyth libhdhomerun libid3tag imagelib libexif python system/libcpluff-@[email protected]
454465
externals: codecs libs python visualizations screensavers
455466

467+
ifeq ($(findstring osx,@ARCH@), osx)
468+
libs: libhdhomerun libid3tag imagelib libexif $(PYTHON_TARGET) system/libcpluff-@[email protected] system/players/paplayer/libmodplug-@[email protected]
469+
else
470+
libs: libhdhomerun libid3tag imagelib libexif $(PYTHON_TARGET) system/libcpluff-@[email protected]
471+
endif
472+
456473
xcode_depends: \
457474
codecs libs python visualizations screensavers eventclients skins \
458475
lib/libsquish/libsquish.a \
@@ -579,6 +596,10 @@ ifeq ($(findstring arm,@ARCH@), arm)
579596
LIBS +=-lpython2.6
580597
endif
581598

599+
ifeq (@USE_EXTERNAL_PYTHON@,1)
600+
LIBS += @PYTHON_LDFLAGS@
601+
endif
602+
582603
xbmc.bin: $(OBJSXBMC) $(DYNOBJSXBMC)
583604
ifeq ($(findstring osx,@ARCH@), osx)
584605
$(CXX) $(LDFLAGS) -o xbmc.bin -Wl,-all_load,-ObjC $(DYNOBJSXBMC) $(OBJSXBMC) $(LIBS) -rdynamic

XBMC.xcodeproj/project.pbxproj

Lines changed: 44 additions & 58 deletions
Large diffs are not rendered by default.

configure.in

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ AC_PREREQ(2.59)
55
AC_INIT([xbmc], [9.11], [http://trac.xbmc.org])
66
AC_CONFIG_HEADERS([xbmc/config.h])
77
AH_TOP([#pragma once])
8+
m4_include([m4/ax_python_devel.m4])
89

910
AC_CONFIG_AUX_DIR([build-aux])
1011
AM_INIT_AUTOMAKE([foreign])
@@ -891,29 +892,21 @@ fi
891892

892893
# External Python
893894
if test "$use_external_python" = "yes"; then
894-
AC_CHECK_LIB([python2.6], [main],
895-
[AC_DEFINE([HAVE_LIBPYTHON2_6], [1],
896-
[Define to 1 if you have the 'python2.6' library.])
897-
USE_PYTHON2_6=1],
898-
[AC_CHECK_LIB([python2.5], [main],
899-
[AC_DEFINE([HAVE_LIBPYTHON2_5], [1],
900-
[Define to 1 if you have the 'python2.5' library.])
901-
USE_PYTHON2_5=1],
902-
[AC_CHECK_LIB([python2.4], [main],
903-
[AC_DEFINE([HAVE_LIBPYTHON2_4], [1],
904-
[Define to 1 if you have the 'python2.4' library.])
905-
USE_PYTHON2_4=1],
906-
[AC_MSG_ERROR($missing_library)] )] )] )
907-
908-
AC_MSG_NOTICE($external_python_enabled)
909-
test "$USE_PYTHON2_6" && AC_MSG_NOTICE([Using Python 2.6])
910-
test "$USE_PYTHON2_5" && AC_MSG_NOTICE([Using Python 2.5])
911-
test "$USE_PYTHON2_4" && AC_MSG_NOTICE([Using Python 2.4])
912-
USE_EXTERNAL_PYTHON=1
913-
AC_DEFINE([USE_EXTERNAL_PYTHON], [1], [Whether to use external python library.])
895+
AX_PYTHON_DEVEL([>= 2.4])
896+
PYTHON_VERSION=$ac_python_version
897+
898+
if test -z "$PYTHON_VERSION"; then
899+
AC_MSG_NOTICE($external_python_disabled)
900+
USE_EXTERNAL_PYTHON=0
901+
else
902+
AC_MSG_NOTICE($external_python_enabled)
903+
AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
904+
USE_EXTERNAL_PYTHON=1
905+
AC_DEFINE([USE_EXTERNAL_PYTHON], [1], [Whether to use external python library.])
906+
fi
914907
else
915-
AC_MSG_NOTICE($external_python_disabled)
916908
USE_EXTERNAL_PYTHON=0
909+
PYTHON_CPPFLAGS="-I\$(abs_top_srcdir)/lib/python/Include"
917910
fi
918911

919912
# VDPAU
@@ -1401,7 +1394,8 @@ OUTPUT_FILES="Makefile \
14011394
lib/libsquish/Makefile \
14021395
lib/libid3tag/Makefile \
14031396
lib/cximage-6.0/Makefile \
1404-
xbmc/interfaces/python/linux/Makefile \
1397+
xbmc/interfaces/python/Makefile \
1398+
xbmc/interfaces/python/xbmcmodule/Makefile \
14051399
lib/libUPnP/Makefile \
14061400
xbmc/DllPaths_generated.h \
14071401
xbmc/linux/Makefile \
@@ -1434,9 +1428,7 @@ AC_SUBST(BUILD_DVDCSS)
14341428
AC_SUBST(BUILD_GOOM)
14351429
AC_SUBST(USE_EXTERNAL_FFMPEG)
14361430
AC_SUBST(USE_EXTERNAL_PYTHON)
1437-
AC_SUBST(USE_PYTHON2_6)
1438-
AC_SUBST(USE_PYTHON2_5)
1439-
AC_SUBST(USE_PYTHON2_4)
1431+
AC_SUBST(PYTHON_VERSION)
14401432
AC_SUBST(OUTPUT_FILES)
14411433
AC_SUBST(HAVE_XBMC_NONFREE)
14421434
AC_SUBST(USE_ASAP_CODEC)

0 commit comments

Comments
 (0)