Kaynağa Gözat

finetune python2 for pacemaker usage

Waldemar Brodkorb 12 yıl önce
ebeveyn
işleme
b35c2c3127

+ 21 - 3
package/python2/Makefile

@@ -5,12 +5,12 @@ include ${TOPDIR}/rules.mk
 
 PKG_NAME:=		python2
 PKG_VERSION:=		2.7.1
-PKG_RELEASE:=		1
+PKG_RELEASE:=		2
 PKG_MD5SUM:=		15ed56733655e3fab785e49a7278d2fb
 PKG_DESCR:=		Python scripting language (Version 2)
 PKG_SECTION:=		lang
+PKG_BUILDDEP:=		zlib libffi openssl readline bzip2
 PKG_DEPENDS:=		libpthread zlib libffi libopenssl
-PKG_BUILDDEP:=		zlib libffi openssl
 PKG_URL:=		http://www.python.org/
 PKG_SITES:=		http://www.python.org/ftp/python/${PKG_VERSION}/
 PKG_OPTS:=		noscripts
@@ -20,9 +20,15 @@ PKG_HOST_DEPENDS:=	!netbsd !openbsd !cygwin
 DISTFILES=		Python-${PKG_VERSION}.tgz
 WRKDIST=		${WRKDIR}/Python-${PKG_VERSION}
 
+PKG_SUBPKGS:=		PYTHON2 PYTHON2_READLINE PYTHON2_BZIP2
+PKGSS_PYTHON2_READLINE:=libreadline
+PKGSS_PYTHON2_BZIP2:=	bzip2
+
 include ${TOPDIR}/mk/package.mk
 
 $(eval $(call PKG_template,PYTHON2,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call PKG_template,PYTHON2_BZIP2,${PKG_NAME}-bzip2,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_PYTHON2_BZIP2},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
+$(eval $(call PKG_template,PYTHON2_READLINE,${PKG_NAME}-readline,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_PYTHON2_READLINE},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
 
 MAKE_ENV+=		OPT="$(TARGET_CFLAGS)" \
 			RANLIB="${TARGET_CROSS}ranlib" \
@@ -49,7 +55,7 @@ post-extract:
 	${CP} ${WRKBUILD}/python ${STAGING_HOST_DIR}/usr/bin/hostpython
 	${CP} ${WRKBUILD}/Parser/pgen ${WRKBUILD}/Parser/hostpgen
 	${CP} ${WRKBUILD}/python ${WRKBUILD}/hostpython
-	$(MAKE) -C ${WRKBUILD} clean
+	$(MAKE) -C ${WRKBUILD} distclean
 
 pre-configure:
 	$(SED) "s#@@CPU_ARCH@@#$(CPU_ARCH)#" ${WRKBUILD}/configure
@@ -63,7 +69,19 @@ post-install:
 	${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
 	${CP} ${WRKINST}/usr/include/python2.7/* ${IDIR_PYTHON2}/usr/include/python2.7
 	-find ${IDIR_PYTHON2} -name "\*.pyc" -o -name "*\.pyo" -exec rm {} \;
+	rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/readline.so
+	rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/bz2.so
 	# workaround, copy host python-config to target scripts directory
 	${CP} ${STAGING_HOST_DIR}/usr/bin/python*-config ${STAGING_DIR}/scripts
 
+python2-readline-install:
+	${INSTALL_DIR} ${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
+	${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/readline.so \
+		${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
+
+python2-bzip2-install:
+	${INSTALL_DIR} ${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
+	${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/bz2.so \
+		${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
+
 include ${TOPDIR}/mk/pkg-bottom.mk

+ 0 - 11
package/python2/patches/patch-Modules_Setup_config

@@ -1,11 +0,0 @@
---- Python-2.7.1.orig/Modules/Setup.config	2010-12-27 21:24:34.000000000 +0100
-+++ Python-2.7.1/Modules/Setup.config	2010-12-27 21:07:05.000000000 +0100
-@@ -4,7 +4,7 @@
- # based on configure-time options.
- 
- # Threading
--#thread threadmodule.c
-+thread threadmodule.c
- 
- # The signal module
- signal signalmodule.c

+ 0 - 18
package/python2/patches/patch-Modules_config_c

@@ -1,18 +0,0 @@
---- Python-2.7.1.orig/Modules/config.c	2010-12-27 21:24:35.000000000 +0100
-+++ Python-2.7.1/Modules/config.c	2010-12-27 21:07:05.000000000 +0100
-@@ -23,6 +23,7 @@ extern "C" {
- #endif
- 
- 
-+extern void initthread(void);
- extern void initsignal(void);
- extern void initposix(void);
- extern void initerrno(void);
-@@ -44,6 +45,7 @@ extern void _PyWarnings_Init(void);
- 
- struct _inittab _PyImport_Inittab[] = {
- 
-+	{"thread", initthread},
- 	{"signal", initsignal},
- 	{"posix", initposix},
- 	{"errno", initerrno},

+ 3 - 3
package/python2/patches/patch-configure

@@ -1,5 +1,5 @@
---- Python-2.7.orig/configure	2010-05-28 17:28:47.000000000 +0200
-+++ Python-2.7/configure	2010-11-04 22:17:32.000000000 +0100
+--- Python-2.7.1.orig/configure	2010-11-01 02:47:19.000000000 +0100
++++ Python-2.7.1/configure	2011-10-06 18:21:02.848792210 +0200
 @@ -2972,12 +2972,12 @@ fi
  $as_echo_n "checking MACHDEP... " >&6; }
  if test -z "$MACHDEP"
@@ -20,7 +20,7 @@
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking machine type as reported by uname -m" >&5
  $as_echo_n "checking machine type as reported by uname -m... " >&6; }
 -ac_sys_machine=`uname -m`
-+ac_sys_machine=i586
++ac_sys_machine=@@CPU_ARCH@@
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sys_machine" >&5
  $as_echo "$ac_sys_machine" >&6; }
  

+ 21 - 3
package/python2/patches/patch-setup_py

@@ -1,12 +1,12 @@
 diff -Nur Python-2.7.orig/setup.py Python-2.7/setup.py
 --- Python-2.7.1.orig/setup.py	2010-10-31 17:40:21.000000000 +0100
-+++ Python-2.7.1/setup.py	2010-12-27 21:06:29.000000000 +0100
++++ Python-2.7.1/setup.py	2011-10-06 20:34:53.328787057 +0200
 @@ -21,7 +21,7 @@ from distutils.spawn import find_executa
  COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
  
  # This global variable is used to hold the list of modules to be disabled.
 -disabled_module_list = []
-+disabled_module_list = ['nis', 'bz2']
++disabled_module_list = ['nis']
  
  def add_dir_to_list(dirlist, dir):
      """Add the directory 'dir' to the list 'dirlist' (at the front) if
@@ -62,7 +62,25 @@ diff -Nur Python-2.7.orig/setup.py Python-2.7/setup.py
  
          # Add paths specified in the environment variables LDFLAGS and
          # CPPFLAGS for header and library files.
-@@ -403,11 +369,8 @@ class PyBuildExt(build_ext):
+@@ -384,17 +350,6 @@ class PyBuildExt(build_ext):
+                     for directory in reversed(options.dirs):
+                         add_dir_to_list(dir_list, directory)
+ 
+-        if os.path.normpath(sys.prefix) != '/usr' \
+-                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
+-            # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
+-            # (PYTHONFRAMEWORK is set) to avoid # linking problems when
+-            # building a framework with different architectures than
+-            # the one that is currently installed (issue #7473)
+-            add_dir_to_list(self.compiler.library_dirs,
+-                            sysconfig.get_config_var("LIBDIR"))
+-            add_dir_to_list(self.compiler.include_dirs,
+-                            sysconfig.get_config_var("INCLUDEDIR"))
+-
+         try:
+             have_unicode = unicode
+         except NameError:
+@@ -403,11 +358,8 @@ class PyBuildExt(build_ext):
          # lib_dirs and inc_dirs are used to search for files;
          # if a file is found in one of those directories, it can
          # be assumed that no additional -I,-L directives are needed.