mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Python: clean up. config/Makefile and pyconfig are not needed anymore
- and really use our :host python to build target - TODO fix target sysconfigdata with hostpython to make distutils happy
This commit is contained in:
parent
81c08d1519
commit
d4072be760
@ -84,12 +84,15 @@ makeinstall_host() {
|
|||||||
cp Parser/pgen $ROOT/$TOOLCHAIN/bin
|
cp Parser/pgen $ROOT/$TOOLCHAIN/bin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre_configure_target() {
|
||||||
|
export PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python
|
||||||
|
export BLDSHARED="$CC -shared"
|
||||||
|
export RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
make_target() {
|
make_target() {
|
||||||
make -j1 CC="$TARGET_CC" \
|
make -j1 CC="$TARGET_CC" \
|
||||||
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
|
|
||||||
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
||||||
BLDSHARED="$CC -shared" \
|
|
||||||
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
|
|
||||||
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
||||||
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
||||||
PYTHON_MODULES_LIB="$TARGET_LIBDIR"
|
PYTHON_MODULES_LIB="$TARGET_LIBDIR"
|
||||||
@ -98,10 +101,7 @@ make_target() {
|
|||||||
makeinstall_target() {
|
makeinstall_target() {
|
||||||
make -j1 CC="$TARGET_CC" \
|
make -j1 CC="$TARGET_CC" \
|
||||||
DESTDIR=$SYSROOT_PREFIX \
|
DESTDIR=$SYSROOT_PREFIX \
|
||||||
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
|
|
||||||
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
||||||
BLDSHARED="$CC -shared" \
|
|
||||||
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
|
|
||||||
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
||||||
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
||||||
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
|
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
|
||||||
@ -113,10 +113,7 @@ makeinstall_target() {
|
|||||||
|
|
||||||
make -j1 CC="$TARGET_CC" \
|
make -j1 CC="$TARGET_CC" \
|
||||||
DESTDIR=$INSTALL \
|
DESTDIR=$INSTALL \
|
||||||
PYTHON_FOR_BUILD=$ROOT/$TOOLCHAIN/bin/python \
|
|
||||||
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
HOSTPGEN=$ROOT/$TOOLCHAIN/bin/pgen \
|
||||||
BLDSHARED="$CC -shared" \
|
|
||||||
RUNSHARED="LD_LIBRARY_PATH=$ROOT/$TOOLCHAIN/lib:$LD_LIBRARY_PATH" \
|
|
||||||
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
PYTHON_DISABLE_MODULES="$PY_DISABLED_MODULES" \
|
||||||
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
PYTHON_MODULES_INCLUDE="$TARGET_INCDIR" \
|
||||||
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
|
PYTHON_MODULES_LIB="$TARGET_LIBDIR" \
|
||||||
@ -129,15 +126,14 @@ post_makeinstall_target() {
|
|||||||
rm -rf $INSTALL/usr/lib/python*/$dir
|
rm -rf $INSTALL/usr/lib/python*/$dir
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# config/Makefile / pyconfig.h / sysconfig module nonsense at runtime
|
||||||
|
rm -rf $INSTALL/usr/lib/python*/config
|
||||||
|
rm -rf $INSTALL/usr/lib/python*/*sysconfig*.pyo
|
||||||
|
# TODO: fix _syscondigdata.py for cross builds
|
||||||
|
|
||||||
python -Wi -t -B ../Lib/compileall.py $INSTALL/usr/lib/python*/ -f
|
python -Wi -t -B ../Lib/compileall.py $INSTALL/usr/lib/python*/ -f
|
||||||
rm -rf `find $INSTALL/usr/lib/python*/ -name "*.py"`
|
rm -rf `find $INSTALL/usr/lib/python*/ -name "*.py"`
|
||||||
|
|
||||||
rm -rf $INSTALL/usr/lib/python*/config/Setup*
|
|
||||||
rm -rf $INSTALL/usr/lib/python*/config/config.*
|
|
||||||
rm -rf $INSTALL/usr/lib/python*/config/install-sh
|
|
||||||
rm -rf $INSTALL/usr/lib/python*/config/makesetup
|
|
||||||
rm -rf $INSTALL/usr/lib/python*/config/python.o
|
|
||||||
|
|
||||||
# TODO remove ?
|
# TODO remove ?
|
||||||
if [ ! -f $INSTALL/usr/lib/python*/lib-dynload/_socket.so ]; then
|
if [ ! -f $INSTALL/usr/lib/python*/lib-dynload/_socket.so ]; then
|
||||||
echo "sometimes Python dont build '_socket.so' for some reasons and continues without failing,"
|
echo "sometimes Python dont build '_socket.so' for some reasons and continues without failing,"
|
||||||
|
@ -1,76 +0,0 @@
|
|||||||
Change the location of pyconfig.h
|
|
||||||
|
|
||||||
The Python interpreter has a really strange behaviour: at *runtime*,
|
|
||||||
it reads a Makefile and a header file named pyconfig.h to get some
|
|
||||||
information about the configuration.
|
|
||||||
|
|
||||||
The Makefile is located in usr/lib/python2.7/config, which is fine
|
|
||||||
since this location is kept on the target.
|
|
||||||
|
|
||||||
However, by default, the pyconfig.h is installed in
|
|
||||||
usr/include/python2.7, but we completely remove the usr/include
|
|
||||||
directory for the target. Since making an exception just for
|
|
||||||
pyconfig.h is annoying, this patch also installs pyconfig.h to
|
|
||||||
usr/lib/python2.7/config, and modifies the sysconfig module so that it
|
|
||||||
looks in this location instead of usr/include.
|
|
||||||
|
|
||||||
The pyconfig.h is still kept in usr/include/python2.7, because it is
|
|
||||||
needed in the $(STAGING_DIR) when building third-party Python
|
|
||||||
extensions that contain C code.
|
|
||||||
|
|
||||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
||||||
|
|
||||||
---
|
|
||||||
Lib/distutils/sysconfig.py | 3 ++-
|
|
||||||
Lib/sysconfig.py | 2 +-
|
|
||||||
Makefile.pre.in | 3 ++-
|
|
||||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
Index: Python-2.7.1/Lib/distutils/sysconfig.py
|
|
||||||
===================================================================
|
|
||||||
--- Python-2.7.1.orig/Lib/distutils/sysconfig.py
|
|
||||||
+++ Python-2.7.1/Lib/distutils/sysconfig.py
|
|
||||||
@@ -193,7 +193,8 @@
|
|
||||||
else:
|
|
||||||
inc_dir = project_base
|
|
||||||
else:
|
|
||||||
- inc_dir = get_python_inc(plat_specific=1)
|
|
||||||
+ lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
|
|
||||||
+ inc_dir = os.path.join(lib_dir, "config")
|
|
||||||
if get_python_version() < '2.2':
|
|
||||||
config_h = 'config.h'
|
|
||||||
else:
|
|
||||||
Index: Python-2.7.1/Lib/sysconfig.py
|
|
||||||
===================================================================
|
|
||||||
--- Python-2.7.1.orig/Lib/sysconfig.py
|
|
||||||
+++ Python-2.7.1/Lib/sysconfig.py
|
|
||||||
@@ -371,7 +371,7 @@
|
|
||||||
else:
|
|
||||||
inc_dir = _PROJECT_BASE
|
|
||||||
else:
|
|
||||||
- inc_dir = get_path('platinclude')
|
|
||||||
+ inc_dir = os.path.join(get_path('stdlib'), "config")
|
|
||||||
return os.path.join(inc_dir, 'pyconfig.h')
|
|
||||||
|
|
||||||
def get_scheme_names():
|
|
||||||
Index: Python-2.7.1/Makefile.pre.in
|
|
||||||
===================================================================
|
|
||||||
--- Python-2.7.1.orig/Makefile.pre.in
|
|
||||||
+++ Python-2.7.1/Makefile.pre.in
|
|
||||||
@@ -967,7 +967,6 @@
|
|
||||||
echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
|
|
||||||
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
|
|
||||||
done
|
|
||||||
- $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
|
|
||||||
|
|
||||||
# Install the library and miscellaneous stuff needed for extending/embedding
|
|
||||||
# This goes into $(exec_prefix)
|
|
||||||
@@ -1001,6 +1000,8 @@
|
|
||||||
$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
|
|
||||||
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
|
|
||||||
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
|
|
||||||
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(LIBPL)/pyconfig.h
|
|
||||||
+ $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
|
|
||||||
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
|
|
||||||
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
|
|
||||||
$(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
|
|
Loading…
x
Reference in New Issue
Block a user