Merge pull request #4853 from StevenHessing/noddos
[feed/packages.git] / lang / python / python3 / files / python3-host.mk
index 3abf6aa5f88ab755415dd434c65e1f5c52e3ee39..4990d33a014312748a2912a5c2bc5d20c08a69e2 100644 (file)
@@ -37,21 +37,26 @@ define HostPython3
        $(HOST_PYTHON3_BIN) $(2);
 endef
 
+define host_python3_settings
+       ARCH="$(HOST_ARCH)" \
+       CC="$(HOSTCC)" \
+       CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
+       CXX="$(HOSTCXX)" \
+       LD="$(HOSTCC)" \
+       LDSHARED="$(HOSTCC) -shared" \
+       CFLAGS="$(HOST_CFLAGS)" \
+       CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
+       LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
+       _PYTHON_HOST_PLATFORM=linux2
+endef
+
 # $(1) => commands to execute before running pythons script
 # $(2) => python script and its arguments
 # $(3) => additional variables
 define Build/Compile/HostPy3RunHost
        $(call HostPython3, \
                $(if $(1),$(1);) \
-               CC="$(HOSTCC)" \
-               CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
-               CXX="$(HOSTCXX)" \
-               LD="$(HOSTCC)" \
-               LDSHARED="$(HOSTCC) -shared" \
-               CFLAGS="$(HOST_CFLAGS)" \
-               CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
-               LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
-               _PYTHON_HOST_PLATFORM=linux2 \
+               $(call host_python3_settings) \
                $(3) \
                , \
                $(2) \
@@ -60,6 +65,20 @@ define Build/Compile/HostPy3RunHost
        )
 endef
 
+# Note: I shamelessly copied this from Yousong's logic (from python-packages);
+HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
+define host_python3_pip_install
+       $(call host_python3_settings) \
+       $(HOST_PYTHON3_PIP) install \
+               --root=$(1) \
+               --prefix=$(2) \
+               --ignore-installed \
+               $(3)
+endef
+
+define host_python3_pip_install_host
+$(call host_python3_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+endef
 
 # $(1) => build subdir
 # $(2) => additional arguments to setup.py
@@ -71,11 +90,4 @@ define Build/Compile/HostPy3Mod
                $(3))
 endef
 
-define HostPy3/Compile/Default
-       $(call Build/Compile/HostPy3Mod,,\
-               install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
-               --single-version-externally-managed \
-       )
-endef
-
 endif # __python3_host_mk_inc