Browse Source

Merge pull request #3464 from commodo/python-include-host-vars

python,python3: cleanup HOST vars and disable pip on host python3
lilik-openwrt-22.03
Hannu Nyman 8 years ago
committed by GitHub
parent
commit
6f1ad74176
6 changed files with 51 additions and 41 deletions
  1. +18
    -18
      lang/python/Makefile
  2. +9
    -2
      lang/python/files/python-host.mk
  3. +1
    -2
      lang/python/files/python-package.mk
  4. +10
    -0
      lang/python/files/python-version.mk
  5. +10
    -17
      lang/python3/Makefile
  6. +3
    -2
      lang/python3/files/python3-package.mk

+ 18
- 18
lang/python/Makefile View File

@ -7,7 +7,13 @@
include $(TOPDIR)/rules.mk
# The file included below defines PYTHON_VERSION
# For PYTHON_VERSION
include ./files/python-version.mk
# This file provides the necsessary host build variables
include ./files/python-host.mk
# For PyPackage
include ./files/python-package.mk
PKG_NAME:=python
@ -139,18 +145,19 @@ define Build/InstallDev
$(INSTALL_DATA) \
./files/python-package.mk \
./files/python-host.mk \
./files/python-version.mk \
$(STAGING_DIR)/mk/
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
$(1)/usr/include/
$(CP) \
$(HOST_BUILD_PREFIX)/lib/python$(PYTHON_VERSION) \
$(HOST_PYTHON_LIB_DIR) \
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
$(1)/usr/lib/
$(CP) \
$(HOST_BUILD_PREFIX)/lib/pkgconfig/python.pc \
$(HOST_BUILD_PREFIX)/lib/pkgconfig/python2.pc \
$(HOST_BUILD_PREFIX)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
$(HOST_PYTHON_DIR)/lib/pkgconfig/python.pc \
$(HOST_PYTHON_DIR)/lib/pkgconfig/python2.pc \
$(HOST_PYTHON_DIR)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
$(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
@ -213,28 +220,21 @@ define PyPackage/python/filespec
-|$(PYTHON_PKG_DIR)
endef
HOST_CFLAGS+= \
-I/usr/include/ncursesw \
-I/usr/include/ncurses
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-pymalloc \
--with-threads \
--prefix=$(HOST_BUILD_PREFIX) \
--exec-prefix=$(HOST_BUILD_PREFIX) \
--sysconfdir=$(HOST_BUILD_PREFIX)/etc \
--localstatedir=$(HOST_BUILD_PREFIX)/var \
--sbindir=$(HOST_BUILD_PREFIX)/bin \
--with-system-expat=$(HOST_BUILD_PREFIX) \
--with-system-ffi=$(HOST_BUILD_PREFIX) \
--prefix=$(HOST_PYTHON_DIR) \
--exec-prefix=$(HOST_PYTHON_DIR) \
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
--with-system-ffi=$(STAGING_DIR_HOSTPKG) \
CONFIG_SITE= \
CFLAGS="$(HOST_CFLAGS)"
define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_BUILD_PREFIX)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_BUILD_PREFIX)/bin/pgen2
$(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
endef
$(eval $(call HostBuild))


+ 9
- 2
lang/python/files/python-host.mk View File

@ -5,6 +5,12 @@
# See /LICENSE for more information.
#
ifneq ($(__python_host_mk_inc),1)
__python_host_mk_inc=1
# For PYTHON_VERSION
$(call include_mk, python-version.mk)
# Compatibility fallback for older OpenWrt and LEDE versions
ifeq ($(STAGING_DIR_HOSTPKG),)
$(warning STAGING_DIR_HOSTPKG is unset - falling back to $$(STAGING_DIR)/host)
@ -15,11 +21,11 @@ HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
HOST_PYTHON_PKG_DIR:=/lib/python$(PYTHON_VERSION)/site-packages
HOST_PYTHON_PKG_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)/site-packages
HOST_PYTHON_BIN:=$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)
HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(STAGING_DIR_HOSTPKG)/$(HOST_PYTHON_PKG_DIR)
HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(HOST_PYTHON_PKG_DIR)
define HostPython
if [ "$(strip $(3))" == "HOST" ]; then \
@ -71,3 +77,4 @@ define Build/Compile/HostPyMod
$(3))
endef
endif # __python_host_mk_inc

+ 1
- 2
lang/python/files/python-package.mk View File

@ -5,8 +5,7 @@
# See /LICENSE for more information.
#
PYTHON_VERSION:=2.7
PYTHON_VERSION_MICRO:=12
$(call include_mk, python-version.mk)
PYTHON_DIR:=$(STAGING_DIR)/usr
PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin


+ 10
- 0
lang/python/files/python-version.mk View File

@ -0,0 +1,10 @@
#
# Copyright (C) 2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PYTHON_VERSION:=2.7
PYTHON_VERSION_MICRO:=12

+ 10
- 17
lang/python3/Makefile View File

@ -127,7 +127,7 @@ CONFIGURE_ARGS+= \
--with-threads \
--with-system-ffi="$(STAGING_DIR)/usr" \
--without-pymalloc \
--without-ensurepip \
--with-ensurepip=no \
$(ENABLE_IPV6) \
CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
OPT="$(TARGET_CFLAGS)"
@ -146,7 +146,7 @@ define Build/InstallDev
$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
$(1)/usr/include/
$(CP) \
$(HOST_BUILD_PREFIX)/lib/python$(PYTHON_VERSION) \
$(HOST_PYTHON3_LIB_DIR) \
$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
$(1)/usr/lib/
$(CP) \
@ -208,22 +208,15 @@ define Py3Package/python3/filespec
-|$(PYTHON3_PKG_DIR)
endef
HOST_CFLAGS+= \
-I/usr/include/ncursesw \
-I/usr/include/ncurses
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-pymalloc \
--with-threads \
--prefix=$(HOST_BUILD_PREFIX) \
--exec-prefix=$(HOST_BUILD_PREFIX) \
--sysconfdir=$(HOST_BUILD_PREFIX)/etc \
--localstatedir=$(HOST_BUILD_PREFIX)/var \
--sbindir=$(HOST_BUILD_PREFIX)/bin \
--with-system-expat=$(HOST_BUILD_PREFIX) \
--with-system-ffi=$(HOST_BUILD_PREFIX) \
--with-ensurepip=upgrade \
--prefix=$(HOST_PYTHON3_DIR) \
--exec-prefix=$(HOST_PYTHON3_DIR) \
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
--with-system-ffi=$(STAGING_DIR_HOSTPKG) \
--with-ensurepip=no \
CONFIG_SITE= \
CFLAGS="$(HOST_CFLAGS)"
@ -235,9 +228,9 @@ endef
define Host/Install
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_BUILD_PREFIX)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_BUILD_PREFIX)/bin/pgen3
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Programs/_freeze_importlib $(HOST_BUILD_PREFIX)/bin/_freeze_importlib
$(INSTALL_DIR) $(HOST_PYTHON3_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON3_DIR)/bin/pgen3
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Programs/_freeze_importlib $(HOST_PYTHON3_DIR)/bin/_freeze_importlib
endef
$(eval $(call HostBuild))


+ 3
- 2
lang/python3/files/python3-package.mk View File

@ -26,8 +26,9 @@ PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
PYTHON3:=python$(PYTHON3_VERSION)
HOST_PYTHON3_LIB_DIR:=$(STAGING_DIR_HOSTPKG)/lib/python$(PYTHON3_VERSION)
HOST_PYTHON3_BIN:=$(STAGING_DIR_HOSTPKG)/bin/python3
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)
define HostPython3


Loading…
Cancel
Save