mirror of
https://github.com/openwrt/openwrt.git
synced 2026-11-27 14:41:12 +04:00
tools/cbindgen: add cbindgen host tool
Build cbindgen 0.28.0 from a vendor tarball. cbindgen generates C headers from Rust code and is needed by Mesa for the NIL and NAK components of the Nouveau driver. USE_CBINDGEN is enabled by default with any Rust toolchain. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
1 parent
84e70f447e
commit
0ced767f14
3 files changed
+45
No files matched your search
@@ -392,6 +392,16 @@ config BUILD_BINDGEN
|
||||
help
|
||||
Installs bindgen-cli to the host toolchain.
|
||||
|
||||
config USE_CBINDGEN
|
||||
bool
|
||||
prompt "Build cbindgen (Rust to C-header generator)" if RUST_TOOLCHAINOPTS
|
||||
depends on USE_RUST_TOOLCHAIN
|
||||
default y
|
||||
help
|
||||
Installs cbindgen to the host toolchain. Required by Mesa3D Nouveau
|
||||
(NIL image library, NAK compiler) which generates C headers from Rust.
|
||||
Select when building Mesa3D with Nouveau/NVIDIA support.
|
||||
|
||||
config HAS_BPF_TOOLCHAIN
|
||||
default y if !BPF_TOOLCHAIN_NONE
|
||||
bool
|
||||
|
||||
@@ -89,6 +89,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_MOLD),y) += mold
|
||||
tools-$(CONFIG_USE_RUST_TOOLCHAIN) += rust
|
||||
tools-$(CONFIG_BUILD_BINDGEN) += bindgen
|
||||
tools-$(CONFIG_USE_CBINDGEN) += cbindgen
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/autoconf/compile := $(curdir)/m4/compile
|
||||
@@ -121,6 +122,7 @@ $(curdir)/lzop/compile := $(curdir)/cmake/compile $(curdir)/liblzo/compile
|
||||
$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/rust/compile := $(curdir)/cmake/compile $(curdir)/libdeflate/compile $(curdir)/xz/compile
|
||||
$(curdir)/bindgen/compile := $(curdir)/rust/compile $(if $(CONFIG_USE_LLVM_BUILD),$(curdir)/llvm-bpf/compile)
|
||||
$(curdir)/cbindgen/compile := $(curdir)/rust/compile
|
||||
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/meson/compile := $(curdir)/ninja/compile
|
||||
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cbindgen
|
||||
PKG_VERSION:=0.28.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
# Vendor tarball: upstream source + vendor/ + .cargo/config.toml.
|
||||
# Generated from the upstream .crate via DownloadMethod/cargo-vendor-crate, or
|
||||
# regenerate manually with: scripts/gen-cargo-vendor-tarball.sh crate cbindgen 0.28.0
|
||||
# The generator makes the tarball independent of the cargo version.
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-vendor.tar.zst
|
||||
PKG_SOURCE_URL:=@OPENWRT
|
||||
PKG_SOURCE_PROTO:=cargo-vendor-crate
|
||||
PKG_VENDOR_HASH:=eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff
|
||||
PKG_HASH:=834a03b4fcbbcbd6a2547bf15f8854b075aeb1460a6107c6db47b28a90dee15d
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/rust-host-build.mk
|
||||
|
||||
# cbindgen generates C headers from Rust structs (reverse direction from
|
||||
# bindgen). Required by Mesa3D Nouveau (NIL image library, NAK compiler).
|
||||
# Pure Rust parser, with no libclang dependency.
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
|
||||
$(INSTALL_BIN) $(HOST_INSTALL_DIR)/bin/cbindgen $(STAGING_DIR_HOST)/bin/cbindgen
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
Reference in new issue
Block a user