@ -6,6 +6,7 @@
#
#
# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
python3_mk_path := $( dir $( lastword $( MAKEFILE_LIST) ) )
python3_mk_path := $( dir $( lastword $( MAKEFILE_LIST) ) )
i n c l u d e $( python 3_mk_path ) p y t h o n 3 - h o s t . m k
i n c l u d e $( python 3_mk_path ) p y t h o n 3 - h o s t . m k
@ -34,10 +35,52 @@ ifdef CONFIG_USE_MIPS16
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
e n d i f
e n d i f
PYTHON3_VARS = \
CC = " $( TARGET_CC) " \
CCSHARED = " $( TARGET_CC) $( FPIC) " \
CXX = " $( TARGET_CXX) " \
LD = " $( TARGET_CC) " \
LDSHARED = " $( TARGET_CC) -shared " \
CFLAGS = " $( TARGET_CFLAGS) " \
CPPFLAGS = " $( TARGET_CPPFLAGS) -I $( PYTHON3_INC_DIR) " \
LDFLAGS = " $( TARGET_LDFLAGS) -lpython $( PYTHON3_VERSION) " \
_PYTHON_HOST_PLATFORM = linux2 \
__PYVENV_LAUNCHER__ = " /usr/bin/ $( PYTHON3) " \
PYTHONPATH = " $( PYTHON3PATH) " \
PYTHONDONTWRITEBYTECODE = 1 \
PYTHONOPTIMIZE = "" \
_python_sysroot = " $( STAGING_DIR) " \
_python_prefix = "/usr" \
_python_exec_prefix = "/usr"
# $(1) => directory of python script
# $(2) => python script and its arguments
# $(3) => additional variables
d e f i n e P y t h o n 3 / R u n
cd " $( if $( strip $( 1) ) ,$( strip $( 1) ) ,.) " && \
$( PYTHON3_VARS) \
$( 3) \
$( HOST_PYTHON3_BIN) $( 2)
e n d e f
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
d e f i n e P y t h o n 3 / M o d S e t u p
$( INSTALL_DIR) $( PKG_INSTALL_DIR) /$( PYTHON3_PKG_DIR)
$( call Python3/Run, \
$( PKG_BUILD_DIR) /$( strip $( 1) ) , \
setup.py $( 2) , \
$( 3) )
e n d e f
d e f i n e P y t h o n 3 / F i x S h e b a n g
d e f i n e P y t h o n 3 / F i x S h e b a n g
$( SED ) "1" '!' "b;s,^#" '!' ".*python.*,#" '!' "/usr/bin/python3," - i - - f o l l o w - s y m l i n k s $( 1)
$( SED ) "1" '!' "b;s,^#" '!' ".*python.*,#" '!' "/usr/bin/python3," - i - - f o l l o w - s y m l i n k s $( 1)
e n d e f
e n d e f
# Py3Package
d e f i n e P y 3 P a c k a g e
d e f i n e P y 3 P a c k a g e
define Package/$( 1) -src
define Package/$( 1) -src
@ -96,44 +139,8 @@ define Py3Package
endif # Package/$(1)/install
endif # Package/$(1)/install
e n d e f
e n d e f
PYTHON3_VARS = \
CC = " $( TARGET_CC) " \
CCSHARED = " $( TARGET_CC) $( FPIC) " \
CXX = " $( TARGET_CXX) " \
LD = " $( TARGET_CC) " \
LDSHARED = " $( TARGET_CC) -shared " \
CFLAGS = " $( TARGET_CFLAGS) " \
CPPFLAGS = " $( TARGET_CPPFLAGS) -I $( PYTHON3_INC_DIR) " \
LDFLAGS = " $( TARGET_LDFLAGS) -lpython $( PYTHON3_VERSION) " \
_PYTHON_HOST_PLATFORM = linux2 \
__PYVENV_LAUNCHER__ = " /usr/bin/ $( PYTHON3) " \
PYTHONPATH = " $( PYTHON3PATH) " \
PYTHONDONTWRITEBYTECODE = 1 \
PYTHONOPTIMIZE = "" \
_python_sysroot = " $( STAGING_DIR) " \
_python_prefix = "/usr" \
_python_exec_prefix = "/usr"
# $(1) => directory of python script
# $(2) => python script and its arguments
# $(3) => additional variables
d e f i n e P y t h o n 3 / R u n
cd " $( if $( strip $( 1) ) ,$( strip $( 1) ) ,.) " && \
$( PYTHON3_VARS) \
$( 3) \
$( HOST_PYTHON3_BIN) $( 2)
e n d e f
# $(1) => build subdir
# $(2) => additional arguments to setup.py
# $(3) => additional variables
d e f i n e P y t h o n 3 / M o d S e t u p
$( INSTALL_DIR) $( PKG_INSTALL_DIR) /$( PYTHON3_PKG_DIR)
$( call Python3/Run, \
$( PKG_BUILD_DIR) /$( strip $( 1) ) , \
setup.py $( 2) , \
$( 3) )
e n d e f
# Py3Build
PYTHON3_PKG_SETUP_DIR ?=
PYTHON3_PKG_SETUP_DIR ?=
PYTHON3_PKG_SETUP_GLOBAL_ARGS ?=
PYTHON3_PKG_SETUP_GLOBAL_ARGS ?=