summaryrefslogtreecommitdiff
path: root/package/python2
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-12-14 20:36:15 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2010-12-14 20:36:15 +0100
commit540ca543451de3afe658b09bfb85e54344d34f45 (patch)
treedda34db5e3669a3ffbaf959162229d630e88bbae /package/python2
parent44e2a7e9a5c820b56c46b371c00a10ae165d07bc (diff)
fix python-config to use target include dir
Diffstat (limited to 'package/python2')
-rw-r--r--package/python2/Makefile9
-rw-r--r--package/python2/files/python-config.in57
-rw-r--r--package/python2/patches/patch-Makefile_pre_in45
3 files changed, 85 insertions, 26 deletions
diff --git a/package/python2/Makefile b/package/python2/Makefile
index 3f24b5b5d..9785db316 100644
--- a/package/python2/Makefile
+++ b/package/python2/Makefile
@@ -4,9 +4,9 @@
include ${TOPDIR}/rules.mk
PKG_NAME:= python2
-PKG_VERSION:= 2.7
-PKG_RELEASE:= 5
-PKG_MD5SUM:= 35f56b092ecf39a6bd59d64f142aae0f
+PKG_VERSION:= 2.7.1
+PKG_RELEASE:= 1
+PKG_MD5SUM:= 15ed56733655e3fab785e49a7278d2fb
PKG_DESCR:= Python scripting language (Version 2)
PKG_SECTION:= lang
PKG_DEPENDS:= libpthread zlib libffi
@@ -35,6 +35,7 @@ CONFIGURE_ARGS:= --with-threads \
--without-cxx-main
post-extract:
+ $(CP) ./files/python-config.in ${WRKBUILD}/Misc/python-config.in
(cd ${WRKBUILD}; rm -rf config.{cache,status} ; \
OPT="$(HOSTCFLAGS)" \
./configure --without-cxx-main --without-threads \
@@ -59,6 +60,6 @@ post-install:
${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON2}/usr/lib
${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 \*.pyo -exec rm {} \;
+ -find ${IDIR_PYTHON2} -name "\*.pyc" -o -name "*\.pyo" -exec rm {} \;
include ${TOPDIR}/mk/pkg-bottom.mk
diff --git a/package/python2/files/python-config.in b/package/python2/files/python-config.in
new file mode 100644
index 000000000..8419bd84a
--- /dev/null
+++ b/package/python2/files/python-config.in
@@ -0,0 +1,57 @@
+#!@EXENAME@
+
+import sys
+import os
+import getopt
+import re
+from distutils import sysconfig
+
+valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
+ 'ldflags', 'help']
+
+def exit_with_usage(code=1):
+ print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0],
+ '|'.join('--'+opt for opt in valid_opts))
+ sys.exit(code)
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
+except getopt.error:
+ exit_with_usage()
+
+if not opts:
+ exit_with_usage()
+
+pyver = sysconfig.get_config_var('VERSION')
+getvar = sysconfig.get_config_var
+
+opt_flags = [flag for (flag, val) in opts]
+
+if '--help' in opt_flags:
+ exit_with_usage(code=0)
+
+for opt in opt_flags:
+ if opt == '--prefix':
+ print sysconfig.PREFIX
+
+ elif opt == '--exec-prefix':
+ print sysconfig.EXEC_PREFIX
+
+ elif opt in ('--includes', '--cflags'):
+ flags = ['-I' + re.sub('host/', 'target/usr/', sysconfig.get_python_inc()),
+ '-I' + re.sub('host/', 'target/usr/', sysconfig.get_python_inc(plat_specific=True))]
+ if opt == '--cflags':
+ flags.extend(getvar('CFLAGS').split())
+ print ' '.join(flags)
+
+ elif opt in ('--libs', '--ldflags'):
+ libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+ libs.append('-lpython'+pyver)
+ # add the prefix/lib/pythonX.Y/config dir, but only if there is no
+ # shared library in prefix/lib/.
+ if opt == '--ldflags':
+ if not getvar('Py_ENABLE_SHARED'):
+ libs.insert(0, '-L' + getvar('LIBPL'))
+ libs.extend(getvar('LINKFORSHARED').split())
+ print ' '.join(libs)
+
diff --git a/package/python2/patches/patch-Makefile_pre_in b/package/python2/patches/patch-Makefile_pre_in
index de21cdef0..4cbd61e8c 100644
--- a/package/python2/patches/patch-Makefile_pre_in
+++ b/package/python2/patches/patch-Makefile_pre_in
@@ -1,6 +1,7 @@
---- Python-2.7.orig/Makefile.pre.in 2010-04-12 02:10:46.000000000 +0200
-+++ Python-2.7/Makefile.pre.in 2010-09-25 21:11:15.584089025 +0200
-@@ -179,6 +179,7 @@ UNICODE_OBJS= @UNICODE_OBJS@
+diff -Nur Python-2.7.1.orig/Makefile.pre.in Python-2.7.1/Makefile.pre.in
+--- Python-2.7.1.orig/Makefile.pre.in 2010-10-14 13:37:30.000000000 +0200
++++ Python-2.7.1/Makefile.pre.in 2010-12-14 16:02:44.000000000 +0100
+@@ -179,6 +179,7 @@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
@@ -8,7 +9,7 @@
# The task to run while instrument when building the profile-opt target
PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
-@@ -211,6 +212,7 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
+@@ -211,6 +212,7 @@
##########################################################################
# Parser
PGEN= Parser/pgen$(EXE)
@@ -16,7 +17,7 @@
POBJS= \
Parser/acceler.o \
-@@ -380,7 +382,7 @@ build_all_generate_profile:
+@@ -380,7 +382,7 @@
$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
run_profile_task:
@@ -25,7 +26,7 @@
build_all_use_profile:
$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
-@@ -398,14 +400,14 @@ $(BUILDPYTHON): Modules/python.o $(LIBRA
+@@ -398,14 +400,14 @@
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
platform: $(BUILDPYTHON)
@@ -36,14 +37,14 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
-- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
-- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
-+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
-+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
+- *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*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
++ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
-@@ -538,7 +540,7 @@ Modules/python.o: $(srcdir)/Modules/pyth
+@@ -538,7 +540,7 @@
$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
-@$(INSTALL) -d Include
@@ -52,16 +53,16 @@
$(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
-@@ -702,7 +704,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/pytho
+@@ -702,7 +704,7 @@
TESTOPTS= -l $(EXTRATESTOPTS)
TESTPROG= $(srcdir)/Lib/test/regrtest.py
--TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt
-+TESTPYTHON= $(RUNSHARED) $(HOSTPYTHON) -Wd -3 -E -tt
+-TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
++TESTPYTHON= $(RUNSHARED) $(HOSTPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
test: all platform
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
-@@ -725,7 +727,7 @@ testuniversal: all platform
+@@ -725,7 +727,7 @@
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
-$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
$(TESTPYTHON) $(TESTPROG) -uall $(TESTOPTS)
@@ -70,7 +71,7 @@
# Like testall, but with a single pass only
-@@ -919,26 +921,26 @@ libinstall: build_all $(srcdir)/Lib/$(PL
+@@ -920,26 +922,26 @@
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
@@ -104,17 +105,17 @@
# Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR):
-@@ -1043,7 +1045,8 @@ libainstall: all python-config
+@@ -1044,7 +1046,8 @@
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
- sharedinstall:
+ sharedinstall: sharedmods
- $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
+ CROSS_COMPILE='$(CROSS_COMPILE)' \
+ $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
-@@ -1081,7 +1084,7 @@ frameworkinstallstructure: $(LDLIBRARY)
+@@ -1082,7 +1085,7 @@
fi; \
done
$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
@@ -123,7 +124,7 @@
$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
-@@ -1116,7 +1119,7 @@ frameworkinstallextras:
+@@ -1117,7 +1120,7 @@
# This installs a few of the useful scripts in Tools/scripts
scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \
@@ -132,7 +133,7 @@
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--root=/$(DESTDIR)
-@@ -1138,7 +1141,7 @@ config.status: $(srcdir)/configure
+@@ -1139,7 +1142,7 @@
# Run reindent on the library
reindent:
@@ -141,7 +142,7 @@
# Rerun configure with the same options as it was run last time,
# provided the config.status script exists
-@@ -1238,7 +1241,7 @@ funny:
+@@ -1242,7 +1245,7 @@
# Perform some verification checks on any modified files.
patchcheck: