aboutsummaryrefslogtreecommitdiff
path: root/lang/rust/rust-package.mk
Commit message (Collapse)AuthorAge
* rust: Set rustflags by environment variableJeffery To2023-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to use $(RUSTC_TARGET_ARCH) in HOST_BUILD_DIR, the line to include rust-values.mk in the Rust makefile was moved in f489e019ac4a15e974518d9928ef913a157d135a, causing it to be included before package.mk is included. This had the side effect of preventing "-lssp_nonshared" from being added to RUSTC_LDFLAGS, because PKG_SSP is indirectly set by package.mk (package.mk includes hardening.mk, hardening.mk sets PKG_SSP). There is a deeper issue; it is the Rust package's PKG_SSP value that causes RUSTC_LDFLAGS to be set and written to the Cargo config file. For packages that use Rust to build, their PKG_SSP value does not affect the linker flag. This sets rustflags with the RUSTFLAGS environment variable, instead of writing the value to the Cargo config file, allowing PKG_SSP from the package being built to be used and for the package being built to modify the rustflags used. This also: * Fix "-lssp_nonshared" being added to TARGET_CFLAGS instead of RUSTC_LDFLAGS, when CONFIG_PKG_CC_STACKPROTECTOR_STRONG is set. * Remove the use of $(RUSTC_TARGET_ARCH) in HOST_BUILD_DIR and move the include line for rust-values.mk back to after package.mk. Since the host build directory was moved under the target build directory in efdbac38dc8b649ca26b49fac27abeb5cf76cd28, it is no longer necessary to separate build directories with RUSTC_TARGET_ARCH; $(BUILD_DIR) already separates build directories by target. * Add BUILDONLY:=1, as the Rust package does not build a target package. * Install the Cargo config file as "config.toml" instead of "config", as this is the preferred form[1]. * Rename RUST_CFLAGS to RUSTC_CFLAGS and CONFIG_HOST_SUFFIX to RUSTC_HOST_SUFFIX, for consistency. * Allow CARGO_VARS to be set before rust-values.mk is included. [1]: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure Fixes: f489e019ac4a ("rust: compile host package per target") Fixes: 83785a7ce016 ("rust-lang: Add the rust language support") Fixes: https://github.com/openwrt/packages/issues/22133 Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* rust: Move RUST_ARCH_DEPENDS into rust-values.mkJeffery To2023-09-13
| | | | | | | | This allows other packages access to RUST_ARCH_DEPENDS by including rust-values.mk, instead of rust-package.mk which also sets Build/Compile. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
* rust: enable riscv64 supportTianling Shen2023-06-07
| | | | | | rust natively supports riscv64 so let's enable it. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
* rust: update to 1.68.1Oskari Rauta2023-03-31
| | | | | | | | | also add new variable CARGO_VARS to make it possible to pass environment variables for cargo process. This is necessary when for example, cross-compiling netavark. Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
* rust: refactor build helperTianling Shen2023-03-24
| | | | | | | | | Added new RustBinPackage, RustBinHostBuild wrapper. Added new RUST_PKG_FEATURES flag. Moved CARGO_HOME to STAGING_DIR_HOSTPKG. Overrode default Build/Compile and Host/Compile to Cargo build. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
* rust-lang: Add an Host/Compile helper as wellLuca Barbato2023-03-10
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* rust-lang: Apply suggestions from code reviewLuca Barbato2023-03-10
| | | | | Co-authored-by: Tianling Shen <cnsztl@gmail.com> Signed-off-by: Luca Barbato <luca.barbato@gmail.com>
* rust-lang: Add the rust language supportLuca Barbato2023-03-10
Based on work from Donald Hoskins <grommish@gmail.com>. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>