@ -5,12 +5,6 @@
# See /LICENSE for more information.
#
# Compatibility fallback for older OpenWrt and LEDE versions
i f e q ( $( STAGING_DIR_HOSTPKG ) , )
$( warning STAGING_DIR_HOSTPKG is unset - falling back to $$ ( STAGING_DIR) /host)
STAGING_DIR_HOSTPKG := $( STAGING_DIR) /host
e n d i f
$( call include_mk , python 3-version .mk )
PYTHON3_DIR := $( STAGING_DIR) /usr
@ -22,22 +16,7 @@ PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
PYTHON3 := python$( PYTHON3_VERSION)
HOST_PYTHON3_DIR := $( STAGING_DIR_HOSTPKG)
HOST_PYTHON3_LIB_DIR := $( HOST_PYTHON3_DIR) /lib/python$( PYTHON3_VERSION)
HOST_PYTHON3_BIN := $( HOST_PYTHON3_DIR) /bin/python3
PYTHON3PATH := $( PYTHON3_LIB_DIR) :$( STAGING_DIR) /$( PYTHON3_PKG_DIR) :$( PKG_INSTALL_DIR) /$( PYTHON3_PKG_DIR)
d e f i n e H o s t P y t h o n 3
( export PYTHONPATH = " $( PYTHON3PATH) " ; \
export PYTHONOPTIMIZE = "" ; \
export PYTHONDONTWRITEBYTECODE = 1; \
export _python_sysroot = " $( STAGING_DIR) " ; \
export _python_prefix = "/usr" ; \
export _python_exec_prefix = "/usr" ; \
$( 1) \
$( HOST_PYTHON3_BIN) $( 2) ; \
)
e n d e f
# These configure args are needed in detection of path to Python header files
# using autotools.
@ -62,6 +41,15 @@ define Py3Package
endef
endif
ifndef Py3Package/$( 1) /install
define Py3Package/$( 1) /install
if [ -d $( PKG_INSTALL_DIR) /usr/bin ] ; then \
$( INSTALL_DIR) $$ ( 1) /usr/bin \
$( CP) $( PKG_INSTALL_DIR) /usr/bin/* $$ ( 1) /usr/bin/
fi
endef
endif
$( call shexport,Py3Package/$( 1) /filespec)
define Package/$( 1) /install
@ -100,15 +88,17 @@ define Py3Package
endef
e n d e f
# $(1) => build subdir
# $(2) => additional arguments to setup.py
$( call include_mk , python 3-host .mk )
# $(1) => commands to execute before running pythons script
# $(2) => python script and its arguments
# $(3) => additional variables
d e f i n e B u i l d / C o m p i l e / P y 3 M o d
$( INSTALL_DIR) $( PKG_INSTALL_DIR) /$( PYTHON3_PKG_DIR)
d e f i n e B u i l d / C o m p i l e / H o s t P y 3 R u n T a r g e t
$( call HostPython3, \
cd $( PKG_BUILD_DIR) /$( strip $( 1) ) ; \
$( if $( 1) ,$( 1) ; ) \
CC = " $( TARGET_CC) " \
CCSHARED = " $( TARGET_CC) $( FPIC) " \
CXX = " $( TARGET_CXX) " \
LD = " $( TARGET_CC) " \
LDSHARED = " $( TARGET_CC) -shared " \
CFLAGS = " $( TARGET_CFLAGS) " \
@ -118,8 +108,31 @@ define Build/Compile/Py3Mod
__PYVENV_LAUNCHER__ = " /usr/bin/ $( PYTHON3) " \
$( 3) \
, \
./setup.py $( 2) \
$( 2) \
)
e n d e f
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
d e f i n e B u i l d / C o m p i l e / P y 3 M o d
$( INSTALL_DIR) $( PKG_INSTALL_DIR) /$( PYTHON3_PKG_DIR)
$( call Build/Compile/HostPy3RunTarget, \
cd $( PKG_BUILD_DIR) /$( strip $( 1) ) , \
./setup.py $( 2) , \
$( 3) )
find $( PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f
e n d e f
d e f i n e P y 3 B u i l d / C o m p i l e / D e f a u l t
$( call Build/Compile/Py3Mod,, \
install --prefix= "/usr" --root= " $( PKG_INSTALL_DIR) " \
--single-version-externally-managed \
)
e n d e f
i f e q ( $( BUILD_VARIANT ) , p y t h o n 3 )
d e f i n e B u i l d / C o m p i l e
$( call Py3Build/Compile/Default)
e n d e f
e n d i f # python3