From 7934ec525b72d651124e6379006e1f31ce14b09d Mon Sep 17 00:00:00 2001 From: Tim Yardley Date: Wed, 7 Mar 2007 15:50:06 +0000 Subject: [PATCH] cp python to python24 in prop to migrate to 2.5, if 2.5 succeeds completely, python24 can br rm'd.. otherwise ignore this for the moment SVN-Revision: 6538 --- lang/python24/Makefile | 110 +++++++++++++++ lang/python24/patches/000-cross-compile.patch | 129 ++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 lang/python24/Makefile create mode 100644 lang/python24/patches/000-cross-compile.patch diff --git a/lang/python24/Makefile b/lang/python24/Makefile new file mode 100644 index 000000000..381ef6726 --- /dev/null +++ b/lang/python24/Makefile @@ -0,0 +1,110 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=python24 +PKG_VERSION:=2.4.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.python.org/ftp/python/2.4.4/ +PKG_MD5SUM:=0ba90c79175c017101100ebf5978e906 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/python24 + SECTION:=lang + CATEGORY:=Languages + DEPENDS:=+uclibcxx + TITLE:=Python 2.4 programming language + URL:=http://www.python.org/ +endef + +define Package/python24/description +Python programming language + Python is a dynamic object-oriented programming language that + can be used for many kinds of software development. It offers + strong support for integration with other languages and tools, + comes with extensive standard libraries, and can be learned in a + few days. Many Python programmers report substantial productivity + gains and feel the language encourages the development of higher + quality, more maintainable code. +endef + +define Build/Configure + (cd $(PKG_BUILD_DIR); \ + CONFIG_SITE= \ + ./configure --with-threads=no; \ + $(MAKE) python Parser/pgen; \ + mv python hostpython; \ + mv Parser/pgen Parser/hostpgen; \ + make distclean; \ + echo "import sys" > $(PKG_BUILD_DIR)/setup.py.new; \ + echo "sys.path.append('$(PKG_BUILD_DIR)/Lib')" >> $(PKG_BUILD_DIR)/setup.py.new; \ + cat $(PKG_BUILD_DIR)/setup.py >> $(PKG_BUILD_DIR)/setup.py.new; \ + mv $(PKG_BUILD_DIR)/setup.py.new $(PKG_BUILD_DIR)/setup.py; \ + ); + $(call Build/Configure/Default, \ + --disable-shared \ + --sysconfdir=/etc \ + --with-threads=no, \ + HOSTPYTHON=./hostpython \ + HOSTPGEN=./Parser/hostpgen \ + ) +endef + +MAKE_OPTS:=\ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS)" \ + LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" \ + LD="$(TARGET_CC)" \ + HOSTPYTHON=./hostpython \ + HOSTPGEN=./Parser/hostpgen + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(MAKE_OPTS) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/bin + $(CP) $(PKG_BUILD_DIR)/hostpython $(STAGING_DIR)/usr/bin/ + mkdir -p $(STAGING_DIR)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/python2.4 $(STAGING_DIR)/usr/include/ + mkdir -p $(STAGING_DIR)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.4 $(STAGING_DIR)/usr/lib/ +endef + +define Build/UninstallDev + rm -rf \ + $(STAGING_DIR)/usr/{include,lib}/python2.4 +endef + +define Package/python24/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/python2.4 $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.4 $(1)/usr/lib/ + rm -rf \ + $(1)/usr/lib/python2.4/bsddb/test \ + $(1)/usr/lib/python2.4/distutils/tests \ + $(1)/usr/lib/python2.4/email/test \ + $(1)/usr/lib/python2.4/idlelib \ + $(1)/usr/lib/python2.4/lib-tk \ + $(1)/usr/lib/python2.4/test \ + +endef + +$(eval $(call BuildPackage,python24)) diff --git a/lang/python24/patches/000-cross-compile.patch b/lang/python24/patches/000-cross-compile.patch new file mode 100644 index 000000000..4072738dd --- /dev/null +++ b/lang/python24/patches/000-cross-compile.patch @@ -0,0 +1,129 @@ +diff -uN Python-2.4.3.orig/Makefile.pre.in Python-2.4.3.cc/Makefile.pre.in +--- Python-2.4.3.orig/Makefile.pre.in 2006-03-13 07:08:41.000000000 -0600 ++++ Python-2.4.3.cc/Makefile.pre.in 2006-10-13 14:47:12.000000000 -0500 +@@ -162,6 +162,7 @@ + + PYTHON= python$(EXE) + BUILDPYTHON= python$(BUILDEXE) ++HOSTPYTHON= ./$(BUILDPYTHON) + + # === Definitions added by makesetup === + +@@ -189,6 +190,8 @@ + # Parser + PGEN= Parser/pgen$(EXE) + ++HOSTPGEN= $(PGEN) ++ + POBJS= \ + Parser/acceler.o \ + Parser/grammar1.o \ +@@ -320,8 +323,8 @@ + # Build the shared modules + sharedmods: $(BUILDPYTHON) + case $$MAKEFLAGS in \ +- *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ +- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ ++ *-s*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \ ++ *) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \ + esac + + # buildno should really depend on something like LIBRARY_SRC +@@ -442,8 +445,7 @@ + + + $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) +- -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) +- ++ -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) + $(PGEN): $(PGENOBJS) + $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) + +@@ -723,19 +725,19 @@ + done + $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) + PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ + -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ ++ $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + +@@ -830,7 +832,8 @@ + # Install the dynamically loadable modules + # This goes into $(exec_prefix) + sharedinstall: +- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ ++ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \ ++ $(HOSTPYTHON) -E $(srcdir)/setup.py install \ + --prefix=$(prefix) \ + --install-scripts=$(BINDIR) \ + --install-platlib=$(DESTSHARED) \ +diff -uN Python-2.4.3.orig/setup.py Python-2.4.3.cc/setup.py +--- Python-2.4.3.orig/setup.py 2006-03-23 13:07:46.000000000 -0600 ++++ Python-2.4.3.cc/setup.py 2006-10-13 15:36:01.000000000 -0500 +@@ -205,26 +205,30 @@ + try: + imp.load_dynamic(ext.name, ext_filename) + except ImportError, why: +- self.announce('*** WARNING: renaming "%s" since importing it' +- ' failed: %s' % (ext.name, why), level=3) +- assert not self.inplace +- basename, tail = os.path.splitext(ext_filename) +- newname = basename + "_failed" + tail +- if os.path.exists(newname): +- os.remove(newname) +- os.rename(ext_filename, newname) +- +- # XXX -- This relies on a Vile HACK in +- # distutils.command.build_ext.build_extension(). The +- # _built_objects attribute is stored there strictly for +- # use here. +- # If there is a failure, _built_objects may not be there, +- # so catch the AttributeError and move on. +- try: +- for filename in self._built_objects: +- os.remove(filename) +- except AttributeError: +- self.announce('unable to remove files (ignored)') ++ if os.environ.get('CROSS_COMPILE') != "yes": ++ self.announce('*** WARNING: renaming "%s" since importing it' ++ ' failed: %s' % (ext.name, why), level=3) ++ assert not self.inplace ++ basename, tail = os.path.splitext(ext_filename) ++ newname = basename + "_failed" + tail ++ if os.path.exists(newname): ++ os.remove(newname) ++ os.rename(ext_filename, newname) ++ ++ # XXX -- This relies on a Vile HACK in ++ # distutils.command.build_ext.build_extension(). The ++ # _built_objects attribute is stored there strictly for ++ # use here. ++ # If there is a failure, _built_objects may not be there, ++ # so catch the AttributeError and move on. ++ try: ++ for filename in self._built_objects: ++ os.remove(filename) ++ except AttributeError: ++ self.announce('unable to remove files (ignored)') ++ else: ++ self.announce('WARNING: "%s" failed importing, but we leave it because we are cross-compiling' % ext.name) ++ + except: + exc_type, why, tb = sys.exc_info() + self.announce('*** WARNING: importing extension "%s" ' -- 2.30.2