Skip to content

Commit

Permalink
python wheels using rustc (#5435)
Browse files Browse the repository at this point in the history
* python wheels using rustc: First attempt

* spk.mk: Revert uneeded imported changes

* python310: Temporary disabling pure python wheels

* rust: Use CARGO_TARGET* variables instead of RUSTFLAGS

* rustc: Use target add as documented for isntall additional targets

* Dockerfile: Migrate to Debian-11 Bullseye

* python310: Fix cffi build issue in crossenv

* tc.mk: Move cargo & rustup under /opt

* native/python310: Link to ffi + ssl and install setuptools-rust

* Update mk/spksrc.tc.mk

* cross-rust-env.mk: Remvoe commented environment variables

* python310: Update setuptools-rust to v1.5.2

* python310: Enable latest cryptography in crossenv

* common.mk: Add cargo to default PATH

* tc.mk: Add SYSROOT environment variable for creation of crossenv

* wheel-env.mk: Bump default api to python 3.6

* python310: Enable cryptography + bcrypt rust builds

* common.mk: Use export as ENV may double-set PATH and break

* cross/cryptography: Update to version 38.0.1 and build py36-abi3

* python-wheel.mk: Allow passing WHEELS_BUILD_ARGS for abi limited

* spk.mk: Fix wheelclean target/**/wheelhouse cleanup

* python310: Test-bed all wheels

* cryptography: Add a legacy version for python2 & python38

* duply: Build fix & upgrade from v2.3.1 to v2.4.1

* duplicity: Build fix & update to v0.8.23 from pypi

* cryptography: Missing PYO3_CROSS exports

* python310: Add --ar flag part of the crossenv build

* python310: Add env variables for cross-compiling cryptography

Initial idea was to isolate cryptography.  Alghough it get's added
as dependency and therefore uses the latest version available which
in turns doesn't have proper env variable set for cross-compiling.

* python310: Multiple adjustments cryptography, numpy, pycryptodome

- Temporary disabling cross/cryptography as failing on x86_64
- Moving numpy under spk.mk include for verion_lt to be followed
- new version of pycryptodome(x) requires -std99|11 at build time
- disabling libtorrent as tested & functional and long to build

* python-wheel.mk: Fix building when host=target in crossenv

* python310: Re-enable cross/cryptography to use x64 build fix

* python310: Add comments for numpy & pycryptodome(x)

* python310: Fix += for various variables due to many wheels

* python310: psutil 5.9.1 is last known to build on armv5/ppc

* python310: Testing all wheels done, disabling except cryptography

* python310: Update from v3.10.6 to v3.10.7

* native/cmake: Update to latest stable

* native/cmake-legacy: Provide a Debian 10 "Buster" version of cmake

* cmake.mk: Add CMAKE_LEGACY and fix exported PATH

* mysql-connector-c: Make usage of USE_NATIVE_CMAKE_LEGACY

This piece of code is so unmaintained that it requires an old
legacy version of cmake to run.  Latest changes allow using
Debian 10 "Buster" of cmake and thus makes it build again.

* cmake.mk: For CMAKE_PATH to work from spk need to use $(WORK_DIR)

* python310: Enable mysqlclient wheel build using latest changes

* python310: Disable all optional wheels in perapration for release

* python310: Update from version 3.10.7 to 3.10.8

* duplicity: Update from version 0.8.12 to 1.0.1

* bcrypt >= 4.0 also requires PYO3_CROSS* variables

* duplicity: psutil==5.9.1 is last know working version on armv5/ppc

* cross-cmake-env.mk: Fix typo and use $(WORK_DIR) for nasm def.

* cross-cmake-env.mk: Forgot to re-export nasm using ENV variable
  • Loading branch information
th0ma7 authored Oct 12, 2022
1 parent daf28a8 commit acd9a36
Show file tree
Hide file tree
Showing 37 changed files with 486 additions and 341 deletions.
14 changes: 14 additions & 0 deletions cross/cryptography-legacy/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PKG_NAME = cryptography
PKG_VERS = 3.3.2
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://files.pythonhosted.org/packages/source/c/$(PKG_NAME)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/openssl cross/cffi

HOMEPAGE = https://github.com/pyca/cryptography
COMMENT = Provide cryptographic recipes and primitives to Python developers
LICENSE = BSD/ASL2

include ../../mk/spksrc.python-module.mk
Empty file added cross/cryptography-legacy/PLIST
Empty file.
3 changes: 3 additions & 0 deletions cross/cryptography-legacy/digests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cryptography-3.3.2.tar.gz SHA1 eb8be696115458f9368432525e9cae11d0f6bebf
cryptography-3.3.2.tar.gz SHA256 5a60d3780149e13b7a6ff7ad6526b38846354d11a15e21068e57073e29e19bed
cryptography-3.3.2.tar.gz MD5 e2ce2ec8a63965fad351f36ed70fde4b
14 changes: 12 additions & 2 deletions cross/cryptography/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = cryptography
PKG_VERS = 3.3.2
PKG_VERS = 38.0.1
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = https://files.pythonhosted.org/packages/source/c/$(PKG_NAME)
Expand All @@ -11,4 +11,14 @@ HOMEPAGE = https://github.com/pyca/cryptography
COMMENT = Provide cryptographic recipes and primitives to Python developers
LICENSE = BSD/ASL2

include ../../mk/spksrc.python-module.mk
###
### This cross/cryptography is needed to generate python-limited abi3 wheels
### Ref: https://github.com/pyca/cryptography/issues/7671
###

WHEELS_BUILD_ARGS = --py-limited-api=$(PYTHON_LIMITED_API)

ENV += PYO3_CROSS_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib/
ENV += PYO3_CROSS_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/

include ../../mk/spksrc.python-wheel.mk
6 changes: 3 additions & 3 deletions cross/cryptography/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cryptography-3.3.2.tar.gz SHA1 eb8be696115458f9368432525e9cae11d0f6bebf
cryptography-3.3.2.tar.gz SHA256 5a60d3780149e13b7a6ff7ad6526b38846354d11a15e21068e57073e29e19bed
cryptography-3.3.2.tar.gz MD5 e2ce2ec8a63965fad351f36ed70fde4b
cryptography-38.0.1.tar.gz SHA1 1c8066340a44fc9aea9f96566c850e95f42930da
cryptography-38.0.1.tar.gz SHA256 1db3d807a14931fa317f96435695d9ec386be7b84b618cc61cfa5d08b0ae33d7
cryptography-38.0.1.tar.gz MD5 c47299bca4309cdda29626b0046d9229
2 changes: 1 addition & 1 deletion cross/duply/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = duply
PKG_VERS = 2.3.1
PKG_VERS = 2.4.1
PKG_SHORT_VERS = $(word 1,$(subst ., ,$(PKG_VERS))).$(word 2,$(subst ., ,$(PKG_VERS)))
PKG_EXT = tgz
PKG_DIST_NAME = $(PKG_NAME)_$(PKG_VERS).$(PKG_EXT)
Expand Down
6 changes: 3 additions & 3 deletions cross/duply/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
duply_2.3.1.tgz SHA1 fde26ede5b649457c8d12aed9423459d927a0a95
duply_2.3.1.tgz SHA256 f044f9d4b81891785212f856ace2064e8a08da19330587d580a5c233575a3091
duply_2.3.1.tgz MD5 6a1ed24829331d8cc064c94b8f6072d2
duply_2.4.1.tgz SHA1 98790dafb92f8441045ce430f4ad9ed80bd895f6
duply_2.4.1.tgz SHA256 03fd28b06206505edf0e0820d098208708842999f21b1d132461e34e2c0b6973
duply_2.4.1.tgz MD5 7d579e5a922c21b59e059a2dd4d2383b
19 changes: 9 additions & 10 deletions cross/duply/patches/001-adjust-default-python-path.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Adjust path of bash and python
--- duply.org 2020-02-24 11:53:51.000000000 +0000
+++ duply 2020-04-28 23:39:36.695912643 +0000
@@ -531,7 +531,7 @@
DEFAULT_GPG='gpg'
DEFAULT_GPG_KEY='_KEY_ID_'
DEFAULT_GPG_PW='_GPG_PASSWORD_'
-DEFAULT_PYTHON='python2'
+DEFAULT_PYTHON='/var/packages/duplicity/target/env/bin/python'
--- ../duply_2.4.1-orig/duply 2022-09-09 12:46:13.000000000 +0000
+++ duply 2022-10-06 11:19:53.344470242 +0000
@@ -951,7 +951,7 @@ SOURCE='${DEFAULT_SOURCE}'

# function definitions ##########################
# override the python interpreter to execute duplicity, unset by default
# e.g. "python3" or "/usr/bin/python3.8"
-#PYTHON="python"
+PYTHON="/var/packages/duplicity/target/env/bin/python"

# exclude folders containing exclusion file (since duplicity 0.5.14)
# Uncomment the following two lines to enable this setting.
8 changes: 5 additions & 3 deletions cross/mysql-connector-c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ HOMEPAGE = https://downloads.mysql.com/archives/c-c
COMMENT = MySQL C API (libmysqlclient)
LICENSE = GNU GPLv2

USE_NATIVE_CMAKE_LEGACY = 1

include ../../mk/spksrc.cross-cmake.mk

# give access to comp_err binary on host
ENV += PATH=$(WORK_DIR)/../../../native/libmysqlclient/work-native/install/usr/local/bin/:$(CMAKE_PATH):$$PATH

# Mandatory for build
CMAKE_ARGS += -DHAVE_LLVM_LIBCPP_EXITCODE=1
CMAKE_ARGS += -DHAVE_CXX_FLOATING_POINT_OPTIMIZATION_PROBLEMS_EXITCODE=1
Expand Down Expand Up @@ -41,6 +46,3 @@ CMAKE_ARGS += -DWITH_ZLIB=system
ifneq ($(findstring $(ARCH),$(PPC_ARCHS)),)
CMAKE_ARGS += -DHAVE_GCC_ATOMIC_BUILTINS=1
endif

# give access to comp_err binary on host
ENV += PATH=$(WORK_DIR)/../../../native/libmysqlclient/work-native/install/usr/local/bin/:$$PATH
15 changes: 11 additions & 4 deletions cross/python310/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_NAME = python310
PKG_VERS = 3.10.6
PKG_VERS = 3.10.8
PKG_VERS_MAJOR_MINOR = $(word 1,$(subst ., ,$(PKG_VERS))).$(word 2,$(subst ., ,$(PKG_VERS)))
PKG_EXT = tar.xz
PKG_DIST_NAME = Python-$(PKG_VERS).$(PKG_EXT)
Expand Down Expand Up @@ -66,6 +66,11 @@ CONFIGURE_ARGS += --with-system-expat
DEPENDS += cross/libffi
CONFIGURE_ARGS += --with-system-ffi

# PYO3 variable for cross-compiling
# cryptography through rustc
ENV += PYO3_CROSS_LIB_DIR=$(STAGING_INSTALL_PREFIX)/lib/
ENV += PYO3_CROSS_INCLUDE_DIR=$(STAGING_INSTALL_PREFIX)/include/


ADDITIONAL_CFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -L $(STAGING_INSTALL_PREFIX)/lib -I $(STAGING_INSTALL_PREFIX)/include

Expand Down Expand Up @@ -128,12 +133,14 @@ python310_install:
python310_post_install: $(WORK_DIR)/python-cc.mk
mkdir -p $(PYTHON_LIB_CROSS)
cp -R $(HOSTPYTHON_LIB_NATIVE) $(PYTHON_LIB_CROSS)/../
@$(RUN) $(PYTHON_NATIVE) -m crossenv $(STAGING_INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) $(WORK_DIR)/crossenv/
@$(RUN) $(PYTHON_NATIVE) -m crossenv $(STAGING_INSTALL_PREFIX)/bin/python$(PKG_VERS_MAJOR_MINOR) --cc $${CC} --cxx $${CXX} --ar $${AR} --sysroot $${SYSROOT} --env LIBRARY_PATH= --manylinux manylinux2014 $(WORK_DIR)/crossenv/
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) wget https://bootstrap.pypa.io/get-pip.py
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-python get-pip.py "pip==22.2.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "setuptools==63.4.3" "setuptools-rust==1.5.1" "setuptools-scm==7.0.5" "wheel==0.37.1" "cffi==1.15.1" "cryptography==3.3.2" "poetry==1.1.14" "Cython==0.29.32" "flit==3.7.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==22.2.2" --no-setuptools --no-wheel --disable-pip-version-check
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install "setuptools==63.4.3" "setuptools-rust==1.5.1" "setuptools-scm==7.0.5" "wheel==0.37.1" "cffi==1.15.1" "cryptography==3.3.2" "poetry==1.1.14" "Cython==0.29.32" "flit==3.7.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "setuptools==63.4.3" "setuptools-rust==1.5.2" "setuptools-scm==7.0.5" "wheel==0.37.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install "setuptools==63.4.3" "setuptools-rust==1.5.2" "setuptools-scm==7.0.5" "wheel==0.37.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip --disable-pip-version-check install "cffi==1.15.1" "poetry==1.1.14" "Cython==0.29.32" "flit==3.7.1" "cryptography==38.0.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip --disable-pip-version-check install "cffi==1.15.1" "poetry==1.1.14" "Cython==0.29.32" "flit==3.7.1" "cryptography==38.0.1"
ifneq ($(PYTHON_LIB_NATIVE),$(PYTHON_LIB_CROSS))
cp $(PYTHON_LIB_CROSS)/_sysconfigdata_*.py $(PYTHON_LIB_NATIVE)/_sysconfigdata.py
endif
Expand Down
6 changes: 3 additions & 3 deletions cross/python310/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Python-3.10.6.tar.xz SHA1 b5a3c74b281ab2e8e56779bbb9aeead1d92fed02
Python-3.10.6.tar.xz SHA256 f795ff87d11d4b0c7c33bc8851b0c28648d8a4583aa2100a98c22b4326b6d3f3
Python-3.10.6.tar.xz MD5 afc7e14f7118d10d1ba95ae8e2134bf0
Python-3.10.8.tar.xz SHA1 49ca7a5be7f13375e863442fbd9ead893ace3238
Python-3.10.8.tar.xz SHA256 6a30ecde59c47048013eb5a658c9b5dec277203d2793667f578df7671f7f03f3
Python-3.10.8.tar.xz MD5 e92356b012ed4d0e09675131d39b1bde
3 changes: 3 additions & 0 deletions mk/spksrc.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ MSG = echo "===> "
# Launch command in the working dir of the package source and the right environment
RUN = cd $(WORK_DIR)/$(PKG_DIR) && env $(ENV)

# Add cargo for rust compiler to default PATH
export PATH := /opt/cargo/bin:$(PATH)

# fallback by default to native/python*
PIP ?= pip

Expand Down
14 changes: 12 additions & 2 deletions mk/spksrc.cross-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,20 @@ CMAKE_ARGS += -DCMAKE_BUILD_WITH_INSTALL_RPATH=$(CMAKE_BUILD_WITH_INSTALL_RPATH)
CMAKE_ARGS += -DBUILD_SHARED_LIBS=$(BUILD_SHARED_LIBS)
endif

# Use native cmake
# Use native cmake (latest stable)
ifeq ($(strip $(USE_NATIVE_CMAKE)),1)
BUILD_DEPENDS += native/cmake
CMAKE_PATH = $(realpath $(WORK_DIR)/../../../native/cmake/work-native/install/usr/local/bin)
ENV += PATH=$(CMAKE_PATH):$$PATH
export PATH := $(CMAKE_PATH):$(PATH)
endif

# Use native cmake (Debian 10 "Buster")
ifeq ($(strip $(USE_NATIVE_CMAKE_LEGACY)),1)
BUILD_DEPENDS += native/cmake-legacy
CMAKE_PATH = $(realpath $(WORK_DIR)/../../../native/cmake-legacy/work-native/install/usr/local/bin)
ENV += PATH=$(CMAKE_PATH):$$PATH
export PATH := $(CMAKE_PATH):$(PATH)
endif

# Use ninja to build
Expand All @@ -82,9 +91,10 @@ endif
# resulting in inability to set in toolchain file
ifeq ($(strip $(CMAKE_USE_NASM)),1)
DEPENDS += native/nasm
NASM_PATH = $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin
NASM_PATH = $(realpath $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin)
ENV += PATH=$(NASM_PATH):$$PATH
ENV += AS=$(NASM_PATH)/nasm
export PATH := $(NASM_PATH):$(PATH)
ENABLE_ASSEMBLY = ON
CMAKE_ASM_COMPILER = $(NASM_PATH)/nasm
else
Expand Down
32 changes: 32 additions & 0 deletions mk/spksrc.cross-rust-env.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Configuration for rust compiler
#

RUST_TOOLCHAIN ?= stable

RUST_TARGET =
# map archs to rust targets
ifeq ($(findstring $(ARCH), $(x64_ARCHS)),$(ARCH))
RUST_TARGET = x86_64-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(i686_ARCHS)),$(ARCH))
RUST_TARGET = i686-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(ARMv5_ARCHS)),$(ARCH))
# may be not supported for cargo
RUST_TARGET = armv5te-unknown-linux-gnueabi
endif
ifeq ($(findstring $(ARCH), $(ARMv7_ARCHS)),$(ARCH))
RUST_TARGET = armv7-unknown-linux-gnueabihf
endif
ifeq ($(findstring $(ARCH), $(ARMv7L_ARCHS)),$(ARCH))
RUST_TARGET = armv7-unknown-linux-gnueabi
endif
ifeq ($(findstring $(ARCH), $(ARMv8_ARCHS)),$(ARCH))
RUST_TARGET = aarch64-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(PPC_ARCHS)),$(ARCH))
RUST_TARGET = powerpc-unknown-linux-gnu
endif
ifeq ($(RUST_TARGET),)
$(error Arch $(ARCH) not supported)
endif
79 changes: 12 additions & 67 deletions mk/spksrc.cross-rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,93 +31,38 @@ TC = syno$(ARCH_SUFFIX)
endif

##### rust specific configurations
include ../../mk/spksrc.cross-rust-env.mk

# configure is used to install rust targets
CONFIGURE_TARGET = install_rust_target
CONFIGURE_TARGET = nop

# skip compile_target if not used by module
ifeq ($(strip $(COMPILE_TARGET)),)
COMPILE_TARGET = nop
COMPILE_TARGET = rust_build_target
endif

RUST_TOOLCHAIN ?= stable

RUST_TARGET =
# map archs to rust targets
ifeq ($(findstring $(ARCH), $(x64_ARCHS)),$(ARCH))
RUST_TARGET=x86_64-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(i686_ARCHS)),$(ARCH))
RUST_TARGET=i686-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(ARMv5_ARCHS)),$(ARCH))
# may be not supported for cargo
RUST_TARGET=armv5te-unknown-linux-gnueabi
endif
ifeq ($(findstring $(ARCH), $(ARMv7_ARCHS)),$(ARCH))
RUST_TARGET=armv7-unknown-linux-gnueabihf
endif
ifeq ($(findstring $(ARCH), $(ARMv7L_ARCHS)),$(ARCH))
RUST_TARGET=armv7-unknown-linux-gnueabi
endif
ifeq ($(findstring $(ARCH), $(ARMv8_ARCHS)),$(ARCH))
RUST_TARGET=aarch64-unknown-linux-gnu
endif
ifeq ($(findstring $(ARCH), $(PPC_ARCHS)),$(ARCH))
RUST_TARGET=powerpc-unknown-linux-gnu
endif
ifeq ($(RUST_TARGET),)
$(error Arch $(ARCH) not supported)
endif

# Use distrib folder as cargo download cache
CARGO_HOME_PATH=/spksrc/distrib/cargo
ENV += CARGO_HOME=$(CARGO_HOME_PATH)
ENV += PATH=:$(CARGO_HOME_PATH)/bin/:$(PATH)

ifeq (,$(shell $(ENV) which rustup))
install_rustup:
@echo " ==> install rustup" ; \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
CARGO_HOME=$(CARGO_HOME_PATH) sh -s -- -y
else
install_rustup:
@echo " ==> rustup already installed" ;
ifeq ($(strip $(INSTALL_TARGET)),)
INSTALL_TARGET = rust_install_target
endif

install_rust_toolchain: install_rustup
@echo " ==> install rust toolchain [$(RUST_TOOLCHAIN)]" ; \
env $(ENV) rustup toolchain install $(RUST_TOOLCHAIN) ;
env $(ENV) rustup default $(RUST_TOOLCHAIN) ;

# Install rust target on demand:
install_rust_target: install_rust_toolchain
@echo " ==> install rust target [$(RUST_TARGET)]" ; \
env $(ENV) rustup target install $(RUST_TARGET) ;

# Set default RUST_SRC_DIR
ifeq ($(strip $(RUST_SRC_DIR)),)
RUST_SRC_DIR = $(WORK_DIR)/$(PKG_DIR)
endif

# Set linker environment variable
RUST_LINKER_ENV=CARGO_TARGET_$(shell echo $(RUST_TARGET) | tr - _ | tr a-z A-Z)_LINKER
CARGO_ENV=$(RUST_LINKER_ENV)=$(TC_PATH)$(TC_PREFIX)gcc

# Set the cargo parameters
CARGO_BUILD_ARGS += --target=$(RUST_TARGET)
CARGO_BUILD_ARGS += --path $(RUST_SRC_DIR)
CARGO_BUILD_ARGS += --root $(STAGING_INSTALL_PREFIX)


ifeq ($(strip $(INSTALL_TARGET)),)
INSTALL_TARGET = rust_build_and_install_target
endif
# Default rust build and installation with cargo
rust_build_target:
@echo " ==> Cargo build rust package $(PKG_NAME)"
$(ENV) cargo build $(CARGO_BUILD_ARGS)

# Default rust build and installation with cargo
rust_build_and_install_target:
rust_install_target:
@echo " ==> Cargo install rust package $(PKG_NAME)"
$(ENV) $(CARGO_ENV) cargo install $(CARGO_BUILD_ARGS)
$(ENV) cargo install $(CARGO_BUILD_ARGS)


#####
Expand Down Expand Up @@ -157,7 +102,7 @@ smart-clean:
rm -f $(WORK_DIR)/.$(COOKIE_PREFIX)*

clean:
rm -fr work work-*
rm -fr work work-* build-*.log

all: install plist

Expand Down
2 changes: 1 addition & 1 deletion mk/spksrc.native-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif
# set default ASM build environment
ifeq ($(strip $(CMAKE_USE_NASM)),1)
DEPENDS += native/nasm
NASM_PATH = $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin
NASM_PATH = $(realpath $(WORK_DIR)/../../../native/nasm/work-native/install/usr/local/bin)
ENV += PATH=$(NASM_PATH):$$PATH
ENV += AS=$(NASM_PATH)/nasm
CMAKE_ARGS += -DENABLE_ASSEMBLY=ON
Expand Down
4 changes: 2 additions & 2 deletions mk/spksrc.python-wheel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ include ../../mk/spksrc.wheel-env.mk
build_python_wheel_target:
ifeq ($(strip $(CROSSENV)),)
# Python 2 way
@$(RUN) PYTHONPATH=$(PYTHONPATH) $(HOSTPYTHON) -c "import setuptools;__file__='setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" $(BUILD_ARGS) bdist_wheel -d $(WHEELHOUSE)
@$(RUN) PYTHONPATH=$(PYTHONPATH) $(HOSTPYTHON) -c "import setuptools;__file__='setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" $(BUILD_ARGS) bdist_wheel $(WHEELS_BUILD_ARGS) -d $(WHEELHOUSE)
else
# Python 3 case: using crossenv helper
@. $(CROSSENV) && $(RUN) PYTHONPATH=$(PYTHONPATH) python -c "import setuptools;__file__='setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" $(BUILD_ARGS) bdist_wheel -d $(WHEELHOUSE)
@. $(CROSSENV) && $(RUN) _PYTHON_HOST_PLATFORM=$(TC_TARGET) python3 setup.py $(BUILD_ARGS) bdist_wheel $(WHEELS_BUILD_ARGS) -d $(WHEELHOUSE)
endif
@$(RUN) echo "$(PKG_NAME)==$(PKG_VERS)" >> $(WHEELHOUSE)/$(WHEELS_CROSS_COMPILE)

Expand Down
7 changes: 5 additions & 2 deletions mk/spksrc.spk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -438,19 +438,22 @@ spkclean:
work-*/.depend_done \
work-*/.icon_done \
work-*/.strip_done \
work-*/.wheel_done \
work-*/conf \
work-*/scripts \
work-*/staging \
work-*/tc_vars.mk \
work-*/tc_vars.cmake \
work-*/wheelhouse \
work-*/package.tgz \
work-*/INFO \
work-*/PLIST \
work-*/PACKAGE_ICON* \
work-*/WIZARD_UIFILES

wheelclean: spkclean
rm -fr work-*/.wheel_done \
work-*/wheelhouse \
work-*/install/var/packages/**/target/share/wheelhouse

all: package
ifneq ($(filter 1 on ON,$(PSTAT)),)
@$(MSG) MAKELEVEL: $(MAKELEVEL), PARALLEL_MAKE: $(PARALLEL_MAKE), ARCH: $(ARCH)-$(TCVERSION) >> $(PSTAT_LOG)
Expand Down
Loading

0 comments on commit acd9a36

Please sign in to comment.