summaryrefslogtreecommitdiff
path: root/package/python3
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2013-10-28 16:31:39 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2013-10-28 16:31:39 +0100
commit333245969917c94a03900881cc9ac5c1c401ab86 (patch)
treef946b05d7bbbd122b22b58f721dbfae1697939fb /package/python3
parentabf9133a1ccc45a695d567cea9d94c19fc1c2b5d (diff)
update python3 to new host build style
Diffstat (limited to 'package/python3')
-rw-r--r--package/python3/Makefile125
-rw-r--r--package/python3/patches/patch-Makefile_pre_in41
-rw-r--r--package/python3/patches/patch-Modules__io__iomodule_h14
-rw-r--r--package/python3/patches/patch-configure34
-rw-r--r--package/python3/patches/patch-setup_py146
5 files changed, 360 insertions, 0 deletions
diff --git a/package/python3/Makefile b/package/python3/Makefile
new file mode 100644
index 000000000..3ce608171
--- /dev/null
+++ b/package/python3/Makefile
@@ -0,0 +1,125 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include ${TOPDIR}/rules.mk
+
+PKG_NAME:= python3
+PKG_VERSION:= 3.3.2
+PKG_RELEASE:= 1
+PKG_MD5SUM:= 0a2ea57f6184baf45b150aee53c0c8da
+PKG_DESCR:= Python scripting language (Version 3)
+PKG_SECTION:= lang
+PKG_DEPENDS:= libpthread libgcc libffi
+PKG_BUILDDEP:= python3-host libffi
+PKG_URL:= http://www.python.org/
+PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/
+
+PKG_HOST_DEPENDS:= !netbsd !openbsd !cygwin
+
+PKG_FLAVOURS_PYTHON3:= MOD_ZLIB MOD_BZ2 MOD_EXPAT MOD_SQLITE MOD_GDBM
+PKG_FLAVOURS_PYTHON3+= MOD_NCURSES MOD_SSL MOD_READLINE
+
+PKGFD_MOD_ZLIB:= ZLIB support
+PKGFB_MOD_ZLIB:= zlib
+PKGFS_MOD_ZLIB:= zlib
+PKGFD_MOD_BZ2:= BZIP2 support
+PKGFB_MOD_BZ2:= bzip2
+PKGFS_MOD_BZ2:= libbz2
+PKGFD_MOD_EXPAT:= XML support
+PKGFB_MOD_EXPAT:= expat
+PKGFS_MOD_EXPAT:= libexpat
+PKGFD_MOD_SQLITE:= SQLITE support
+PKGFB_MOD_SQLITE:= sqlite
+PKGFS_MOD_SQLITE:= libsqlite
+PKGFD_MOD_GDBM:= GDBM support
+PKGFB_MOD_GDBM:= gdbm
+PKGFS_MOD_GDBM:= libgdbm
+PKGFD_MOD_NCURSES:= NCURSES support
+PKGFB_MOD_NCURSES:= ncurses
+PKGFS_MOD_NCURSES:= libncurses
+PKGFD_MOD_READLINE:= READLINE support
+PKGFB_MOD_READLINE:= readline
+PKGFS_MOD_READLINE:= libreadline
+PKGFD_MOD_SSL:= OpenSSL support
+PKGFB_MOD_SSL:= openssl
+PKGFS_MOD_SSL:= libopenssl
+
+DISTFILES= Python-${PKG_VERSION}.tgz
+WRKDIST= ${WRKDIR}/Python-${PKG_VERSION}
+
+include ${TOPDIR}/mk/host.mk
+include ${TOPDIR}/mk/package.mk
+
+define PKG_mod_template
+
+INSTALL_MODS_$${ADK_PACKAGE_${1}}+= ${2}-install
+
+${2}-install:
+ ${INSTALL_DIR} $$(IDIR_$(1))/usr/lib/python3.3/lib-dynload
+ for m in ${2}; do \
+ ${INSTALL_DATA} $(WRKINST)/usr/lib/python3.3/lib-dynload/$$$${m}*.so $$(IDIR_$(1))/usr/lib/python3.3/lib-dynload ;\
+ done
+endef
+
+
+$(eval $(call HOST_template,PYTHON3,python3,${PKG_VERSION}-${PKG_RELEASE}))
+$(eval $(call PKG_template,PYTHON3,python3,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+
+$(eval $(call PKG_template,PYTHON3_MOD_ZLIB,python3-mod-zlib,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_ZLIB},${PKGFD_MOD_ZLIB},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_BZ2,python3-mod-bz2,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_BZ2},${PKGFD_MOD_BZ2},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_EXPAT,python3-mod-expat,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_EXPAT},${PKGFD_MOD_EXPAT},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_SQLITE,python3-mod-sqlite,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_SQLITE},${PKGFD_MOD_SQLITE},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_GDBM,python3-mod-gdbm,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_GDBM},${PKGFD_MOD_GDBM},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_NCURSES,python3-mod-ncurses,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_NCURSES},${PKGFD_MOD_NCURSES},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_SSL,python3-mod-ssl,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_SSL},${PKGFD_MOD_SSL},${PKG_SECTION}))
+$(eval $(call PKG_template,PYTHON3_MOD_READLINE,python3-mod-readline,$(PKG_VERSION)-${PKG_RELEASE},${PKGFS_MOD_READLINE},${PKGFD_MOD_READLINE},${PKG_SECTION}))
+
+$(eval $(call PKG_mod_template,PYTHON3_MOD_ZLIB,zlib))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_BZ2,_bz2))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_EXPAT,pyexpat))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_SQLITE,_sqlite))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_GDBM,_gdbm))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_NCURSES,_curses))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_SSL,_ssl))
+$(eval $(call PKG_mod_template,PYTHON3_MOD_READLINE,readline))
+
+MAKE_ENV+= HOSTPGEN=$(STAGING_HOST_DIR)/usr/bin/pgen3
+CONFIGURE_ARGS:= --with-threads \
+ --with-system-ffi \
+ --with-system-expat \
+ --disable-ipv6 \
+ --without-cxx-main
+CONFIGURE_ENV+= ac_cv_have_long_long_format=yes \
+ ac_cv_file__dev_ptmx=yes \
+ ac_cv_file__dev_ptc=no
+
+HOST_CONFIGURE_ARGS+= --without-cxx-main \
+ --without-threads
+
+python3-hostinstall:
+ $(INSTALL_BIN) ${HOST_WRKINST}/usr/bin/python3 \
+ $(STAGING_HOST_DIR)/usr/bin
+ $(INSTALL_BIN) ${WRKBUILD}/Parser/pgen \
+ $(STAGING_HOST_DIR)/usr/bin/pgen3
+ $(CP) $(HOST_WRKINST)/usr/lib/python3.3 \
+ $(STAGING_HOST_DIR)/usr/lib
+ $(INSTALL_DIR) $(STAGING_HOST_DIR)/usr/include/python3.3m
+ ${CP} ${HOST_WRKINST}/usr/include/python3.3m/pyconfig.h \
+ $(STAGING_HOST_DIR)/usr/include/python3.3m
+
+python3-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m}
+ ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/bin ${IDIR_PYTHON3}/usr/lib
+ ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/lib/python3.3
+ ${INSTALL_DIR} ${IDIR_PYTHON3}/usr/include/python3.3m
+ ${INSTALL_BIN} ${WRKINST}/usr/bin/python3 ${IDIR_PYTHON3}/usr/bin
+ ${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON3}/usr/lib
+ ${CP} ${WRKINST}/usr/lib/python3.3/* ${IDIR_PYTHON3}/usr/lib/python3.3
+ ${CP} ${WRKINST}/usr/include/python3.3m/pyconfig.h \
+ ${IDIR_PYTHON3}/usr/include/python3.3m
+ find ${IDIR_PYTHON3} -name "\*.pyc" -o -name "*\.pyo" -exec rm {} \;
+ for i in zlib _bz2 _ncurses _ssl _gdbm _sqlite pyexpat readline; do \
+ rm ${IDIR_PYTHON3}/usr/lib/python3.3/lib-dynload/$${i}*so; \
+ done
+
+include ${TOPDIR}/mk/host-bottom.mk
+include ${TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/python3/patches/patch-Makefile_pre_in b/package/python3/patches/patch-Makefile_pre_in
new file mode 100644
index 000000000..894666d10
--- /dev/null
+++ b/package/python3/patches/patch-Makefile_pre_in
@@ -0,0 +1,41 @@
+--- Python-3.3.2.orig/Makefile.pre.in 2013-05-15 18:32:57.000000000 +0200
++++ Python-3.3.2/Makefile.pre.in 2013-10-26 09:45:42.000000000 +0200
+@@ -70,9 +70,9 @@ MAKESETUP= $(srcdir)/Modules/makese
+ OPT= @OPT@
+ BASECFLAGS= @BASECFLAGS@
+ BASECPPFLAGS= @BASECPPFLAGS@
+-CONFIGURE_CFLAGS= @CFLAGS@
+-CONFIGURE_CPPFLAGS= @CPPFLAGS@
+-CONFIGURE_LDFLAGS= @LDFLAGS@
++CONFIGURE_CFLAGS=
++CONFIGURE_CPPFLAGS=
++CONFIGURE_LDFLAGS=
+ # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
+ # command line to append to these values without stomping the pre-set
+ # values.
+@@ -249,6 +249,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
+ ##########################################################################
+ # Parser
+ PGEN= Parser/pgen$(EXE)
++HOSTPGEN?= ./Parser/pgen$(EXE)
+
+ PSRCS= \
+ Parser/acceler.c \
+@@ -493,7 +494,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
+ *) quiet="";; \
+ esac; \
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
++ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py build
+
+ # Build static library
+ # avoid long command lines, same as LIBRARY_OBJS
+@@ -669,7 +670,7 @@ $(IO_OBJS): $(IO_H)
+ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
+ @$(MKDIR_P) Include
+ $(MAKE) $(PGEN)
+- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
++ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
+ $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
+ $(MAKE) $(GRAMMAR_H)
+ touch $(GRAMMAR_C)
diff --git a/package/python3/patches/patch-Modules__io__iomodule_h b/package/python3/patches/patch-Modules__io__iomodule_h
new file mode 100644
index 000000000..64ac4ffaf
--- /dev/null
+++ b/package/python3/patches/patch-Modules__io__iomodule_h
@@ -0,0 +1,14 @@
+--- Python-3.1.1.orig/Modules/_io/_iomodule.h 2009-06-12 04:07:12.000000000 +0200
++++ Python-3.1.1/Modules/_io/_iomodule.h 2009-09-16 22:02:30.000000000 +0200
+@@ -99,7 +99,10 @@ typedef off_t Py_off_t;
+ # define PY_OFF_T_MAX LONG_MAX
+ # define PY_OFF_T_MIN LONG_MIN
+ #else
+-# error off_t does not match either size_t, long, or long long!
++# define PyLong_AsOff_t PyLong_AsSsize_t
++# define PyLong_FromOff_t PyLong_FromSsize_t
++# define PY_OFF_T_MAX PY_SSIZE_T_MAX
++# define PY_OFF_T_MIN PY_SSIZE_T_MIN
+ #endif
+
+ #endif
diff --git a/package/python3/patches/patch-configure b/package/python3/patches/patch-configure
new file mode 100644
index 000000000..12bdfbcc8
--- /dev/null
+++ b/package/python3/patches/patch-configure
@@ -0,0 +1,34 @@
+--- Python-3.3.2.orig/configure 2013-05-15 18:33:00.000000000 +0200
++++ Python-3.3.2/configure 2013-10-24 16:05:44.000000000 +0200
+@@ -6214,10 +6214,6 @@ then
+ if test "$CC" != 'g++' ; then
+ STRICT_PROTO="-Wstrict-prototypes"
+ fi
+- # For gcc 4.x we need to use -fwrapv so lets check if its supported
+- if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
+- WRAP="-fwrapv"
+- fi
+
+ # Clang also needs -fwrapv
+ case $CC in
+@@ -6225,20 +6221,6 @@ then
+ ;;
+ esac
+
+- case $ac_cv_prog_cc_g in
+- yes)
+- if test "$Py_DEBUG" = 'true' ; then
+- # Optimization messes up debuggers, so turn it off for
+- # debug builds.
+- OPT="-g -O0 -Wall $STRICT_PROTO"
+- else
+- OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
+- fi
+- ;;
+- *)
+- OPT="-O3 -Wall $STRICT_PROTO"
+- ;;
+- esac
+ case $ac_sys_system in
+ SCO_SV*) OPT="$OPT -m486 -DSCO5"
+ ;;
diff --git a/package/python3/patches/patch-setup_py b/package/python3/patches/patch-setup_py
new file mode 100644
index 000000000..6c42cc30d
--- /dev/null
+++ b/package/python3/patches/patch-setup_py
@@ -0,0 +1,146 @@
+--- Python-3.3.2.orig/setup.py 2013-05-15 18:33:00.000000000 +0200
++++ Python-3.3.2/setup.py 2013-10-27 13:54:34.000000000 +0100
+@@ -80,7 +80,7 @@ def find_file(filename, std_dirs, paths)
+ 'paths' is a list of additional locations to check; if the file is
+ found in one of them, the resulting list will contain the directory.
+ """
+- if host_platform == 'darwin':
++ if host_platform == 'darwin' and not cross_compiling:
+ # Honor the MacOSX SDK setting when one was specified.
+ # An SDK is a directory with the same structure as a real
+ # system, but with only header files and libraries.
+@@ -90,7 +90,7 @@ def find_file(filename, std_dirs, paths)
+ for dir in std_dirs:
+ f = os.path.join(dir, filename)
+
+- if host_platform == 'darwin' and is_macosx_sdk_path(dir):
++ if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
+ f = os.path.join(sysroot, dir[1:], filename)
+
+ if os.path.exists(f): return []
+@@ -99,7 +99,7 @@ def find_file(filename, std_dirs, paths)
+ for dir in paths:
+ f = os.path.join(dir, filename)
+
+- if host_platform == 'darwin' and is_macosx_sdk_path(dir):
++ if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
+ f = os.path.join(sysroot, dir[1:], filename)
+
+ if os.path.exists(f):
+@@ -113,7 +113,7 @@ def find_library_file(compiler, libname,
+ if result is None:
+ return None
+
+- if host_platform == 'darwin':
++ if host_platform == 'darwin' and not cross_compiling:
+ sysroot = macosx_sdk_root()
+
+ # Check whether the found file is in one of the standard directories
+@@ -122,7 +122,7 @@ def find_library_file(compiler, libname,
+ # Ensure path doesn't end with path separator
+ p = p.rstrip(os.sep)
+
+- if host_platform == 'darwin' and is_macosx_sdk_path(p):
++ if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
+ if os.path.join(sysroot, p[1:]) == dirname:
+ return [ ]
+
+@@ -135,7 +135,7 @@ def find_library_file(compiler, libname,
+ # Ensure path doesn't end with path separator
+ p = p.rstrip(os.sep)
+
+- if host_platform == 'darwin' and is_macosx_sdk_path(p):
++ if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
+ if os.path.join(sysroot, p[1:]) == dirname:
+ return [ p ]
+
+@@ -168,6 +168,7 @@ class PyBuildExt(build_ext):
+
+ def build_extensions(self):
+
++ self.compiler.library_dirs = []
+ # Detect which modules should be compiled
+ missing = self.detect_modules()
+
+@@ -444,7 +445,8 @@ class PyBuildExt(build_ext):
+ # only change this for cross builds for 3.3, issues on Mageia
+ if cross_compiling:
+ self.add_gcc_paths()
+- self.add_multiarch_paths()
++ if not cross_compiling:
++ self.add_multiarch_paths()
+
+ # Add paths specified in the environment variables LDFLAGS and
+ # CPPFLAGS for header and library files.
+@@ -481,7 +483,8 @@ class PyBuildExt(build_ext):
+ add_dir_to_list(dir_list, directory)
+
+ if os.path.normpath(sys.base_prefix) != '/usr' \
+- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
++ and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
++ and not cross_compiling:
+ # 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
+@@ -494,6 +497,9 @@ 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.
++ if cross_compiling:
++ add_dir_to_list(self.compiler.library_dirs,
++ sysconfig.get_config_var('srcdir'))
+ if not cross_compiling:
+ lib_dirs = self.compiler.library_dirs + [
+ '/lib64', '/usr/lib64',
+@@ -520,23 +526,26 @@ class PyBuildExt(build_ext):
+ if host_platform == 'hp-ux11':
+ lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
+
+- if host_platform == 'darwin':
+- # This should work on any unixy platform ;-)
+- # If the user has bothered specifying additional -I and -L flags
+- # in OPT and LDFLAGS we might as well use them here.
+- #
+- # NOTE: using shlex.split would technically be more correct, but
+- # also gives a bootstrap problem. Let's hope nobody uses
+- # directories with whitespace in the name to store libraries.
+- cflags, ldflags = sysconfig.get_config_vars(
+- 'CFLAGS', 'LDFLAGS')
+- for item in cflags.split():
+- if item.startswith('-I'):
+- inc_dirs.append(item[2:])
++ # This should work on any unixy platform ;-)
++ # If the user has bothered specifying additional -I and -L flags
++ # in OPT and LDFLAGS we might as well use them here.
++ #
++ # NOTE: using shlex.split would technically be more correct, but
++ # also gives a bootstrap problem. Let's hope nobody uses
++ # directories with whitespace in the name to store libraries.
++ cppflags, cflags, ldflags = sysconfig.get_config_vars(
++ 'CPPFLAGS', 'CFLAGS', 'LDFLAGS')
++ for item in cppflags.split():
++ if item.startswith('-I'):
++ inc_dirs.append(item[2:])
+
+- for item in ldflags.split():
+- if item.startswith('-L'):
+- lib_dirs.append(item[2:])
++ for item in cflags.split():
++ if item.startswith('-I'):
++ inc_dirs.append(item[2:])
++
++ for item in ldflags.split():
++ if item.startswith('-L'):
++ lib_dirs.append(item[2:])
+
+ # Check for MacOS X, which doesn't need libm.a at all
+ math_libs = ['m']
+@@ -1355,7 +1364,7 @@ class PyBuildExt(build_ext):
+
+ # Gustavo Niemeyer's bz2 module.
+ if (self.compiler.find_library_file(lib_dirs, 'bz2')):
+- if host_platform == "darwin":
++ if host_platform == "darwin" and not cross_compiling:
+ bz2_extra_link_args = ('-Wl,-search_paths_first',)
+ else:
+ bz2_extra_link_args = ()